test to see if this fixes the issue

This commit is contained in:
ILoveYaToo 2020-05-20 00:14:49 -04:00
parent 2dbca14548
commit 5df19e5051
9 changed files with 45 additions and 22 deletions

View File

@ -5,7 +5,7 @@ ENV DOCKERIZE_VERSION v0.6.1
RUN wget https://github.com/wrouesnel/p2cli/releases/download/r5/p2 -O /usr/local/bin/p2 \ RUN wget https://github.com/wrouesnel/p2cli/releases/download/r5/p2 -O /usr/local/bin/p2 \
&& chmod +x /usr/local/bin/p2 && chmod +x /usr/local/bin/p2
RUN apk --no-cache add nodejs mariadb-client git bash libcap build-base mariadb-dev tzdata mariadb-connector-c openssl \ RUN apk --no-cache add nodejs mariadb-client git bash libcap build-base mariadb-dev tzdata mariadb-connector-c openssl expect\
&& git clone https://github.com/atech/postal.git /opt/postal \ && git clone https://github.com/atech/postal.git /opt/postal \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& gem install bundler \ && gem install bundler \
@ -28,6 +28,7 @@ RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/ruby
## Stick in required files ## Stick in required files
ADD src/docker-entrypoint.sh /docker-entrypoint.sh ADD src/docker-entrypoint.sh /docker-entrypoint.sh
ADD src/create-user.sh /create-user.sh
ADD src/templates /templates ADD src/templates /templates
## Expose ## Expose

View File

View File

@ -1,7 +1,8 @@
version: "3" version: "3"
services: services:
postal: postal:
image: catdeployed/postal:alpine #image: catdeployed/postal:alpine
build: .
container_name: postal container_name: postal
command: run command: run
ports: ports:
@ -10,7 +11,7 @@ services:
- "mysql" - "mysql"
- "rabbitmq" - "rabbitmq"
volumes: volumes:
- ./config/postal.yml:/opt/postal/config/postal.yml - persistent_assets:/storage
- static_assets:/opt/postal/public - static_assets:/opt/postal/public
- postal_assets:/opt/postal/public/assets - postal_assets:/opt/postal/public/assets
- ./src/templates/:/templates - ./src/templates/:/templates
@ -61,3 +62,4 @@ volumes:
static_assets: static_assets:
postal_assets: postal_assets:
mysql_data: mysql_data:
persistent_assets:

11
alpine/src/create-user.sh Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/expect
eval spawn /opt/postal/bin/postal make-user
expect "E-Mail"
send "$env(POSTAL_EMAIL)\n"
expect "First Name"
send "$env(POSTAL_FNAME)\n"
expect "Last Name"
send "$env(POSTAL_LNAME)\n"
expect "Password"
send "$env(POSTAL_PASSWORD)\n"
interact

View File

