-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move proxy docker image into proxy folder
- Loading branch information
Showing
7 changed files
with
152 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
.PHONY: all | ||
all: frontend backend | ||
echo "Building Done" | ||
|
||
# Swagger defs | ||
.PHONY: swagger | ||
swagger: | ||
cd backend && go generate ./... | ||
|
||
# Frontend | ||
.PHONY: frontend-install | ||
frontend-install: | ||
cd ./cahfrontend/ && pnpm i | ||
|
||
.PHONY: frontend-api | ||
frontend-api: swagger | ||
npx swagger-typescript-api -p ./backend/docs/swagger.json -o ./cahfrontend/src/ -n api.ts | ||
|
||
.PHONY: frontend-tygo | ||
frontend-tygo: | ||
go install github.com/gzuidhof/tygo@latest | ||
cd backend && tygo generate | ||
|
||
.PHONY: frontend-types | ||
frontend-types: frontend-tygo frontend-api | ||
echo "Generated types" | ||
|
||
.PHONY: frontend-storybook | ||
frontend-storybook: frontend-install | ||
cd ./cahfrontend && pnpm run build-storybook | ||
|
||
.PHONY: frontend | ||
frontend: frontend-install frontend-types | ||
cd ./cahfrontend && pnpm run build | ||
|
||
# Backend | ||
.PHONY: backend | ||
backend: swagger | ||
cd ./backend/ && go build | ||
|
||
# Tests | ||
.PHONY: test-frontend | ||
test-frontend: frontend-types | ||
cd ./cahfrontend && pnpm run test | ||
|
||
GO_TEST_ARGS=-v -benchmem -parallel 16 ./... -race -cover -coverpkg ./... -covermode=atomic -coverprofile=coverage.out | ||
|
||
.PHONY: test-backend | ||
test-backend: backend | ||
cd ./backend/ && go test './...' ${GO_TEST_ARGS} | ||
|
||
.PHONY: start-docker-compose | ||
start-docker-compose: | ||
docker-compose up --build --detach | ||
|
||
# Everything is tested within docker, so this can be started imediately | ||
.PHONY: test-e2e | ||
test-e2e: start-docker-compose | ||
cd ./e2e/ && go test './...' ${GO_TEST_ARGS} | ||
|
||
.PHONY: test | ||
test: test-backend test-frontend test-e2e frontend-storybook | ||
echo "Testing Done" | ||
|
||
.PHONY: bench | ||
bench: backend | ||
cd ./backend/ && go test '-bench=./...' | ||
|
||
# Formatters | ||
.PHONY: e2e-fmt | ||
e2e-fmt: | ||
cd ./e2e/ && gofmt -l -w . | ||
|
||
.PHONY: backend-fmt | ||
backend-fmt: | ||
cd ./backend/ && swag fmt && gofmt -l -w . | ||
|
||
.PHONY: frontend-fmt | ||
frontend-fmt: | ||
cd ./cahfrontend/ && prettier -w . | ||
|
||
.PHONY: fmt | ||
fmt: backend-fmt frontend-fmt e2e-fmt | ||
echo "Formatting Done" | ||
|
||
# Debug scripts | ||
.PHONY: debug-e2e-tests | ||
debug-e2e-tests: | ||
cd ./e2e/ && go test -c && gdb ./e2e.test | ||
|
||
.PHONY: debug-backend-tests | ||
debug-backend-tests: | ||
cd ./backend/ && go test -c && gdb ./backend.test | ||
|
||
.PHONY: debug-backend | ||
debug-backend: | ||
cd ./backend/ && go build && gdb ./backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM nginx | ||
|
||
WORKDIR /app | ||
COPY ./mime.types . | ||
COPY docker.nginx.conf /etc/nginx/nginx.conf | ||
|
||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,58 @@ | ||
server { | ||
listen 80; | ||
worker_processes 10; | ||
|
||
location / { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto http; | ||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
proxy_pass http://frontend:80/; | ||
http { | ||
default_type application/octet-stream; | ||
|
||
proxy_connect_timeout 7d; | ||
proxy_read_timeout 7d; | ||
} | ||
sendfile on; | ||
keepalive_timeout 65; | ||
|
||
location /api/ { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto http; | ||
include "/app/mime.types"; | ||
|
||
proxy_pass http://backend:8080/; | ||
server { | ||
listen 80; | ||
|
||
proxy_connect_timeout 7d; | ||
proxy_read_timeout 7d; | ||
} | ||
location / { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto http; | ||
|
||
proxy_pass http://frontend:80/; | ||
|
||
proxy_connect_timeout 7d; | ||
proxy_read_timeout 7d; | ||
} | ||
|
||
location /api/ { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto http; | ||
|
||
proxy_pass http://backend:8080/; | ||
|
||
proxy_connect_timeout 7d; | ||
proxy_read_timeout 7d; | ||
} | ||
|
||
location /ws { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto http; | ||
location /ws { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto http; | ||
|
||
proxy_pass http://backend:8080/games/join; | ||
proxy_pass http://backend:8080/games/join; | ||
|
||
proxy_connect_timeout 7d; | ||
proxy_connect_timeout 7d; | ||
|
||
proxy_http_version 1.1; | ||
proxy_http_version 1.1; | ||
|
||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "Upgrade"; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "Upgrade"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.