fix: deployment

+ include api-docs in nginx
+ include quests in docker compose
+ update README
This commit is contained in:
wancat committed 2023-08-22 12:11:58 +08:00
1 parent 9aa9367f9e
commit d8f8605df9
5 files changed
+48 -59

No files matched your search

+32 -50
View File
@@ -8,76 +8,58 @@
## Installation ## Installation
``` git clone https://github.com/lancatlin/linux-odyssey.git
git clone https://github.com/lancatlin/linux-odyssey.git cd linux-odyssey
cd linux-odyssey yarn install
yarn install
```
## Create database ## Developement
``` Run everything (frontend, backend, db, swagger, quests):
docker compose pull
docker compose up -d db
```
## Server
Source: `server/`
```
docker compose -f docker-compose.build.yml pull
docker compose up -d
# Open http://localhost:3000
```
### Build images
docker compose build docker compose build
docker compose push docker compose up -d
Game images: ### Deployment
``` docker compose -f docker-compose.prod.yml build
docker compose -f docker-compose.build.yml build docker compose -f docker-compose.prod.yml push
docker compose -f docker-compose.build.yml push
```
## App # Server side
docker compose -f docker-compose.prod.yml pull
docker compose -f docker-compose.prod.yml up -d
## Standalone App (without Docker)
Source: `app/` Source: `app/`
``` # Connect to dev server (https://odyssey.wancat.cc)
# Connect to dev server (https://odyssey.wancat.cc) yarn app
yarn app
# Connect to localhost (http://localhost:3000) # Connect to localhost (http://localhost:3000)
yarn app:local yarn app:local
```
# Connect to anyhost
API_ENDPOINT=http://example.com yarn app:local
## Swagger ## Swagger
``` docker compose up -d swagger
docker compose up -d swagger
```
Open http://localhost:8080 to open Swagger Open http://localhost:8080 to open Swagger
## CLI terminal client ## CLI terminal client (Docker not required)
``` yarn cli
yarn cli Usage: client [options] [command]
Usage: client [options] [command]
Options: Options:
-s, --session <string> Session ID -s, --session <string> Session ID
-c, --create Create a new session -c, --create Create a new session
-h, --host <string> Server host (default: "http://localhost:3000") -h, --host <string> Server host (default: "http://localhost:3000")
--help display help for command --help display help for command
Commands: Commands:
list List all sessions list List all sessions
```
connet to recent session: connet to recent session:
+4
View File
@@ -11,6 +11,10 @@ server {
proxy_pass http://backend:3000; proxy_pass http://backend:3000;
} }
location /api-docs/ {
proxy_pass http://backend:3000;
}
location /socket.io/ { location /socket.io/ {
proxy_pass http://backend:3000; proxy_pass http://backend:3000;
proxy_http_version 1.1; proxy_http_version 1.1;
-7
View File
@@ -1,7 +0,0 @@
version: '3'
services:
helloworld:
image: lancatlin/linux-odyssey:helloworld
build:
context: .
dockerfile: quests/helloworld/Dockerfile
+6 -2
View File
@@ -18,8 +18,6 @@ services:
networks: networks:
- internal - internal
- players - players
ports:
- '3000:3000'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
environment: environment:
@@ -42,6 +40,12 @@ services:
- MONGO_PASS=user-password - MONGO_PASS=user-password
- MONGO_DB=odyssey-test - MONGO_DB=odyssey-test
helloworld:
image: lancatlin/linux-odyssey:helloworld
build:
context: .
dockerfile: quests/helloworld/Dockerfile
networks: networks:
internal: internal:
players: players:
+6
View File
@@ -47,6 +47,12 @@ services:
environment: environment:
- SWAGGER_FILE=/tmp/swagger.yaml - SWAGGER_FILE=/tmp/swagger.yaml
helloworld:
image: lancatlin/linux-odyssey:helloworld
build:
context: .
dockerfile: quests/helloworld/Dockerfile
networks: networks:
internal: internal:
players: players: