From 4a60123313d7927eb9ecaecc913bb661a2dd998a Mon Sep 17 00:00:00 2001 From: JackMorganNZ Date: Wed, 4 May 2022 12:11:34 +1200 Subject: [PATCH] Add email catcher to proxy system --- LICENSE | 2 +- README.md | 13 +++++++++++-- create-certs.sh | 2 +- docker-compose.yml | 15 +++++++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/LICENSE b/LICENSE index ef79189..bbda564 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 University of Canterbury Computer Science Education Research +Copyright (c) 2022 University of Canterbury Computer Science Education Research Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 766276c..898aaf4 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,14 @@ # UCCSER Development Proxy -This proxy is used when working on the following UCCSER websites: +This proxy is required when working on the following UCCSER websites: - [CS Unplugged](https://github.com/uccser/cs-unplugged) - [CS Field Guide](https://github.com/uccser/cs-field-guide) - [codeWOF](https://github.com/uccser/codewof) - [DTHM for Kaiako](https://github.com/uccser/dthm4kaiako) -This proxy allows multiple systems to run on your development environment simultaneously. +This proxy allows multiple systems to run on your development environment simultaneously under HTTPS. +The proxy also includes a system for catching emails sent by these systems. # Setup @@ -26,8 +27,16 @@ The script will finish with telling you when the certificates expire, where you To run the proxy, run `docker-compose up -d` in this project directory. Docker will run the proxy in the background. +> **Tip:** Add an alias to the end of your `.bashrc` file that allows starting the proxy from anywhere. +> For example (you will need to modify the path to the docker compose file for your specific system): +> ``` +> alias uc-dev="docker-compose -f ~/Projects/uccser-development-proxy/docker-compose.yml up -d" +> ``` + You can view the dashboard of the proxy by opening a browser and going to `proxy.localhost` in your preferred web browser. +You can view the email system by opening a browser and going to `email.localhost` in your preferred web browser. + To view logs of the proxy, run `docker-compose logs -f traefik`. Do shutdown the proxy, run `docker-compose down`. diff --git a/create-certs.sh b/create-certs.sh index 6dd9081..9e0f0eb 100755 --- a/create-certs.sh +++ b/create-certs.sh @@ -1,4 +1,4 @@ #!/bin/bash mkcert -install mkdir certs -mkcert -key-file certs/key.pem -cert-file certs/cert.pem proxy.localhost cs-unplugged.localhost *.cs-unplugged.localhost cs-field-guide.localhost *.cs-field-guide.localhost codewof.localhost *.codewof.localhost dthm4kaiako.localhost *.dthm4kaiako.localhost +mkcert -key-file certs/key.pem -cert-file certs/cert.pem proxy.localhost email.localhost cs-unplugged.localhost *.cs-unplugged.localhost cs-field-guide.localhost *.cs-field-guide.localhost codewof.localhost *.codewof.localhost dthm4kaiako.localhost *.dthm4kaiako.localhost diff --git a/docker-compose.yml b/docker-compose.yml index 6fcc04f..dca296a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,6 +29,21 @@ services: - "traefik.http.routers.traefik.rule=Host(`proxy.localhost`)" - "traefik.http.routers.traefik.tls=true" + mailhog: + image: mailhog/mailhog:v1.0.1 + container_name: uccser-development-email + networks: + - uccser-development-proxy + labels: + # General labels + - "traefik.enable=true" + - "traefik.http.services.mailhog.loadbalancer.server.port=8025" + # HTTPS + - "traefik.http.routers.mailhog.entryPoints=web-secure" + - "traefik.http.routers.mailhog.service=mailhog" + - "traefik.http.routers.mailhog.rule=Host(`email.localhost`)" + - "traefik.http.routers.mailhog.tls=true" + networks: uccser-development-proxy: driver: bridge