diff --git a/.gitignore b/.gitignore index 2c04dbe..40645b5 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ npm-debug.log # Ignore all user-generated content (uploads, QR codes, etc.) /priv/static/user_generated/ +# Ignore customized Docker Compose file. +docker-compose.yml + diff --git a/README.md b/README.md index 7bef1f2..dfc415b 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,10 @@ mix ecto.migrations cd components_elixir ``` -2. **Build and run with Docker Compose:** +2. **Copy docker-compose.yml.example to docker-compose.yml** + Follow steps in [Customizing Docker Deployment](#customizing-docker-deployment). + +3. **Build and run with Docker Compose:** ```bash docker compose up --build ``` @@ -241,7 +244,7 @@ mix ecto.migrations - Elixir compiles all dependencies - Network conditions may significantly affect download speeds -3. **Access the application:** +4. **Access the application:** - Open [http://localhost:4000](http://localhost:4000) - Default password: `changeme` diff --git a/docker-compose.yml b/docker-compose.yml.example similarity index 70% rename from docker-compose.yml rename to docker-compose.yml.example index 2786e11..e88888e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml.example @@ -21,14 +21,19 @@ services: - "4000:4000" environment: DATABASE_URL: "ecto://postgres:postgres@db:5432/components_elixir_prod" - SECRET_KEY_BASE: "WYxST6ZVqFdeXRfjP3MUAc+hNVCJ6LW/+aqwuP27Ab77R4yXFQlO2HsukrOzCVif" + SECRET_KEY_BASE: "your-secret-key-here" # Generate with: mix phx.gen.secret PHX_HOST: "localhost" PHX_SERVER: "true" PORT: "4000" depends_on: db: condition: service_healthy - command: ["/bin/sh", "-c", "/app/bin/migrate && /app/bin/server"] + command: + [ + "/bin/sh", + "-c", + "/app/bin/components_elixir eval 'ComponentsElixir.Release.migrate' && /app/bin/components_elixir start", + ] volumes: - postgres_data: \ No newline at end of file + postgres_data: diff --git a/rel/env.bat.eex b/rel/env.bat.eex new file mode 100644 index 0000000..0d82afd --- /dev/null +++ b/rel/env.bat.eex @@ -0,0 +1,8 @@ +@echo off +rem Set the release to load code on demand (interactive) instead of preloading (embedded). +rem set RELEASE_MODE=interactive + +rem Set the release to work across nodes. +rem RELEASE_DISTRIBUTION must be "sname" (local), "name" (distributed) or "none". +rem set RELEASE_DISTRIBUTION=name +rem set RELEASE_NODE=<%= @release.name %> diff --git a/rel/env.sh.eex b/rel/env.sh.eex new file mode 100644 index 0000000..ab7b76a --- /dev/null +++ b/rel/env.sh.eex @@ -0,0 +1,20 @@ +#!/bin/sh + +# # Sets and enables heart (recommended only in daemon mode) +# case $RELEASE_COMMAND in +# daemon*) +# HEART_COMMAND="$RELEASE_ROOT/bin/$RELEASE_NAME $RELEASE_COMMAND" +# export HEART_COMMAND +# export ELIXIR_ERL_OPTIONS="-heart" +# ;; +# *) +# ;; +# esac + +# # Set the release to load code on demand (interactive) instead of preloading (embedded). +# export RELEASE_MODE=interactive + +# # Set the release to work across nodes. +# # RELEASE_DISTRIBUTION must be "sname" (local), "name" (distributed) or "none". +# export RELEASE_DISTRIBUTION=name +# export RELEASE_NODE=<%= @release.name %> diff --git a/rel/remote.vm.args.eex b/rel/remote.vm.args.eex new file mode 100644 index 0000000..983397a --- /dev/null +++ b/rel/remote.vm.args.eex @@ -0,0 +1,8 @@ +## Customize flags given to the VM: https://www.erlang.org/doc/man/erl.html +## -mode/-name/-sname/-setcookie are configured via env vars, do not set them here + +## Increase number of concurrent ports/sockets +##+Q 65536 + +## Tweak GC to run more often +##-env ERL_FULLSWEEP_AFTER 10 diff --git a/rel/vm.args.eex b/rel/vm.args.eex new file mode 100644 index 0000000..983397a --- /dev/null +++ b/rel/vm.args.eex @@ -0,0 +1,8 @@ +## Customize flags given to the VM: https://www.erlang.org/doc/man/erl.html +## -mode/-name/-sname/-setcookie are configured via env vars, do not set them here + +## Increase number of concurrent ports/sockets +##+Q 65536 + +## Tweak GC to run more often +##-env ERL_FULLSWEEP_AFTER 10