update postal

This commit is contained in:
ALinuxNinja 2017-04-27 03:50:07 -04:00
parent 72ac87f8e8
commit 3ae659ec2c
3 changed files with 38 additions and 7 deletions

View File

@ -1,8 +1,9 @@
FROM ruby:2.4
## Install augeas
## Install nodejss
RUN apt-get -y update \
&& apt-get -y install augeas-lenses augeas-tools nodejs
&& apt-get -y install nodejs \
&& rm -rf /var/lib/apt/lists/*
## Install required gems
RUN gem install bundler && gem install procodile
@ -20,8 +21,5 @@ RUN /opt/postal/app/bin/postal bundle /opt/postal/app/vendor/bundle
## Stick in startup script
ADD scripts/start.sh /start.sh
## Clean up apt
RUN rm -rf /var/lib/apt/lists/*
## Entrypoint
ENTRYPOINT ["/start.sh"]
## Startup
CMD ["/start.sh"]

View File

@ -4,3 +4,18 @@ services:
build: .
image: postal
container_name: postal
environment:
- POSTAL_HOSTNAME=idontknow.nowhere.com
mysql:
image: mariadb:10
container_name: postal_mysql
environment:
- MYSQL_ROOT_PASSWORD=changeme
- MYSQL_DATABASE=postal
rabbitmq:
image: rabbitmq:3-alpine
container_name: postal_rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=postal
- RABBITMQ_DEFAULT_PASS=changeme
- RABBITMQ_DEFAULT_VHOST=postal

View File

@ -5,6 +5,24 @@ if [[ ! -f /opt/postal/config/signing.key ]]; then
/opt/postal/app/bin/postal initialize-config
fi
## Set Hostname
sed -i "s/postal\.example\.com/$POSTAL_HOSTNAME/" /opt/postal/config/postal.yml
## Use augeas to set the MySQL/RabbitMQ setup
### 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
sed -i -e'/main_db:/!b' -e ':a' -e "s/password.*/password: <%= ENV['MYSQL_ROOT_PASSWORD'] %>/;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/database.*/database: <%= ENV['MYSQL_DATABASE'] %>/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml
### MySQL Message DB
sed -i -e '/message_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'/message_db:/!b' -e ':a' -e "s/username.*/username: root/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml
sed -i -e'/message_db:/!b' -e ':a' -e "s/password.*/password: <%= ENV['MYSQL_ROOT_PASSWORD'] %>/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml
### RabbitMQ
sed -i -e '/rabbitmq:/!b' -e ':a' -e "s/host.*/host: rabbitmq/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml
sed -i -e '/rabbitmq:/!b' -e ':a' -e "s/username.*/username: <%= ENV['RABBITMQ_DEFAULT_USER'] %>/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml
sed -i -e '/rabbitmq:/!b' -e ':a' -e "s/password.*/password: <%= ENV['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: \/<%= ENV['RABBITMQ_DEFAULT_VHOST'] %>/;t trail" -e 'n;ba' -e ':trail' -e 'n;btrail' /opt/postal/config/postal.yml
## Run
/opt/postal/app/bin/postal run