Skip to content

Commit

Permalink
Postgres,Redis,GoogleCloud,Traefik,Docker-Compose,Vue3 Account Client…
Browse files Browse the repository at this point in the history
… are done
  • Loading branch information
fshmidt committed Feb 8, 2023
0 parents commit d42cfa7
Show file tree
Hide file tree
Showing 75 changed files with 10,470 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.env
*.pem
test.go
serviceAccount.json
.bin
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM golang:1.19-alpine3.17 AS builder

ENV GO111MODULE=on

RUN go version

COPY . /github.com/fshmidt/game-site/
WORKDIR /github.com/fshmidt/game-site/

RUN go mod download
RUN go install github.com/cespare/reflex@latest

RUN GOOS=linux go build -o ./.bin/site ./cmd/main.go ./cmd/data_sources.go ./cmd/injection.go

FROM alpine:latest

RUN apk --no-cache add ca-certificates

WORKDIR /root/

COPY --from=0 /github.com/fshmidt/game-site/.bin/site .

EXPOSE 8080

CMD ["./site"]
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.PHONY: keypair migrate-create migrate-up migrate-down migrate-force

PWD = $(shell pwd)
ACCTPATH = $(PWD)
MPATH = $(ACCTPATH)/migrations
PORT = 5432

# Default number of migrations to execute up or down
N = 1

migrate-create:
@echo "----Creating migration----"
migrate create -ext sql -dir $(MPATH) -seq -digits 5 $(NAME)

migrate-up:
migrate -source file://$(MPATH) -database postgres://postgres:password@localhost:$(PORT)/postgres?sslmode=disable up $(N)

migrate-down:
migrate -source file://$(MPATH) -database postgres://postgres:password@localhost:$(PORT)/postgres?sslmode=disable down $(N)

migrate-force:
migrate -source file://$(MPATH) -database postgres://postgres:password@localhost:$(PORT)/postgres?sslmode=disable force $(VERSION)

# Create keypair should be in your file below

create-keypair:
@echo "Creating an rsa 256 key pair"
openssl genpkey -algorithm RSA -out $(ACCTPATH)/rsa_private_$(ENV).pem -pkeyopt rsa_keygen_bits:2048
openssl rsa -in $(ACCTPATH)/rsa_private_$(ENV).pem -pubout -out $(ACCTPATH)/rsa_public_$(ENV).pem

# create dev and test keys
# run postgres containers in docker-compose
# migrate down
# migrate up
# docker-compose dwon
init:
docker-compose up -d postgres-account && \
$(MAKE) create-keypair ENV=dev && \
$(MAKE) create-keypair ENV=test && \
$(MAKE) migrate-down APPPATH=account N= && \
$(MAKE) migrate-up APPPATH=account N= && \
docker-compose down
3 changes: 3 additions & 0 deletions account-client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/*
.git
.gitignore
6 changes: 6 additions & 0 deletions account-client/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["eslint:recommended", "plugin:vue/vue3-essential"],
"rules": {
"no-unused-vars": [1, { "args": "all", "argsIgnorePattern": "^_" }]
}
}
24 changes: 24 additions & 0 deletions account-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
21 changes: 21 additions & 0 deletions account-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:lts-alpine

# make the 'app' folder the current working directory
WORKDIR /app

# add `/app/node_modules/.bin` to $PATH - allow running 'vite'
#ENV PATH /app/node_modules/.bin:$PATH

# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./

# install project dependencies


# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .
RUN npm install --unsafe-perm=true --allow-root
RUN npm install [email protected] --unsafe-perm=true --allow-root
#RUN chown -R node ~/.npm
#RUN chown -R node /app/node_modules/
CMD [ "npm", "run", "dev", "--unsafe-perm=true", "--allow-root"]
40 changes: 40 additions & 0 deletions account-client/DockerfileNGNX
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM node:lts-alpine AS build

# make the 'app' folder the current working directory
WORKDIR /app

# add `/app/node_modules/.bin` to $PATH - allow running 'vite'
#ENV PATH /app/node_modules/.bin:$PATH

# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./

# install project dependencies
#RUN mkdir -p /app/node_modules
#
#RUN chown -R node:node /app/node_modules
COPY . .
# RUN npm ci
RUN npm run build
#RUN mkdir -p /app/node_modules/.vite/deps_temp
# EXPOSE 3000
# copy project files and folders to the current working directory (i.e. 'app' folder)

FROM nginx:1.22.1-alpine AS prod-stage
COPY --from=build /app/dist /usr/share/nginx/html/account
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]

# CMD [ "npm", "run", "dev" ]

# FROM node:lts-alpine AS build
# WORKDIR /app
# COPY package.json ./
# RUN npm install
# COPY . .
# RUN npm run build

# FROM nginx:1.22.1-alpine AS prod-stage
# COPY --from=build /app/dist /usr/share/nginx/html
# EXPOSE 3000
# CMD ["nginx", "-g", "daemon off;"]
7 changes: 7 additions & 0 deletions account-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Vue 3 + Vite

This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

## Recommended IDE Setup

- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
13 changes: 13 additions & 0 deletions account-client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
5 changes: 5 additions & 0 deletions account-client/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"include": [
"./src/**/*"
]
}
Loading

0 comments on commit d42cfa7

Please sign in to comment.