@ -4,6 +4,11 @@
rm -rf /opt/postal/tmp/pids/* rm -rf /opt/postal/tmp/pids/*
rm -rf /tmp/postal rm -rf /tmp/postal
## Check if existing config
if [ -f /storage/postal.yml ]; then
cp /storage/postal.yml /opt/postal/config/postal.yml
fi
## Generate config ## Generate config
if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.yml | wc -l) < 2 ]]; then if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.yml | wc -l) < 2 ]]; then
## Build Jinja2 Template ## Build Jinja2 Template
@ -15,18 +20,15 @@ if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.
/opt/postal/bin/postal initialize-config /opt/postal/bin/postal initialize-config
## Wait for MySQL and RabbitMQ to start up ## Wait for MySQL and RabbitMQ to start up
echo "== Waiting for MySQL and RabbitMQ to start up ==" echo "== Waiting for MySQL and RabbitMQ to start up =="
dockerize -wait tcp://mysql:3306 -wait http://rabbitmq:5672/api/aliveness-test dockerize -timeout 60m -wait tcp://mysql:3306 -wait tcp://rabbitmq:5672
/opt/postal/bin/postal initialize /opt/postal/bin/postal initialize
/opt/postal/bin/postal make-user <<-EOF /create-user.sh
$POSTAL_EMAIL ## Copy over config to persistent storage
$POSTAL_FNAME cp /opt/postal/config/postal.yml /storage/postal.yml
$POSTAL_LNAME
$POSTAL_PASSWORD
EOF
else else
## Wait for MySQL and RabbitMQ to start up ## Wait for MySQL and RabbitMQ to start up
echo "== Waiting for MySQL and RabbitMQ to start up ==" echo "== Waiting for MySQL and RabbitMQ to start up =="
dockerize -wait tcp://mysql:3306 -wait http://rabbitmq:5672/api/aliveness-test dockerize -timeout 60m -wait tcp://mysql:3306 -wait tcp://rabbitmq:5672
fi fi
## Start Postal ## Start Postal
/opt/postal/bin/postal "$@" /opt/postal/bin/postal "$@"

View File

@ -9,7 +9,7 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt-get install -y nodejs && apt-get install -y nodejs
RUN apt-get -y update \ RUN apt-get -y update \
&& apt-get -y install --no-install-recommends nodejs mariadb-client git-core libcap2-bin wget \ && apt-get -y install --no-install-recommends nodejs mariadb-client git-core libcap2-bin wget expect\
&& git clone https://github.com/atech/postal.git /opt/postal \ && git clone https://github.com/atech/postal.git /opt/postal \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& gem install bundler \ && gem install bundler \
@ -32,6 +32,7 @@ RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/ruby
## Stick in required files ## Stick in required files
ADD src/docker-entrypoint.sh /docker-entrypoint.sh ADD src/docker-entrypoint.sh /docker-entrypoint.sh
ADD src/create-user.sh /create-user.sh
ADD src/templates /templates ADD src/templates /templates
## Expose ## Expose

View File

View File

@ -1,16 +1,19 @@
version: "3" version: "3"
services: services:
postal: postal:
image: catdeployed/postal:ubuntu #image: catdeployed/postal:ubuntu
build: .
container_name: postal container_name: postal
command: run command: run
tty: true
ports: ports:
- 127.0.0.1:25:25 - 127.0.0.1:25:25
depends_on: depends_on:
- "mysql" - "mysql"
- "rabbitmq" - "rabbitmq"
volumes: volumes:
- ./config/postal.yml:/opt/postal/config/postal.yml # - ./config/postal.yml:/opt/postal/config/postal.yml
- persistent_assets:/storage
- static_assets:/opt/postal/public - static_assets:/opt/postal/public
- postal_assets:/opt/postal/public/assets - postal_assets:/opt/postal/public/assets
- ./src/templates/:/templates - ./src/templates/:/templates
@ -58,6 +61,7 @@ services:
- static_assets:/opt/postal/public:ro - static_assets:/opt/postal/public:ro
- postal_assets:/opt/postal/public/assets:ro - postal_assets:/opt/postal/public/assets:ro
volumes: volumes:
persistent_assets:
static_assets: static_assets:
postal_assets: postal_assets:
mysql_data: mysql_data:

View File

@ -4,6 +4,11 @@
rm -rf /opt/postal/tmp/pids/* rm -rf /opt/postal/tmp/pids/*
rm -rf /tmp/postal rm -rf /tmp/postal
## Check if existing config
if [ -f /storage/postal.yml ]; then
cp /storage/postal.yml /opt/postal/config/postal.yml
fi
## Generate config ## Generate config
if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.yml | wc -l) < 2 ]]; then if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.yml | wc -l) < 2 ]]; then
## Build Jinja2 Template ## Build Jinja2 Template
@ -15,18 +20,15 @@ if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.
/opt/postal/bin/postal initialize-config /opt/postal/bin/postal initialize-config
## Wait for MySQL and RabbitMQ to start up ## Wait for MySQL and RabbitMQ to start up
echo "== Waiting for MySQL and RabbitMQ to start up ==" echo "== Waiting for MySQL and RabbitMQ to start up =="
dockerize -wait tcp://mysql:3306 -wait http://rabbitmq:5672/api/aliveness-test dockerize -timeout 60m -wait tcp://mysql:3306 -wait tcp://rabbitmq:5672
/opt/postal/bin/postal initialize /opt/postal/bin/postal initialize
/opt/postal/bin/postal make-user <<-EOF /create-user.sh
$POSTAL_EMAIL ## Copy over config to persistent storage
$POSTAL_FNAME cp /opt/postal/config/postal.yml /storage/postal.yml
$POSTAL_LNAME
$POSTAL_PASSWORD
EOF
else else
## Wait for MySQL and RabbitMQ to start up ## Wait for MySQL and RabbitMQ to start up
echo "== Waiting for MySQL and RabbitMQ to start up ==" echo "== Waiting for MySQL and RabbitMQ to start up =="
dockerize -wait tcp://mysql:3306 -wait http://rabbitmq:5672/api/aliveness-test dockerize -timeout 60m -wait tcp://mysql:3306 -wait tcp://rabbitmq:5672
fi fi
## Start Postal ## Start Postal
/opt/postal/bin/postal "$@" /opt/postal/bin/postal "$@"