Skip to content

Commit

Permalink
fix: fix issues when generating systemd service file for use with Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanemachine committed Oct 6, 2023
1 parent 4bc1d2d commit a3189b2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
11 changes: 5 additions & 6 deletions support/containers/compose.phoenix-postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ services:
phoenix:
depends_on:
- "postgres"
# # use this if you are using a standalone postgres container with this project
# networks:
# - "phoenix-todo-list"
networks:
- "phoenix-todo-list"
postgres:
networks:
- "phoenix-todo-list"
ports:
- "5432"
# use this if you are using a standalone postgres container with this project
# networks:
# phoenix-todo-list:

networks:
phoenix-todo-list:
5 changes: 2 additions & 3 deletions support/containers/networks/compose.phoenix-traefik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
DATABASE_URL: "${DATABASE_URL:?}"
networks:
- "traefik-global-proxy"
- "postgres" # use this if you are running a postgres container outside of this project's compose service
# - "postgres" # uncomment this line if you are running a postgres container outside of this project's compose service
ports:
- "${PORT:?}"
labels:
Expand All @@ -16,5 +16,4 @@ services:
networks:
traefik-global-proxy:
external: true
postgres: # use this if you are running a postgres container outside of this project's compose service
external: true
# postgres: # uncomment this line if you are running a postgres container outside of this project's compose service
14 changes: 8 additions & 6 deletions support/scripts/systemd-container-service-file-generate
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ else
fi

# maybe use podman instead of docker
# use_podman
if [ "$use_podman" = 1 ]; then
# configure service for use with podman
podman_socket_path=$(podman info --format '{{.Host.RemoteSocket.Path}}')
maybe_podman_config=" -H unix:${podman_socket_path}"
else
use_docker=1 # use docker-specific options in the systemd service file
fi

# set $deployment_type based on whether or not the '--remote' flag was passed
Expand Down Expand Up @@ -177,10 +178,11 @@ fi
# generate the service file
echo "[Unit]
Description=$service_name
Wants=network-online.target
After=network-online.target
Requires=podman.service
RequiresMountsFor=/run/user/$(id -u)/containers
${use_docker:+After=docker.service}
${use_podman:+Wants=network-online.target}
${use_podman:+After=network-online.target}
${use_podman:+Requires=podman.service}
${use_podman:+RequiresMountsFor=/run/user/$(id -u)/containers}
[Service]
Restart=always
Expand All @@ -196,7 +198,7 @@ Environment=COMPOSE_HTTP_TIMEOUT=180
## phoenix
Environment=PHX_HOST=\"$PHX_HOST\"
Environment=PORT=\"$PORT\"
Environment=PORT=$PORT
Environment=SECRET_KEY_BASE=\"$SECRET_KEY_BASE\"
## database
Expand Down

0 comments on commit a3189b2

Please sign in to comment.