split into alpine/ubuntu
This commit is contained in:
parent
d829eb70bb
commit
40506d7a70
|
@ -1,12 +1,14 @@
|
|||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
build-alpine:
|
||||
machine: true
|
||||
working_directory: ~/repo/alpine
|
||||
steps:
|
||||
- checkout
|
||||
- checkout:
|
||||
path: ~/repo
|
||||
- run:
|
||||
name: Build Postal Docker Container
|
||||
command: docker build -t catdeployed/postal:latest .
|
||||
command: cd alpine && docker build -t catdeployed/postal:latest -t catdeployed/postal:alpine .
|
||||
- run:
|
||||
name: Skip this job for Pull Requests
|
||||
command: '[[ -v CIRCLE_PR_NUMBER ]] && circleci step halt || true'
|
||||
|
@ -27,7 +29,7 @@ workflows:
|
|||
only:
|
||||
- master
|
||||
jobs:
|
||||
- build
|
||||
- build-alpine
|
||||
commit:
|
||||
jobs:
|
||||
- build
|
||||
- build-alpine
|
||||
|
|
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
data/*
|
||||
!data/.gitkeep
|
||||
!data/postal/.gitkeep
|
||||
codeship.aes
|
||||
daily.sh
|
||||
alpine/data/*
|
||||
!alpine/data/.gitkeep
|
||||
!alpine/data/postal/.gitkeep
|
||||
ubuntu/data/*
|
||||
!ubuntu/data/.gitkeep
|
||||
!ubuntu/data/postal/.gitkeep
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ services:
|
|||
depends_on:
|
||||
- postal
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- ./src/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- static_assets:/opt/postal/public:ro
|
||||
- ./data/postal/assets:/opt/postal/public/assets:ro
|
||||
volumes:
|
22
alpine/src/nginx.conf
Normal file
22
alpine/src/nginx.conf
Normal file
|
@ -0,0 +1,22 @@
|
|||
server {
|
||||
listen 80;
|
||||
|
||||
root /opt/postal/public;
|
||||
|
||||
location / {
|
||||
client_max_body_size 50M;
|
||||
try_files $uri $uri/index.html $uri.html @puma;
|
||||
}
|
||||
|
||||
location /assets {
|
||||
add_header Cache-Control max-age=3600;
|
||||
}
|
||||
|
||||
location @puma {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://postal:5000;
|
||||
}
|
||||
}
|
68
alpine/src/templates/postal.yml.j2
Normal file
68
alpine/src/templates/postal.yml.j2
Normal file
|
@ -0,0 +1,68 @@
|
|||
web:
|
||||
# The host that the management interface will be available on
|
||||
host: postal.example.com
|
||||
# The protocol that requests to the management interface should happen on
|
||||
protocol: https
|
||||
|
||||
fast_server:
|
||||
# This can be enabled to enable click & open tracking on emails. It is disabled by
|
||||
# default as it requires a separate static IP address on your server.
|
||||
enabled: false
|
||||
bind_address:
|
||||
|
||||
general:
|
||||
# This can be changed to allow messages to be sent from multiple IP addresses
|
||||
use_ip_pools: false
|
||||
|
||||
main_db:
|
||||
# Specify the connection details for your MySQL database
|
||||
host: mysql
|
||||
username: root
|
||||
password: {{ MYSQL_ROOT_PASSWORD }}
|
||||
database: {{ MYSQL_DATABASE }}
|
||||
|
||||
message_db:
|
||||
# Specify the connection details for your MySQL server that will be house the
|
||||
# message databases for mail servers.
|
||||
host: mysql
|
||||
username: root
|
||||
password: {{ MYSQL_ROOT_PASSWORD }}
|
||||
prefix: postal
|
||||
|
||||
rabbitmq:
|
||||
# Specify the connection details for your RabbitMQ server.
|
||||
host: rabbitmq
|
||||
username: {{ RABBITMQ_DEFAULT_USER }}
|
||||
password: {{ RABBITMQ_DEFAULT_PASS }}
|
||||
vhost: /{{ RABBITMQ_DEFAULT_VHOST }}
|
||||
|
||||
dns:
|
||||
# Specifies the DNS record that you have configured. Refer to the documentation at
|
||||
# https://github.com/atech/postal/wiki/Domains-&-DNS-Configuration for further
|
||||
# information about these.
|
||||
mx_records:
|
||||
- mx.postal.example.com
|
||||
smtp_server_hostname: postal.example.com
|
||||
spf_include: spf.postal.example.com
|
||||
return_path: rp.postal.example.com
|
||||
route_domain: routes.postal.example.com
|
||||
track_domain: track.postal.example.com
|
||||
|
||||
smtp:
|
||||
# Specify an SMTP server that can be used to send messages from the Postal management
|
||||
# system to users. You can configure this to use a Postal mail server once the
|
||||
# your installation has been set up.
|
||||
host: 127.0.0.1
|
||||
port: 2525
|
||||
username: # Complete when Postal is running and you can
|
||||
password: # generate the credentials within the interface.
|
||||
from_name: Postal
|
||||
from_address: postal@yourdomain.com
|
||||
|
||||
rails:
|
||||
# This is generated automatically by the config initialization. It should be a random
|
||||
# string unique to your installation.
|
||||
secret_key: {{secretkey}}
|
||||
|
||||
web_server:
|
||||
bind_address: 0.0.0.0
|
27
ubuntu/Dockerfile
Normal file
27
ubuntu/Dockerfile
Normal file
|
@ -0,0 +1,27 @@
|
|||
FROM ruby:2.4-alpine
|
||||
|
||||
RUN apk --no-cache add nodejs mysql-client git bash python libcap py-setuptools py-pip build-base python-dev mariadb-dev tzdata \
|
||||
&& pip install j2cli \
|
||||
&& git clone https://github.com/atech/postal.git /opt/postal \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& gem install bundler \
|
||||
&& gem install procodile \
|
||||
&& gem install tzinfo-data \
|
||||
&& addgroup -S postal \
|
||||
&& adduser -S -G postal -h /opt/postal -s /bin/bash postal \
|
||||
&& chown -R postal:postal /opt/postal/ \
|
||||
&& /opt/postal/bin/postal bundle /opt/postal/vendor/bundle \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
## Adjust permissions
|
||||
RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/ruby
|
||||
|
||||
## Stick in required files
|
||||
ADD src/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ADD src/templates /templates
|
||||
|
||||
## Expose
|
||||
EXPOSE 5000
|
||||
|
||||
## Startup
|
||||
ENTRYPOINT ["/bin/bash", "-c", "/docker-entrypoint.sh ${*}", "--"]
|
52
ubuntu/docker-compose.yml
Normal file
52
ubuntu/docker-compose.yml
Normal file
|
@ -0,0 +1,52 @@
|
|||
version: "3"
|
||||
services:
|
||||
postal:
|
||||
image: catdeployed/postal:latest
|
||||
container_name: postal
|
||||
command: run
|
||||
ports:
|
||||
- 127.0.0.1:25:25
|
||||
depends_on:
|
||||
- "mysql"
|
||||
- "rabbitmq"
|
||||
volumes:
|
||||
- static_assets:/opt/postal/public
|
||||
- ./data/postal/assets:/opt/postal/public/assets
|
||||
- ./src/templates/:/templates
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=changeme
|
||||
- MYSQL_DATABASE=postal
|
||||
- RABBITMQ_DEFAULT_USER=postal
|
||||
- RABBITMQ_DEFAULT_PASS=changeme
|
||||
- RABBITMQ_DEFAULT_VHOST=postal
|
||||
mysql:
|
||||
image: mariadb:10
|
||||
container_name: postal_mysql
|
||||
volumes:
|
||||
- ./data/mysql:/var/lib/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
|
||||
nginx:
|
||||
image: nginx
|
||||
restart: always
|
||||
ports:
|
||||
- 127.0.0.1:80:80
|
||||
links:
|
||||
- postal
|
||||
depends_on:
|
||||
- postal
|
||||
volumes:
|
||||
- ./src/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- static_assets:/opt/postal/public:ro
|
||||
- ./data/postal/assets:/opt/postal/public/assets:ro
|
||||
volumes:
|
||||
static_assets:
|
||||
|
25
ubuntu/src/docker-entrypoint.sh
Executable file
25
ubuntu/src/docker-entrypoint.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Generate config
|
||||
if [ ! -f /opt/postal/config/postal.yml ] || [[ $(cat /opt/postal/config/postal.yml | wc -l) < 2 ]]; then
|
||||
## Build Jinja2 Template
|
||||
j2 /templates/postal.example.yml.j2 > /opt/postal/config/postal.example.yml
|
||||
## Add in secret key building
|
||||
echo "rails:" >> /opt/postal/config/postal.example.yml
|
||||
echo " secret_key: {{secretkey}}" >> /opt/postal/config/postal.example.yml
|
||||
## Generate config and keys
|
||||
/opt/postal/bin/postal initialize-config
|
||||
fi
|
||||
cat /opt/postal/config/postal.yml
|
||||
|
||||
## Clean Up
|
||||
rm -rf /opt/postal/tmp/pids/*
|
||||
|
||||
## Wait for MySQL to start up
|
||||
echo "== Waiting for MySQL to start up =="
|
||||
while ! mysqladmin ping -h mysql --silent; do
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
## Start Postal
|
||||
/opt/postal/bin/postal "$@"
|
22
ubuntu/src/nginx.conf
Normal file
22
ubuntu/src/nginx.conf
Normal file
|
@ -0,0 +1,22 @@
|
|||
server {
|
||||
listen 80;
|
||||
|
||||
root /opt/postal/public;
|
||||
|
||||
location / {
|
||||
client_max_body_size 50M;
|
||||
try_files $uri $uri/index.html $uri.html @puma;
|
||||
}
|
||||
|
||||
location /assets {
|
||||
add_header Cache-Control max-age=3600;
|
||||
}
|
||||
|
||||
location @puma {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://postal:5000;
|
||||
}
|
||||
}
|
66
ubuntu/src/templates/postal.example.yml.j2
Normal file
66
ubuntu/src/templates/postal.example.yml.j2
Normal file
|
@ -0,0 +1,66 @@
|
|||
web_server:
|
||||
bind_address: 0.0.0.0
|
||||
port: 5000
|
||||
max_threads: 5
|
||||
|
||||
web:
|
||||
# The host that the management interface will be available on
|
||||
host: postal.example.com
|
||||
# The protocol that requests to the management interface should happen on
|
||||
protocol: https
|
||||
|
||||
fast_server:
|
||||
# This can be enabled to enable click & open tracking on emails. It is disabled by
|
||||
# default as it requires a separate static IP address on your server.
|
||||
enabled: false
|
||||
bind_address:
|
||||
|
||||
general:
|
||||
# This can be changed to allow messages to be sent from multiple IP addresses
|
||||
use_ip_pools: false
|
||||
|
||||
main_db:
|
||||
# Specify the connection details for your MySQL database
|
||||
host: mysql
|
||||
username: root
|
||||
password: {{ MYSQL_ROOT_PASSWORD }}
|
||||
database: {{ MYSQL_DATABASE }}
|
||||
|
||||
message_db:
|
||||
# Specify the connection details for your MySQL server that will be house the
|
||||
# message databases for mail servers.
|
||||
host: mysql
|
||||
username: root
|
||||
password: {{ MYSQL_ROOT_PASSWORD }}
|
||||
prefix: postal
|
||||
|
||||
rabbitmq:
|
||||
# Specify the connection details for your RabbitMQ server.
|
||||
host: rabbitmq
|
||||
username: {{ RABBITMQ_DEFAULT_USER }}
|
||||
password: {{ RABBITMQ_DEFAULT_PASS }}
|
||||
vhost: /{{ RABBITMQ_DEFAULT_VHOST }}
|
||||
|
||||
dns:
|
||||
# Specifies the DNS record that you have configured. Refer to the documentation at
|
||||
# https://github.com/atech/postal/wiki/Domains-&-DNS-Configuration for further
|
||||
# information about these.
|
||||
mx_records:
|
||||
- mx.postal.example.com
|
||||
smtp_server_hostname: postal.example.com
|
||||
spf_include: spf.postal.example.com
|
||||
return_path: rp.postal.example.com
|
||||
route_domain: routes.postal.example.com
|
||||
track_domain: track.postal.example.com
|
||||
|
||||
smtp:
|
||||
# Specify an SMTP server that can be used to send messages from the Postal management
|
||||
# system to users. You can configure this to use a Postal mail server once the
|
||||
# your installation has been set up.
|
||||
host: 127.0.0.1
|
||||
port: 2525
|
||||
username: # Complete when Postal is running and you can
|
||||
password: # generate the credentials within the interface.
|
||||
from_name: Postal
|
||||
from_address: postal@yourdomain.com
|
||||
|
68
ubuntu/src/templates/postal.yml.j2
Normal file
68
ubuntu/src/templates/postal.yml.j2
Normal file
|
@ -0,0 +1,68 @@
|
|||
web:
|
||||
# The host that the management interface will be available on
|
||||
host: postal.example.com
|
||||
# The protocol that requests to the management interface should happen on
|
||||
protocol: https
|
||||
|
||||
fast_server:
|
||||
# This can be enabled to enable click & open tracking on emails. It is disabled by
|
||||
# default as it requires a separate static IP address on your server.
|
||||
enabled: false
|
||||
bind_address:
|
||||
|
||||
general:
|
||||
# This can be changed to allow messages to be sent from multiple IP addresses
|
||||
use_ip_pools: false
|
||||
|
||||
main_db:
|
||||
# Specify the connection details for your MySQL database
|
||||
host: mysql
|
||||
username: root
|
||||
password: {{ MYSQL_ROOT_PASSWORD }}
|
||||
database: {{ MYSQL_DATABASE }}
|
||||
|
||||
message_db:
|
||||
# Specify the connection details for your MySQL server that will be house the
|
||||
# message databases for mail servers.
|
||||
host: mysql
|
||||
username: root
|
||||
password: {{ MYSQL_ROOT_PASSWORD }}
|
||||
prefix: postal
|
||||
|
||||
rabbitmq:
|
||||
# Specify the connection details for your RabbitMQ server.
|
||||
host: rabbitmq
|
||||
username: {{ RABBITMQ_DEFAULT_USER }}
|
||||
password: {{ RABBITMQ_DEFAULT_PASS }}
|
||||
vhost: /{{ RABBITMQ_DEFAULT_VHOST }}
|
||||
|
||||
dns:
|
||||
# Specifies the DNS record that you have configured. Refer to the documentation at
|
||||
# https://github.com/atech/postal/wiki/Domains-&-DNS-Configuration for further
|
||||
# information about these.
|
||||
mx_records:
|
||||
- mx.postal.example.com
|
||||
smtp_server_hostname: postal.example.com
|
||||
spf_include: spf.postal.example.com
|
||||
return_path: rp.postal.example.com
|
||||
route_domain: routes.postal.example.com
|
||||
track_domain: track.postal.example.com
|
||||
|
||||
smtp:
|
||||
# Specify an SMTP server that can be used to send messages from the Postal management
|
||||
# system to users. You can configure this to use a Postal mail server once the
|
||||
# your installation has been set up.
|
||||
host: 127.0.0.1
|
||||
port: 2525
|
||||
username: # Complete when Postal is running and you can
|
||||
password: # generate the credentials within the interface.
|
||||
from_name: Postal
|
||||
from_address: postal@yourdomain.com
|
||||
|
||||
rails:
|
||||
# This is generated automatically by the config initialization. It should be a random
|
||||
# string unique to your installation.
|
||||
secret_key: {{secretkey}}
|
||||
|
||||
web_server:
|
||||
bind_address: 0.0.0.0
|
Loading…
Reference in New Issue
Block a user