diff --git a/Dockerfile b/Dockerfile index c8851d6..e883774 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,8 +21,5 @@ RUN /opt/postal/bin/postal bundle /opt/postal/vendor/bundle ## Stick in startup script ADD scripts/start.sh /start.sh -## Create docker folder for status keeping -RUN mkdir /opt/postal/docker - ## Startup CMD ["/start.sh"] diff --git a/docker-compose.yml b/docker-compose.yml index 35d22b8..0a79fd9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ services: build: . image: postal container_name: postal + volumes: + - ./data/postal/docker:/opt/postal/docker links: - mysql - rabbitmq diff --git a/scripts/start.sh b/scripts/start.sh index b7285f9..484beef 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -8,7 +8,7 @@ fi ## Set Hostname sed -i "s/postal\.example\.com/$POSTAL_HOSTNAME/" /opt/postal/config/postal.yml -## Use augeas to set the MySQL/RabbitMQ setup +## Set MySQL/RabbitMQ usernames/passwords ### MySQL Main DB sed -i -e '/main_db:/!b' -e ':a' -e "s/host.*/host: mysql/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml sed -i -e'/main_db:/!b' -e ':a' -e "s/username.*/username: root/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml @@ -27,6 +27,8 @@ sed -i -e '/rabbitmq:/!b' -e ':a' -e "s/vhost.*/vhost: \/$RABBITMQ_DEFAULT_VHOST ### 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 ## Clean Up