diff --git a/alpine/Dockerfile b/Dockerfile similarity index 100% rename from alpine/Dockerfile rename to Dockerfile diff --git a/alpine/docker-compose.yml b/docker-compose.yml similarity index 100% rename from alpine/docker-compose.yml rename to docker-compose.yml diff --git a/alpine/src/create-user.sh b/src/create-user.sh similarity index 100% rename from alpine/src/create-user.sh rename to src/create-user.sh diff --git a/alpine/src/docker-entrypoint.sh b/src/docker-entrypoint.sh similarity index 100% rename from alpine/src/docker-entrypoint.sh rename to src/docker-entrypoint.sh diff --git a/alpine/src/nginx.conf b/src/nginx.conf similarity index 100% rename from alpine/src/nginx.conf rename to src/nginx.conf diff --git a/alpine/src/templates/postal.example.yml.j2 b/src/templates/postal.example.yml.j2 similarity index 100% rename from alpine/src/templates/postal.example.yml.j2 rename to src/templates/postal.example.yml.j2 diff --git a/alpine/src/templates/postal.yml.j2 b/src/templates/postal.yml.j2 similarity index 100% rename from alpine/src/templates/postal.yml.j2 rename to src/templates/postal.yml.j2 diff --git a/ubuntu/Dockerfile b/ubuntu/Dockerfile deleted file mode 100644 index feada40..0000000 --- a/ubuntu/Dockerfile +++ /dev/null @@ -1,43 +0,0 @@ -FROM ruby:2.6 - -ENV DOCKERIZE_VERSION v0.6.1 - -RUN curl -L https://github.com/wrouesnel/p2cli/releases/download/r5/p2 -o /usr/local/bin/p2 \ - && chmod +x /usr/local/bin/p2 - -RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ - && apt-get install -y nodejs - -RUN apt-get -y update \ - && 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 \ - && rm -rf /var/lib/apt/lists/* \ - && gem install bundler \ - && gem install procodile \ - && gem install tzinfo-data \ - && useradd -r -d /opt/postal -s /bin/bash postal \ - && chown -R postal:postal /opt/postal/ \ - && /opt/postal/bin/postal bundle /opt/postal/vendor/bundle \ - && apt-get -y purge python-dev git-core \ - && apt-get -y autoremove \ - && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -## Install jwilder/dockerize -RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ - && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ - && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz - -## 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/create-user.sh /create-user.sh -ADD src/templates /templates - -## Expose -EXPOSE 5000 - -## Startup -# ENV RUBYOPT --jit -ENTRYPOINT ["/bin/bash", "-c", "/docker-entrypoint.sh ${*}", "--"] diff --git a/ubuntu/docker-compose.yml b/ubuntu/docker-compose.yml deleted file mode 100644 index 68edd15..0000000 --- a/ubuntu/docker-compose.yml +++ /dev/null @@ -1,65 +0,0 @@ -version: "3" -services: - postal: - image: catdeployed/postal:ubuntu - container_name: postal - command: run - tty: true - ports: - - 127.0.0.1:25:25 - depends_on: - - "mysql" - - "rabbitmq" - volumes: - - persistent_assets:/storage - - static_assets:/opt/postal/public - - 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 - - POSTAL_FNAME=Sia - - POSTAL_LNAME=Cat - - POSTAL_PASSWORD=SecretCatPassword - - POSTAL_EMAIL=myemail@catsworld.com - healthcheck: - test: curl -sS http://127.0.0.1:5000 || exit 1 - interval: 5s - timeout: 10s - retries: 3 - mysql: - image: mariadb:10 - container_name: postal_mysql - volumes: - - mysql_data:/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 - container_name: postal_nginx - ports: - - 80:80 - links: - - postal - depends_on: - - postal - volumes: - - ./src/nginx.conf:/etc/nginx/conf.d/default.conf:ro - - static_assets:/opt/postal/public:ro - - postal_assets:/opt/postal/public/assets:ro -volumes: - persistent_assets: - static_assets: - postal_assets: - mysql_data: diff --git a/ubuntu/src/create-user.sh b/ubuntu/src/create-user.sh deleted file mode 100755 index 4f8b699..0000000 --- a/ubuntu/src/create-user.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/expect -eval spawn /opt/postal/bin/postal make-user -expect "E-Mail" -send "$env(POSTAL_EMAIL)\r" -expect "First Name" -send "$env(POSTAL_FNAME)\r" -expect "Last Name" -send "$env(POSTAL_LNAME)\r" -expect "Password" -sleep 5 -send "$env(POSTAL_PASSWORD)\r" -send "\r" -interact diff --git a/ubuntu/src/docker-entrypoint.sh b/ubuntu/src/docker-entrypoint.sh deleted file mode 100755 index 6f6edab..0000000 --- a/ubuntu/src/docker-entrypoint.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -## Clean Up -rm -rf /opt/postal/tmp/pids/* -rm -rf /tmp/postal - -## 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 - -## Generate config -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 - p2 -t /templates/postal.example.yml.j2 -o /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 - ## 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 - /create-user.sh - ## Copy over config to persistent storage - cp /opt/postal/config/postal.yml /storage/postal.yml - rm /opt/postal/config/postal.yml - ln -s /storage/postal.yml /opt/postal/config/postal.yml -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 -/opt/postal/bin/postal "$@" diff --git a/ubuntu/src/nginx.conf b/ubuntu/src/nginx.conf deleted file mode 100644 index 29f91ce..0000000 --- a/ubuntu/src/nginx.conf +++ /dev/null @@ -1,20 +0,0 @@ -server { - listen 80; - root /opt/postal/public; - gzip_static on; - gzip_proxied any; - location / { - client_max_body_size 50M; - try_files $uri $uri/index.html $uri.html @puma; - } - location /assets { - add_header Cache-Control "public,max-age=3600,immutable"; - } - 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; - } -} diff --git a/ubuntu/src/templates/postal.example.yml.j2 b/ubuntu/src/templates/postal.example.yml.j2 deleted file mode 100644 index a817f91..0000000 --- a/ubuntu/src/templates/postal.example.yml.j2 +++ /dev/null @@ -1,66 +0,0 @@ -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 - diff --git a/ubuntu/src/templates/postal.yml.j2 b/ubuntu/src/templates/postal.yml.j2 deleted file mode 100644 index 3728075..0000000 --- a/ubuntu/src/templates/postal.yml.j2 +++ /dev/null @@ -1,68 +0,0 @@ -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