Loading .dockerignore +0 −1 Original line number Diff line number Diff line Dockerfile .dockerignore examples/ .gitignore README.md travelynx.conf Dockerfile +5 −18 Original line number Diff line number Diff line Loading @@ -2,28 +2,16 @@ FROM debian:stretch-slim ARG DEBIAN_FRONTEND=noninteractive COPY cpanfile /app/cpanfile WORKDIR /app RUN apt-get update && apt-get install --no-install-recommends -y \ cpanminus \ build-essential \ libpq-dev \ git \ ssmtp \ && cpanm -in --no-man-pages \ Cache::File \ Crypt::Eksblowfish \ DateTime \ DateTime::Format::Strptime \ DBI \ DBD::Pg \ Email::Sender \ Geo::Distance \ Geo::Distance::XS \ Mojolicious \ Mojolicious::Plugin::Authentication \ Travel::Status::DE::IRIS \ UUID::Tiny \ JSON \ Mojo::Pg \ cron \ && cpanm -in --no-man-pages --installdeps . \ && rm -rf ~/.cpanm \ && apt-get purge -y \ build-essential \ Loading @@ -31,6 +19,5 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ && apt-get autoremove -y COPY . /app WORKDIR /app CMD ["/app/docker-run.sh"] docker-compose.yml +19 −8 Original line number Diff line number Diff line Loading @@ -4,6 +4,17 @@ x-common-env: &common-env TRAVELYNX_DB_NAME: travelynx TRAVELYNX_DB_USERNAME: travelynx TRAVELYNX_DB_PASSWORD: travelynx TRAVELYNX_SECRET: 12345678 TRAVELYNX_MAIL_DISABLE: 1 MOJO_MODE: development x-common-config: &common-config volumes: - ./examples/docker/travelynx.conf:/app/travelynx.conf build: . networks: - backend services: database: image: postgres:11 Loading @@ -14,16 +25,16 @@ services: volumes: - ./examples/docker/postgres-init.sh:/docker-entrypoint-initdb.d/init.sh travelynx: build: . <<: *common-config ports: - "8000:8093" networks: - backend volumes: - ./examples/docker/travelynx.conf:/app/travelynx.conf environment: <<: *common-env TRAVELYNX_MAIL_DISABLE: 1 TRAVELYNX_SECRET: 12345678 cron: <<: *common-config environment: <<: *common-env CRON: 1 networks: backend: No newline at end of file docker-run.sh +34 −16 Original line number Diff line number Diff line Loading @@ -4,6 +4,14 @@ set -eu WAIT_DB_HOST=${TRAVELYNX_DB_HOST} WAIT_DB_PORT=5432 check_config() { if [ ! -f travelynx.conf ] then echo "The configuration file is missing" exit 1 fi } wait_for_db() { set +e for i in $(seq 1 ${WAIT_DB_TIMEOUT:-5}) Loading @@ -11,18 +19,15 @@ wait_for_db() { (echo >/dev/tcp/${WAIT_DB_HOST}/${WAIT_DB_PORT}) &>/dev/null if [ $? -eq 0 ]; then break else echo "Can't reach DB @ ${WAIT_DB_HOST}:${WAIT_DB_PORT}" fi sleep 1 done set -e } if [ ! -f travelynx.conf ] then echo "The configuration file is missing" exit 1 fi run_app() { if [ \ "${TRAVELYNX_MAIL_DISABLE:-0}" -eq 0 \ -a "${TRAVELYNX_MAIL_HOST:-unset}" != "unset" \ Loading @@ -33,8 +38,21 @@ then export EMAIL_SENDER_TRANSPORT_PORT=${TRAVELYNX_MAIL_PORT:-25} fi wait_for_db perl index.pl database migrate exec /usr/local/bin/hypnotoad -f index.pl } run_cron() { exec perl index.pl worker } check_config wait_for_db if [ "${CRON:-0}" -ne "0" ] then run_cron fi run_app No newline at end of file Loading
.dockerignore +0 −1 Original line number Diff line number Diff line Dockerfile .dockerignore examples/ .gitignore README.md travelynx.conf
Dockerfile +5 −18 Original line number Diff line number Diff line Loading @@ -2,28 +2,16 @@ FROM debian:stretch-slim ARG DEBIAN_FRONTEND=noninteractive COPY cpanfile /app/cpanfile WORKDIR /app RUN apt-get update && apt-get install --no-install-recommends -y \ cpanminus \ build-essential \ libpq-dev \ git \ ssmtp \ && cpanm -in --no-man-pages \ Cache::File \ Crypt::Eksblowfish \ DateTime \ DateTime::Format::Strptime \ DBI \ DBD::Pg \ Email::Sender \ Geo::Distance \ Geo::Distance::XS \ Mojolicious \ Mojolicious::Plugin::Authentication \ Travel::Status::DE::IRIS \ UUID::Tiny \ JSON \ Mojo::Pg \ cron \ && cpanm -in --no-man-pages --installdeps . \ && rm -rf ~/.cpanm \ && apt-get purge -y \ build-essential \ Loading @@ -31,6 +19,5 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ && apt-get autoremove -y COPY . /app WORKDIR /app CMD ["/app/docker-run.sh"]
docker-compose.yml +19 −8 Original line number Diff line number Diff line Loading @@ -4,6 +4,17 @@ x-common-env: &common-env TRAVELYNX_DB_NAME: travelynx TRAVELYNX_DB_USERNAME: travelynx TRAVELYNX_DB_PASSWORD: travelynx TRAVELYNX_SECRET: 12345678 TRAVELYNX_MAIL_DISABLE: 1 MOJO_MODE: development x-common-config: &common-config volumes: - ./examples/docker/travelynx.conf:/app/travelynx.conf build: . networks: - backend services: database: image: postgres:11 Loading @@ -14,16 +25,16 @@ services: volumes: - ./examples/docker/postgres-init.sh:/docker-entrypoint-initdb.d/init.sh travelynx: build: . <<: *common-config ports: - "8000:8093" networks: - backend volumes: - ./examples/docker/travelynx.conf:/app/travelynx.conf environment: <<: *common-env TRAVELYNX_MAIL_DISABLE: 1 TRAVELYNX_SECRET: 12345678 cron: <<: *common-config environment: <<: *common-env CRON: 1 networks: backend: No newline at end of file
docker-run.sh +34 −16 Original line number Diff line number Diff line Loading @@ -4,6 +4,14 @@ set -eu WAIT_DB_HOST=${TRAVELYNX_DB_HOST} WAIT_DB_PORT=5432 check_config() { if [ ! -f travelynx.conf ] then echo "The configuration file is missing" exit 1 fi } wait_for_db() { set +e for i in $(seq 1 ${WAIT_DB_TIMEOUT:-5}) Loading @@ -11,18 +19,15 @@ wait_for_db() { (echo >/dev/tcp/${WAIT_DB_HOST}/${WAIT_DB_PORT}) &>/dev/null if [ $? -eq 0 ]; then break else echo "Can't reach DB @ ${WAIT_DB_HOST}:${WAIT_DB_PORT}" fi sleep 1 done set -e } if [ ! -f travelynx.conf ] then echo "The configuration file is missing" exit 1 fi run_app() { if [ \ "${TRAVELYNX_MAIL_DISABLE:-0}" -eq 0 \ -a "${TRAVELYNX_MAIL_HOST:-unset}" != "unset" \ Loading @@ -33,8 +38,21 @@ then export EMAIL_SENDER_TRANSPORT_PORT=${TRAVELYNX_MAIL_PORT:-25} fi wait_for_db perl index.pl database migrate exec /usr/local/bin/hypnotoad -f index.pl } run_cron() { exec perl index.pl worker } check_config wait_for_db if [ "${CRON:-0}" -ne "0" ] then run_cron fi run_app No newline at end of file