diff --git a/Dockerfile b/Dockerfile index 5195622..61c125f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM ruby:2.4 ## Install nodejss RUN apt-get -y update \ -&& apt-get -y install nodejs \ +&& apt-get -y install nodejs mysql-client\ && rm -rf /var/lib/apt/lists/* ## Install required gems diff --git a/README.md b/README.md index 544ba2e..478206e 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,7 @@ Change configuration in docker-compose.yml to update passwords for MySQL/RabbitM ``` docker-compose up -d ``` +### Configuration +Configuration is located at data/postal/config after the first start. Still WIP diff --git a/docker-compose.yml b/docker-compose.yml index 2d58305..24679e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,8 +5,7 @@ services: image: postal container_name: postal volumes: - - ./data/postal/config:/opt/postal/config - - ./data/postal/docker:/opt/postal/docker + - ./data/postal:/opt/postal/config environment: - POSTAL_HOSTNAME=idontknow.nowhere.com - MYSQL_ROOT_PASSWORD=changeme diff --git a/scripts/start.sh b/scripts/start.sh index 44077b7..7794b21 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -25,12 +25,13 @@ sed -i -e '/rabbitmq:/!b' -e ':a' -e "s/username.*/username: $RABBITMQ_DEFAULT_U sed -i -e '/rabbitmq:/!b' -e ':a' -e "s/password.*/password: $RABBITMQ_DEFAULT_PASS/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml sed -i -e '/rabbitmq:/!b' -e ':a' -e "s/vhost.*/vhost: \/$RABBITMQ_DEFAULT_VHOST/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml -### Initialize DB -if [[ ! -f /opt/postal/docker/postal_initialized ]]; then - /opt/postal/bin/postal initialize && touch /opt/postal/docker/postal_initialized -else - /opt/postal/bin/postal upgrade -fi +## Initialize DB +echo "== Waiting for MySQL to start up ==" +while ! mysqladmin ping -h mysql --silent; do + sleep 1 +done +/opt/postal/bin/postal upgrade + ## Run /opt/postal/bin/postal run