snappymail/examples
leo 24dbff999e
Enhancement: Add Docker Hub image (#965)
* Enhancement: Add Docker Hub image

* Push to ghcr.io

* Add all `org.opencontainers.image.xxx` labels using `--label` instead of `LABEL`

* Change `php-fpm` to listen on `:9000` to expose prometheus metrics via `php-fpm_exporter`

* Include `yarn.lock` to speed up builds

* Reorder

* Use correct sha for pr

* Add logging before overriding values in config

* Add `DEBUG=true` env var for verbose `entrypoint.sh` logs

* Print php exception when snappymail fails to generate data directory and config file on the very first time

* Log snappymail version

* Fix COPY statement

* Add .dockerignore

* Add `USER` and `ENTRYPOINT`

* Update `.dockerignore`

* Add docker image test

* Push only if image test succeeds

* Log when startup is successful

* Use plain `docker build` in `build_and_test.sh`

* Fix test output
2023-11-20 15:01:26 +01:00
..
docker-compose.mysql.yml Enhancement: Add Docker Hub image (#965) 2023-11-20 15:01:26 +01:00
docker-compose.postgres.yml Enhancement: Add Docker Hub image (#965) 2023-11-20 15:01:26 +01:00
docker-compose.simple.yml Enhancement: Add Docker Hub image (#965) 2023-11-20 15:01:26 +01:00
docker-compose.traefik.yml Enhancement: Add Docker Hub image (#965) 2023-11-20 15:01:26 +01:00
README.md Enhancement: Add Docker Hub image (#965) 2023-11-20 15:01:26 +01:00

Examples

Here are some [docker-compose] examples.

docker-compose.simple.yml

This runs snappymail, using SQLite as the database.

Start the stack:

docker-compose -f docker-compose.simple.yml up

Get the Admin Panel password:

docker exec -it $( docker-compose -f docker-compose.simple.yml ps -q snappymail ) cat /var/lib/snappymail/_data_/_default_/admin_password.txt

Now, login to http://localhost:8888/?admin with user admin and the admin password.

docker-compose.mysql.yml

This runs snappymail, using MariaDB (a fork of MYSQL) as the database.

Start snappymail and mysql:

docker-compose -f docker-compose.mysql.yml up

Get the Admin Panel password:

docker exec -it $( docker-compose -f docker-compose.mysql.yml ps -q snappymail ) cat /var/lib/snappymail/_data_/_default_/admin_password.txt

Now, login to http://localhost:8888/?admin with user admin and the admin password.

To setup MySQL as the DB, in Admin Panel, click Contacts, check Enable contacts and , and under Storage (PDO) choose the following:

  • Type: MySQL
  • Data Source Name (DSN): host=mysql;port=3306;dbname=snappymail
  • User snappymail
  • Password snappymail

Click the Test button. If it turns green, MySQL is ready to be used for contacts.

To setup Redis for caching, in Admin Panel, click Config, update the following configuration options:

  • cache > enable: yes
  • cache > fast_cache_driver: redis
  • labs > fast_cache_redis_host: redis
  • labs > fast_cache_redis_port: 6379

Redis caching is now enabled.

docker-compose.postgres.yml

This runs snappymail, using PostgreSQL as the database.

Start snappymail and postgres:

docker-compose -f docker-compose.postgres.yml up

Get the Admin Panel password:

docker exec -it $( docker-compose -f docker-compose.postgres.yml ps -q snappymail ) cat /var/lib/snappymail/_data_/_default_/admin_password.txt

Now, login to http://localhost:8888/?admin with user admin and the admin password.

To use PostgreSQL as the DB, in Admin Panel, click Contacts, check Enable contacts and , and under Storage (PDO) choose the following:

  • Type: PostgresSQL
  • Data Source Name (DSN): host=postgres;port=5432;dbname=snappymail
  • User snappymail
  • Password snappymail

Click the Test button. If it turns green, PostgreSQL is ready to be used for contacts.

To setup Redis for caching, in Admin Panel, click Config, update the following configuration options:

  • cache > enable: yes
  • cache > fast_cache_driver: redis
  • labs > fast_cache_redis_host: redis
  • labs > fast_cache_redis_port: 6379

Redis caching is now enabled.

docker-compose.traefik.yml

This runs snappymail, using SQLite as the database, with traefik as the TLS reverse proxy and loadbalancer.

In this example, it is assumed the domain name is snappymail.example.com. It is assumed you have an OVHcloud account to obtain LetsEncrypt TLS certs via ACME using DNS challenge for the domain snappymail.example.com. If you are using another DNS provider, see here.

To begin, edit the OVH_* environment variables in docker-compose.traefik.yml accordingly:

nano docker-compose.traefik.yml

Start snappymail and traefik:

docker-compose -f docker-compose.traefik.yml up

traefik should now begin requesting a TLS cert for snappymail.example.com. The process may take a few minutes. If all goes well, https://snappymail.example.com should now be ready.

You may still visit https://snappymail.example.com while waiting for traefik to be issued a TLS certificate. traefik simply serves a self-signed TLS cert.

Get the Admin Panel password:

docker exec -it $( docker-compose -f docker-compose.traefik.yml ps -q snappymail ) cat /var/lib/snappymail/_data_/_default_/admin_password.txt

Now, login to https://snappymail.example.com/?admin with user admin and the admin password.