We need to create a data directory for docker containers
Assuming you are in the root directory of this repository
- create a new folder
data
under this directory, and create following folder structure
./data
├─── client
│ └─── config
└─── server
├─── config
└─── uploadedImages
You can use following commands to create all of them at once
- Windows
mkdir data\client\config
mkdir data\server\config
mkdir data\server\uploadedImages
- MacOS & Linux
mkdir -p data/client/config
mkdir -p data/server/config
mkdir -p data/server/uploadedImages
-
follow frontend client configuration document to create all config file under
data/client/config
- When using docker-compose, configuring .env file will automatically configure the client for you. You don't need to create a separate config file
- When using docker along, you still need this step
-
follow backend client configuration document to create all config file under
data/backend/config
- Note that you should set the path of
log_file
to/src/data/your-moon-server.log
, so server's log file can be put underdata/server
- Also Note that docker container will only accept
production.config.json
file, so be sure you create the right one - You can use ./server/config/production.config.json.docker as your starting point
- Be carefull about "frontend_url" field in the config file, you cannot use this field if deploying with reverse proxy
- Note that you should set the path of
Assuming you are in the root directory of this repository
-
you have 2 options when deploying this application with docker-compose
- open frontend and backend in 2 separate ports
- only open one port, and use reverse proxy to route both frontend and backend
-
you need to configure for both options
-
for
2 separate ports
- create a new file called
.env
- and then add a new line in it:
BACKEND_URL="http://my.ip.addr.ess:3001"
- this file will tell docker-compose where is the backend
- you should set the port of backend base on how it is defined in
docker-compose.yml
file, by default its3001
- you should set the port of backend base on how it is defined in
- you can use file
.env.template
as your starting point
- create a new file called
-
for
use reverse proxy
option- create a new file called
.env
- and then add a new line in it:
APP_PORT=8080
- this file will tell docker-compose which port to expose for the entire app
- you can use file
.env.template
as your starting point
- create a new file called
-
to run a Redis server with username and password, you can set optional environment variable in your
.env
file. Add following line to your.env
file:
REDIS_CONFIG="/path/to/optional/redis.conf"
Note that, we use this argument as the build argument for
redis/Dockerfile
, so relative path will be relative toredis/
folder, you should use absolute path. Checkout redis/README.md for more detail
- deploying for
2 separate ports
option
docker-compose -f docker-compose.yml up -d
- deploying for
use reverse proxy
option
docker-compose -f docker-compose-reverse-proxy.yml up -d
-
Note that you should rebuild docker images to avoid using old/outdated image
-
rebuild for
2 separate ports
option
docker-compose -f docker-compose.yml build --no-cache
- rebuild for
use reverse proxy
option
docker-compose -f docker-compose-reverse-proxy.yml build --no-cache