doc: update README

This commit is contained in:
Justin Lin committed 2024-10-10 17:41:47 +08:00
1 parent 98f18627e5
commit 6bc37900d8
3 files changed
+62 -72

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
HOST=localhost
PORT=3000
BASE_URL=http://localhost:5173
BACKEND_URL=http://localhost:3000
MONGO_URL=mongodb://localhost:27017/odyssey-test
SECRET_KEY=sample-secret
# Optional
# CONTAINER_EXPIRY=60 # 60 minutes
# SESSION_MAX_AGE=168 # 7 days
# TRUSTED_PROXIES=1.2.3.4
# valid configurations see isIP & isIPRange in https://github.com/validatorjs/validator.js?tab=readme-ov-file#validators
# GOOGLE_CLIENT_ID=
# GOOGLE_CLIENT_SECRET=
# GITHUB_CLIENT_ID=
# GITHUB_CLIENT_SECRET=
# SURVEY_URL=
# BUG_REPORT_URL=
# DOCKER_NETWORK=
# SURVEY_URL=
# BUG_REPORT_URL=
# Docker related config
# DOCKER_NETWORK=host
# QUEST_IMAGE=linuxodyssey/quest-base
# DOCKER_PREFIX=linuxodyssey/quest-
# To mount quest folder from host into container, for development purpose
# MOUNT_QUEST=true
# LOG_PATH=
# Testing, create a user with the following credentials, disable rate limiting
# TESTING=true
# TESTING_USERNAME=alex
# TESTING_PASSWORD=Alex1234
+23 -71
View File
@@ -9,15 +9,18 @@
- Docker - Docker
- Yarn: v1.22 - Yarn: v1.22
## Known Issues
- The player's terminal doesn't work correctly on Mac OS and Windows for now. Please use Linux or Virtual Machines. You can track [this issue](https://github.com/linux-odyssey/linux-odyssey/issues/165) for updates.
- MongoDB requires x86 architecture to run for v5+ versions. You can track [this issue](https://github.com/linux-odyssey/linux-odyssey/issues/166) for updates.
## 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
## Development ## Project Structures
### Project Structures
1. **app**: frontend 1. **app**: frontend
2. **server**: backend 2. **server**: backend
@@ -94,17 +97,27 @@ You can edit the files on your host, and the changes will be reflected in the co
MOUNT_QUEST=true MOUNT_QUEST=true
### Development ## Development
Build up dependencies: Copy `.env.sample` to `.env` and customize it for your needs.
yarn build:deps Build the whole project for the first time:
yarn build
This will build the typescript for each package and the server.
Run dev server (frontend, backend): Run dev server (frontend, backend):
yarn dev yarn dev
If you want to enable social login, you should have OAuth client token in a `.env` file: **IMPORTANT NOTE**: only the app and server have hot-reloading, other packages require manually running `yarn dev` in each package.
To develop analytics dashboard:
yarn analytics
The default username and password is `alex` and `Alex1234`.
## Testing ## Testing
@@ -124,8 +137,9 @@ Run Cypress in container, create brand-new containers along with it:
# tearing off the containers # tearing off the containers
./docker-scripts.sh down ./docker-scripts.sh down
### Deployment ## Deployment
# Build the images (only allowed for maintainers)
docker compose -f docker-compose.prod.yml build docker compose -f docker-compose.prod.yml build
docker compose -f docker-compose.prod.yml push docker compose -f docker-compose.prod.yml push
@@ -134,66 +148,4 @@ Run Cypress in container, create brand-new containers along with it:
docker compose -f docker-compose.prod.yml up -d docker compose -f docker-compose.prod.yml up -d
To enable social login, you should have OAuth client token in a `.env` file: To enable social login, you should have OAuth client token in a `.env` file:
You can copy from `example.env` You can copy from `.env.sample`
# .env
BASE_URL=https://example.com
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
To enable it:
docker compose --env-file .env -f docker-compose.prod.yml up -d
## Standalone App (without Docker)
Source: `app/`
# Connect to dev server (https://odyssey.wancat.cc)
yarn app
# Connect to localhost (http://localhost:3000)
yarn app:local
# Connect to anyhost
API_ENDPOINT=http://example.com yarn app:local
## Swagger
docker compose up -d swagger
Open http://localhost:8080 to open Swagger
## CLI terminal client (Docker not required)
yarn cli
Usage: client [options] [command]
Options:
-s, --session <string> Session ID
-c, --create Create a new session
-h, --host <string> Server host (default: "http://localhost:3000")
--help display help for command
Commands:
list List all sessions
connet to recent session:
yarn cli
connect to new session:
yarn cli -c
connect to specific session:
yarn cli -s 64d0de0367459c13004bc83f
connect to other host:
yarn cli -h https://example.com
list sessions:
yarn cli list
+1 -1
View File
@@ -70,7 +70,7 @@ function createConfig() {
projectRoot: getProjectRoot(), projectRoot: getProjectRoot(),
log: { log: {
path: get('LOG_PATH', '../logs'), path: get('LOG_PATH', path.join(getProjectRoot(), 'logs')),
}, },
testing: { testing: {
enabled: !isProduction && process.env.TESTING === 'true', enabled: !isProduction && process.env.TESTING === 'true',