diff --git a/support/containers/README.md b/support/containers/README.md index 1495eaf..67a53fb 100644 --- a/support/containers/README.md +++ b/support/containers/README.md @@ -114,11 +114,11 @@ To run this project's built-in Traefik container service: - Launch the **Postgres + Traefik + Phoenix** container service: - Examples: - In a local environment (HTTP only): - - Docker: `docker compose -f compose.phoenix.yaml -f networks/compose.phoenix-traefik.yaml -f compose.phoenix-config-traefik-local.yaml -f compose.phoenix-postgres.yaml -f compose.postgres.yaml -f networks/compose.postgres-traefik.yaml -f compose.traefik.yaml -f compose.traefik-config-local.yaml up` - - Podman: `docker-compose -H unix:$(podman info --format '{{.Host.RemoteSocket.Path}}') -f compose.phoenix.yaml -f networks/compose.phoenix-traefik.yaml -f compose.phoenix-config-traefik-local.yaml -f compose.phoenix-postgres.yaml -f compose.postgres.yaml -f networks/compose.postgres-traefik.yaml -f compose.traefik.yaml -f compose.traefik-config-local.yaml up` + - Docker: `docker compose -f compose.phoenix.yaml -f networks/compose.phoenix-traefik.yaml -f compose.phoenix-config-traefik-local.yaml -f compose.phoenix-postgres.yaml -f compose.postgres.yaml -f compose.traefik.yaml -f compose.traefik-config-local.yaml up` + - Podman: `docker-compose -H unix:$(podman info --format '{{.Host.RemoteSocket.Path}}') -f compose.phoenix.yaml -f networks/compose.phoenix-traefik.yaml -f compose.phoenix-config-traefik-local.yaml -f compose.phoenix-postgres.yaml -f compose.postgres.yaml -f compose.traefik.yaml -f compose.traefik-config-local.yaml up` - In a remote environment (exposed to Internet, uses HTTPS): - - Docker: `docker compose -f compose.phoenix.yaml -f networks/compose.phoenix-traefik.yaml -f compose.phoenix-config-traefik-remote.yaml -f compose.phoenix-postgres.yaml -f compose.postgres.yaml -f networks/compose.postgres-traefik.yaml -f compose.traefik.yaml -f compose.traefik-config-remote.yaml up` - - Podman: `podman-compose -H unix:$(podman info --format '{{.Host.RemoteSocket.Path}}') -f compose.phoenix.yaml -f networks/compose.phoenix-traefik.yaml -f compose.phoenix-config-traefik-remote.yaml -f compose.phoenix-postgres.yaml -f compose.postgres.yaml -f networks/compose.postgres-traefik.yaml -f compose.traefik.yaml -f compose.traefik-config-remote.yaml up` + - Docker: `docker compose -f compose.phoenix.yaml -f networks/compose.phoenix-traefik.yaml -f compose.phoenix-config-traefik-remote.yaml -f compose.phoenix-postgres.yaml -f compose.postgres.yaml -f compose.traefik.yaml -f compose.traefik-config-remote.yaml up` + - Podman: `podman-compose -H unix:$(podman info --format '{{.Host.RemoteSocket.Path}}') -f compose.phoenix.yaml -f networks/compose.phoenix-traefik.yaml -f compose.phoenix-config-traefik-remote.yaml -f compose.phoenix-postgres.yaml -f compose.postgres.yaml -f compose.traefik.yaml -f compose.traefik-config-remote.yaml up` - To avoid running these long commands, use the easy-use scripts in `support/containers/scripts`. - To access the Traefik dashboard: - Using a web browser, navigate to the location of your `$TRAEFIK_DASHBOARD_FQDN`. diff --git a/support/containers/compose.phoenix-postgres.yaml b/support/containers/compose.phoenix-postgres.yaml index 1b9bacc..0ec53de 100644 --- a/support/containers/compose.phoenix-postgres.yaml +++ b/support/containers/compose.phoenix-postgres.yaml @@ -3,3 +3,13 @@ services: phoenix: depends_on: - "postgres" + networks: + - "phoenix-todo-list" + postgres: + networks: + - "phoenix-todo-list" + ports: + - "5432" + +networks: + phoenix-todo-list: diff --git a/support/containers/networks/compose.postgres-traefik.yaml b/support/containers/networks/compose.postgres-traefik.yaml deleted file mode 100644 index d55470b..0000000 --- a/support/containers/networks/compose.postgres-traefik.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -services: - phoenix: - networks: - - "phoenix-todo-list" - postgres: - networks: - - "phoenix-todo-list" - ports: - - "5432" - -networks: - traefik-global-proxy: - external: true - phoenix-todo-list: diff --git a/support/scripts/containers/compose--phoenix-postgres-traefik b/support/scripts/containers/compose--phoenix-postgres-traefik index 4020851..fc00c4e 100755 --- a/support/scripts/containers/compose--phoenix-postgres-traefik +++ b/support/scripts/containers/compose--phoenix-postgres-traefik @@ -54,7 +54,7 @@ if [ "$action" = "up" ]; then # ensure the network 'traefik-global-proxy' exists echo "Creating Docker network: 'traefik-global-proxy'..." if [ ! "$(docker network create traefik-global-proxy)" ]; then - echo "\033[96mThe 'traefik-global-proxy' network already exists.\033[39m" + printf "\033[96mThe 'traefik-global-proxy' network already exists.\033[39m\n" fi fi @@ -74,4 +74,4 @@ fi # run container action # shellcheck disable=SC2068,SC2086 -$application_to_run -f compose.phoenix.yaml -f networks/compose.phoenix-traefik.yaml -f compose.phoenix-config-traefik-$local_or_remote.yaml -f compose.postgres.yaml -f networks/compose.postgres-traefik.yaml -f compose.traefik.yaml -f compose.traefik-config-$local_or_remote.yaml $action $@ +$application_to_run -f compose.phoenix.yaml -f networks/compose.phoenix-traefik.yaml -f compose.phoenix-config-traefik-$local_or_remote.yaml -f compose.postgres.yaml -f compose.traefik.yaml -f compose.traefik-config-$local_or_remote.yaml $action $@ diff --git a/support/scripts/systemd-container-service-file-generate b/support/scripts/systemd-container-service-file-generate index 9bfd5f6..f183619 100755 --- a/support/scripts/systemd-container-service-file-generate +++ b/support/scripts/systemd-container-service-file-generate @@ -141,10 +141,8 @@ fi if [ "$use_postgres" = 1 ]; then containers_to_run="$containers_to_run -f compose.phoenix-postgres.yaml -f compose.postgres.yaml" - # postgres + traefik - if [ "$use_traefik_client" = 1 ] || [ "$use_traefik_host" = 1 ]; then - containers_to_run="$containers_to_run -f networks/compose.postgres-traefik.yaml" - else + # enable postgres host networking + if [ "$use_traefik_client" != 1 ] && [ "$use_traefik_host" != 1 ]; then containers_to_run="$containers_to_run -f networks/compose.postgres-host.yaml" fi fi