4 Commits f0bcc35199 ... 30fd642238

Author SHA1 Message Date
  Owen Diffey 30fd642238 refactor: Re-add backend debug port configuration 1 month ago
  Owen Diffey 33a6d964bf chore: Remove outdated configuration section from docs 1 month ago
  Owen Diffey 8ccc214a13 chore: Update docker configuration docs 1 month ago
  Owen Diffey 916be07690 chore: Rename docker compose files 1 month ago
9 changed files with 42 additions and 20 deletions
  1. 1 0
      .env.example
  2. 1 0
      .gitignore
  3. 26 13
      .wiki/Configuration.md
  4. 1 1
      backend/entrypoint.dev.sh
  5. 1 0
      compose.dev.yml
  6. 2 0
      compose.local.yml
  7. 4 0
      compose.override.yml.example
  8. 0 2
      compose.yml
  9. 6 4
      musare.sh

+ 1 - 0
.env.example

@@ -5,6 +5,7 @@ CONTAINER_MODE=production
 APP_ENV=production
 
 BACKEND_DEBUG=false
+BACKEND_DEBUG_PORT=9229
 
 FRONTEND_CLIENT_PORT=80
 FRONTEND_DEV_PORT=81

+ 1 - 0
.gitignore

@@ -12,6 +12,7 @@ startMongo.cmd
 .redis
 *.rdb
 backups/
+compose.override.yml
 docker-compose.override.yml
 
 npm-debug.log

+ 26 - 13
.wiki/Configuration.md

@@ -12,16 +12,6 @@ After updating values in `.env`, containers should be restarted or rebuilt.
 If you are using a different setup, you will need to define the relevant
 environment variables yourself.
 
-In the table below, the `[SERVICE]_HOST` properties refer to the IP address that
-the Docker container listens on. Setting this to `127.0.0.1` for will only expose
-the configured port to localhost, whereas setting this to `0.0.0.0` will expose the
-port on all interfaces.
-The `[SERVICE]_PORT` properties refer to the external Docker container port, used
-to access services from outside the container. Changing this does not require any
-changes to configuration within container. For example, setting the `MONGO_PORT`
-to `21018` will allow you to access the mongo database through that port on your
-machine, even though the application within the container is listening on `21017`.
-
 | Property | Description |
 | --- | --- |
 | `COMPOSE_PROJECT_NAME` | Should be a unique name for this installation, especially if you have multiple instances of Musare on the same machine. |
@@ -29,6 +19,7 @@ machine, even though the application within the container is listening on `21017
 | `CONTAINER_MODE` | Should be either `production` or `local`.  |
 | `APP_ENV` | Should be either `production` or `development`.  |
 | `BACKEND_DEBUG` | Should be either `true` or `false`. If enabled backend will await debugger connection and trigger to start. |
+| `BACKEND_DEBUG_PORT` | Backend container debug port, if enabled. |
 | `FRONTEND_CLIENT_PORT` | Should be the port on which the frontend will be accessible from, usually port `80`, or `443` if using SSL. Only used when running in development mode. |
 | `FRONTEND_DEV_PORT` | Should be the port where Vite's dev server will be accessible from, should always be port `81` for Docker since nginx listens on port 80, and is recommended to be port `80` for non-Docker. Only used when running in development mode. |
 | `FRONTEND_PROD_DEVTOOLS` | Whether to enable Vue dev tools in production builds. [^1] |
@@ -158,10 +149,16 @@ For more information on configuration files please refer to the
 | `experimental.soundcloud` | Experimental SoundCloud integration. |
 | `experimental.spotify` | Experimental Spotify integration. |
 
-## Docker-compose override
+## Docker
+
+Below are some snippets that may help you get started with Docker.
+For more information please see the [Docker documentation](https://docs.docker.com).
 
-You may want to override the docker-compose files in some specific cases.
-For this, you can create a `docker-compose.override.yml` file.
+### Compose override
+
+You may want to override the docker compose files in some specific cases.
+For this, you can create a `compose.override.yml` file.
+An example is available at [compose.override.yml.example](../compose.override.yml.example).
 
 For example, to expose the frontend port:
 
@@ -180,3 +177,19 @@ services:
     ports:
       - "127.0.0.1:9229:9229"
 ```
+
+### Daemon configuration
+
+The below is an example `daemon.json` configured to bind to a specific IP,
+and setup log rotation.
+
+```json
+{
+  "ip": "127.0.0.1",
+  "log-driver": "json-file",
+  "log-opts": {
+    "max-size": "10m",
+    "max-file": "10"
+  }
+}
+```

+ 1 - 1
backend/entrypoint.dev.sh

@@ -7,7 +7,7 @@ if [ ! -d node_modules ]; then
 fi
 
 if [ "${BACKEND_DEBUG}" = "true" ]; then
-    export INSPECT_BRK="--inspect-brk=0.0.0.0:9229"
+    export INSPECT_BRK="--inspect-brk=0.0.0.0:${BACKEND_DEBUG_PORT:-9229}"
 else
     export INSPECT_BRK=""
 fi

+ 1 - 0
docker-compose.dev.yml → compose.dev.yml

@@ -5,6 +5,7 @@ services:
     environment:
       - APP_ENV=${APP_ENV:-development}
       - BACKEND_DEBUG=${BACKEND_DEBUG:-false}
+      - BACKEND_DEBUG_PORT=${BACKEND_DEBUG_PORT:-9229}
 
   frontend:
     build:

+ 2 - 0
docker-compose.local.yml → compose.local.yml

@@ -5,6 +5,8 @@ services:
       - ./common:/opt/common
       - ./types:/opt/types
       - ./backend:/opt/app
+    ports:
+      - ${BACKEND_DEBUG_PORT:-9229}:${BACKEND_DEBUG_PORT:-9229}"
 
   frontend:
     volumes:

+ 4 - 0
compose.override.yml.example

@@ -0,0 +1,4 @@
+services:
+  frontend:
+    ports:
+      - "127.0.0.1:80:80"

+ 0 - 2
docker-compose.yml → compose.yml

@@ -1,5 +1,3 @@
-version: "3.8"
-
 services:
   backend:
     build:

+ 6 - 4
musare.sh

@@ -69,14 +69,16 @@ if [[ ${dockerInstalled} -gt 0 || ${composeInstalled} -gt 0 ]]; then
 fi
 
 # Add docker compose file arguments to command
-composeFiles="-f docker-compose.yml"
+composeFiles="-f compose.yml"
 if [[ ${APP_ENV} == "development" ]]; then
-    composeFiles="${composeFiles} -f docker-compose.dev.yml"
+    composeFiles="${composeFiles} -f compose.dev.yml"
 fi
 if [[ ${CONTAINER_MODE} == "local" ]]; then
-    composeFiles="${composeFiles} -f docker-compose.local.yml"
+    composeFiles="${composeFiles} -f compose.local.yml"
 fi
-if [[ -f docker-compose.override.yml ]]; then
+if [[ -f compose.override.yml ]]; then
+    composeFiles="${composeFiles} -f compose.override.yml"
+elif [[ -f docker-compose.override.yml ]]; then
     composeFiles="${composeFiles} -f docker-compose.override.yml"
 fi
 dockerCompose="${dockerCompose} ${composeFiles}"