add dummy promotions

This commit is contained in:
ILoveYaToo 2021-03-18 01:01:57 -04:00
parent 5a4e9a3008
commit 0bc1923d49
6 changed files with 127 additions and 34 deletions

View File

@ -25,7 +25,11 @@ blocks:
- docker-compose up -d - docker-compose up -d
- for i in {1..20}; do if [[ $(docker inspect postal | jq -r '.[].State.Health.Status') == "healthy" ]]; then break; elif [[ $i -eq 20 ]]; then exit 1; else sleep 15; fi; done; - for i in {1..20}; do if [[ $(docker inspect postal | jq -r '.[].State.Health.Status') == "healthy" ]]; then break; elif [[ $i -eq 20 ]]; then exit 1; else sleep 15; fi; done;
promotions: promotions:
- name: Default Promotion - name: Upload to Production
pipeline_file: upload.yml pipeline_file: upload-production.yml
auto_promote: auto_promote:
when: result = 'passed' when: result = 'passed' and branch = 'master'
- name: Dummy Upload
pipeline_file: upload-dummy.yml
auto_promote:
when: result = 'passed' and branch != 'master'

View File

@ -0,0 +1,20 @@
version: v1.0
name: Docker Image Upload
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
global_job_config:
secrets:
- name: DOCKER_GITHUB
- name: DOCKER_HUB
blocks:
- name: Upload
task:
jobs:
- name: 'Alpine Upload'
commands:
- artifact yank workflow postal-alpine-container.tar
- name: 'Ubuntu Upload'
commands:
- artifact yank workflow postal-ubuntu-container.tar

View File

@ -46,6 +46,9 @@ Port mappings may change (as they have in the past). If SMTP/HTTP(s) is not work
The initial design for the container was to be simple, minimal, and customizable, so Spamassassin and ClamAV are not included by default. Feel free to fork and add to the Dockerfile (though you must set docker-compose.yml to build from Dockerfile and not pull an image), or add them by linking additional containers. The initial design for the container was to be simple, minimal, and customizable, so Spamassassin and ClamAV are not included by default. Feel free to fork and add to the Dockerfile (though you must set docker-compose.yml to build from Dockerfile and not pull an image), or add them by linking additional containers.
### Updates ### Updates
- v3.1.0
* Fixed username/password injection problem during user creation by adding sleep inbetween entries
* Missed mount
- v3.0.0 - v3.0.0
* Move to Gitlab with automated testing * Move to Gitlab with automated testing
* Add user creation system for more reliability * Add user creation system for more reliability

View File

@ -4,13 +4,16 @@
rm -rf /opt/postal/tmp/pids/* rm -rf /opt/postal/tmp/pids/*
rm -rf /tmp/postal rm -rf /tmp/postal
## Check if existing config ## Wait for MySQL and RabbitMQ to start up
if [ $(ls /storage | wc -l) > 0 ]; then echo "== Waiting for MySQL and RabbitMQ to start up =="
cp /storage/* /opt/postal/config/* dockerize -timeout 60m -wait tcp://mysql:3306 -wait tcp://rabbitmq:5672
fi
## Generate config echo "== Building Config =="
if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.yml | wc -l) < 2 ]]; then echo "postal.yml"
if [ -f /storage/postal.yml ]; then
rm -f /opt/postal/config/postal.yml
ln -s /storage/postal.yml /opt/postal/config/postal.yml
elif [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.yml | wc -l) < 2 ]]; then
## Build Jinja2 Template ## Build Jinja2 Template
p2 -t /templates/postal.example.yml.j2 -o /opt/postal/config/postal.example.yml p2 -t /templates/postal.example.yml.j2 -o /opt/postal/config/postal.example.yml
## Add in secret key building ## Add in secret key building
@ -18,21 +21,49 @@ if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.
echo " secret_key: {{secretkey}}" >> /opt/postal/config/postal.example.yml echo " secret_key: {{secretkey}}" >> /opt/postal/config/postal.example.yml
## Generate config and keys ## Generate config and keys
/opt/postal/bin/postal initialize-config /opt/postal/bin/postal initialize-config
## Wait for MySQL and RabbitMQ to start up
echo "== Waiting for MySQL and RabbitMQ to start up =="
dockerize -timeout 60m -wait tcp://mysql:3306 -wait tcp://rabbitmq:5672
/opt/postal/bin/postal initialize /opt/postal/bin/postal initialize
/create-user.sh /create-user.sh
## Copy over config to persistent storage ## Copy over config to persistent storage
cp /opt/postal/config/postal.yml /storage/postal.yml cp -p /opt/postal/config/postal.yml /storage/postal.yml
cp /opt/postal/config/fast_server.cert /storage/fast_server.cert rm /opt/postal/config/postal.yml
cp /opt/postal/config/fast_server.key /storage/fast_server.key ln -s /storage/postal.yml /opt/postal/config/postal.yml
cp /opt/postal/config/lets_encrypt.pem /storage/lets_encrypt.pem
cp /opt/postal/config/signing.key /storage/signing.key
else
## Wait for MySQL and RabbitMQ to start up
echo "== Waiting for MySQL and RabbitMQ to start up =="
dockerize -timeout 60m -wait tcp://mysql:3306 -wait tcp://rabbitmq:5672
fi fi
echo "fast_server.cert"
if [ -f /storage/fast_server.cert ]; then
rm -f /opt/postal/config/fast_server.cert
ln -s /storage/fast_server.cert /opt/postal/config/fast_server.cert
elif [ -f /opt/postal/config/fast_server.cert ] && [ ! -L /opt/postal/config/fast_server.cert ]; then
cp -p /opt/postal/config/fast_server.cert /storage/fast_server.cert
rm /opt/postal/config/fast_server.cert
ln -s /storage/fast_server.cert /opt/postal/config/fast_server.cert
fi
echo "fast_server.key"
if [ -f /storage/fast_server.key ]; then
rm -f /opt/postal/config/fast_server.key
ln -s /storage/fast_server.key /opt/postal/config/fast_server.key
elif [ -f /opt/postal/config/fast_server.key ] && [ ! -L /opt/postal/config/fast_server.key ]; then
cp -p /opt/postal/config/fast_server.key /storage/fast_server.key
rm /opt/postal/config/fast_server.key
ln -s /storage/fast_server.key /opt/postal/config/fast_server.key
fi
echo "lets_encrypt.pem"
if [ -f /storage/lets_encrypt.pem ]; then
rm -f /opt/postal/config/lets_encrypt.pem
ln -s /storage/lets_encrypt.pem /opt/postal/config/lets_encrypt.pem
elif [ -f /opt/postal/config/lets_encrypt.pem ] && [ ! -L /opt/postal/config/lets_encrypt.pem ]; then
cp -p /opt/postal/config/lets_encrypt.pem /storage/lets_encrypt.pem
rm /opt/postal/config/lets_encrypt.pem
ln -s /storage/lets_encrypt.pem /opt/postal/config/lets_encrypt.pem
fi
echo "signing.key"
if [ -f /storage/signing.key ]; then
rm -f /opt/postal/config/signing.key
ln -s /storage/signing.key /opt/postal/config/signing.key
elif [ -f /opt/postal/config/signing.key ] && [ ! -L /opt/postal/config/signing.key ]; then
cp -p /opt/postal/config/signing.key /storage/signing.key
rm /opt/postal/config/signing.key
ln -s /storage/signing.key /opt/postal/config/signing.key
fi
## Start Postal ## Start Postal
/opt/postal/bin/postal "$@" /opt/postal/bin/postal "$@"

View File

@ -4,13 +4,17 @@
rm -rf /opt/postal/tmp/pids/* rm -rf /opt/postal/tmp/pids/*
rm -rf /tmp/postal rm -rf /tmp/postal
## Check if existing config ## Wait for MySQL and RabbitMQ to start up
if [ $(ls /storage | wc -l) > 0 ]; then echo "== Waiting for MySQL and RabbitMQ to start up =="
cp /storage/* /opt/postal/config/* dockerize -timeout 60m -wait tcp://mysql:3306 -wait tcp://rabbitmq:5672
fi
## Generate config ## Generate config
if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.yml | wc -l) < 2 ]]; then echo "== Building Config =="
echo "postal.yml"
if [ -f /storage/postal.yml ]; then
rm -f /opt/postal/config/postal.yml
ln -s /storage/postal.yml /opt/postal/config/postal.yml
elif [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.yml | wc -l) < 2 ]]; then
## Build Jinja2 Template ## Build Jinja2 Template
p2 -t /templates/postal.example.yml.j2 -o /opt/postal/config/postal.example.yml p2 -t /templates/postal.example.yml.j2 -o /opt/postal/config/postal.example.yml
## Add in secret key building ## Add in secret key building
@ -25,14 +29,45 @@ if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.
/create-user.sh /create-user.sh
## Copy over config to persistent storage ## Copy over config to persistent storage
cp /opt/postal/config/postal.yml /storage/postal.yml cp /opt/postal/config/postal.yml /storage/postal.yml
cp /opt/postal/config/fast_server.cert /storage/fast_server.cert rm /opt/postal/config/postal.yml
cp /opt/postal/config/fast_server.key /storage/fast_server.key ln -s /storage/postal.yml /opt/postal/config/postal.yml
cp /opt/postal/config/lets_encrypt.pem /storage/lets_encrypt.pem
cp /opt/postal/config/signing.key /storage/signing.key
else
## Wait for MySQL and RabbitMQ to start up
echo "== Waiting for MySQL and RabbitMQ to start up =="
dockerize -timeout 60m -wait tcp://mysql:3306 -wait tcp://rabbitmq:5672
fi fi
echo "fast_server.cert"
if [ -f /storage/fast_server.cert ]; then
rm -f /opt/postal/config/fast_server.cert
ln -s /storage/fast_server.cert /opt/postal/config/fast_server.cert
elif [ -f /opt/postal/config/fast_server.cert ] && [ ! -L /opt/postal/config/fast_server.cert ]; then
cp -p /opt/postal/config/fast_server.cert /storage/fast_server.cert
rm /opt/postal/config/fast_server.cert
ln -s /storage/fast_server.cert /opt/postal/config/fast_server.cert
fi
echo "fast_server.key"
if [ -f /storage/fast_server.key ]; then
rm -f /opt/postal/config/fast_server.key
ln -s /storage/fast_server.key /opt/postal/config/fast_server.key
elif [ -f /opt/postal/config/fast_server.key ] && [ ! -L /opt/postal/config/fast_server.key ]; then
cp -p /opt/postal/config/fast_server.key /storage/fast_server.key
rm /opt/postal/config/fast_server.key
ln -s /storage/fast_server.key /opt/postal/config/fast_server.key
fi
echo "lets_encrypt.pem"
if [ -f /storage/lets_encrypt.pem ]; then
rm -f /opt/postal/config/lets_encrypt.pem
ln -s /storage/lets_encrypt.pem /opt/postal/config/lets_encrypt.pem
elif [ -f /opt/postal/config/lets_encrypt.pem ] && [ ! -L /opt/postal/config/lets_encrypt.pem ]; then
cp -p /opt/postal/config/lets_encrypt.pem /storage/lets_encrypt.pem
rm /opt/postal/config/lets_encrypt.pem
ln -s /storage/lets_encrypt.pem /opt/postal/config/lets_encrypt.pem
fi
echo "signing.key"
if [ -f /storage/signing.key ]; then
rm -f /opt/postal/config/signing.key
ln -s /storage/signing.key /opt/postal/config/signing.key
elif [ -f /opt/postal/config/signing.key ] && [ ! -L /opt/postal/config/signing.key ]; then
cp -p /opt/postal/config/signing.key /storage/signing.key
rm /opt/postal/config/signing.key
ln -s /storage/signing.key /opt/postal/config/signing.key
fi
## Start Postal ## Start Postal
/opt/postal/bin/postal "$@" /opt/postal/bin/postal "$@"