Deploy Mailcatcher to jenkins, as well

Summary: So it's possible to test emails without reading logs

Test Plan: tbd

Reviewers: #reviewers

Subscribers: jenkins-user

Differential Revision: https://hub.sealcode.org/D1099
master
Kuba Orlik 3 years ago
parent bd4ceee510
commit 3dd696acf9

@ -3,7 +3,7 @@ services:
db: db:
image: mongo:4.4-bionic image: mongo:4.4-bionic
ports: ports:
- "127.0.0.1:2${SEALIOUS_PORT:-0723}:27017" - "127.0.0.1:${PORT:-2072}4:27017"
test: test:
image: sealious-test:latest image: sealious-test:latest
build: build:
@ -16,5 +16,5 @@ services:
mailcatcher: mailcatcher:
image: schickling/mailcatcher:latest image: schickling/mailcatcher:latest
ports: ports:
- "127.0.0.1:1080:1080" - "127.0.0.1:${PORT:-108}1:1080"
- "127.0.0.1:1025:1025" - "127.0.0.1:${PORT:-102}5:1025"

@ -7,7 +7,7 @@ docker-compose down
cp secrets.example.json secrets.json cp secrets.example.json secrets.json
export SEALIOUS_PORT=$PORT export SEALIOUS_PORT="${PORT}0"
SEALIOUS_BASE_URL=$(cat .base_url) SEALIOUS_BASE_URL=$(cat .base_url)
export SEALIOUS_BASE_URL export SEALIOUS_BASE_URL

@ -1,16 +1,19 @@
#!/bin/bash #!/bin/bash
export SEALIOUS_PORT=$PORT SEALIOUS_PORT="${PORT}0"
SEALIOUS_BASE_URL=$(cat .base_url) SEALIOUS_BASE_URL=$(cat .base_url)
export SEALIOUS_BASE_URL export SEALIOUS_BASE_URL
./npm.sh run build:front; ./npm.sh run build:front;
docker-compose up -d mailcatcher
docker-compose run --user="$UID"\ docker-compose run --user="$UID"\
-e "SEALIOUS_MONGO_PORT=27017" \ -e "SEALIOUS_MONGO_PORT=27017" \
-e "SEALIOUS_MONGO_HOST=db" \ -e "SEALIOUS_MONGO_HOST=db" \
-e "SEALIOUS_PORT=$SEALIOUS_PORT" \ -e "SEALIOUS_PORT=$SEALIOUS_PORT" \
-e "SEALIOUS_BASE_URL=$SEALIOUS_BASE_URL" \ -e "SEALIOUS_BASE_URL=$SEALIOUS_BASE_URL" \
-e "SEALIOUS_MAILER=mailcatcher" \
-p "${SEALIOUS_PORT}:${SEALIOUS_PORT}" \ -p "${SEALIOUS_PORT}:${SEALIOUS_PORT}" \
-d \ -d \
test \ test \
@ -18,5 +21,6 @@ docker-compose run --user="$UID"\
&& echo "App started on $SEALIOUS_PORT" && echo "App started on $SEALIOUS_PORT"
echo "Deployed to https://${PORT}.dep.sealco.de" echo "Deployed app to https://${SEALIOUS_PORT}.dep.sealco.de"
echo "Mailcatcher available at https://${PORT}1.dep.sealco.de"
echo "Application logs should be available at https://jenkins.sealcode.org/job/Deploy%20to%20dep.sealco.de/ws v2/$PORT/log.html" echo "Application logs should be available at https://jenkins.sealcode.org/job/Deploy%20to%20dep.sealco.de/ws v2/$PORT/log.html"

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
export SEALIOUS_PORT=$PORT export SEALIOUS_PORT="${PORT}0"
SEALIOUS_BASE_URL=$(cat .base_url) SEALIOUS_BASE_URL=$(cat .base_url)
export SEALIOUS_BASE_URL export SEALIOUS_BASE_URL

@ -1,6 +1,6 @@
import _locreq from "locreq"; import _locreq from "locreq";
import { resolve } from "path"; import { resolve } from "path";
import { App } from "sealious"; import { App, LoggerMailer, SMTPMailer } from "sealious";
import tasks from "./collections/tasks"; import tasks from "./collections/tasks";
const locreq = _locreq(__dirname); const locreq = _locreq(__dirname);
@ -31,6 +31,9 @@ export default class TheApp extends App {
"www-server": { "www-server": {
port: PORT, port: PORT,
}, },
core: {
environment: <const>"production", // to send the full html emails
},
}; };
manifest = { manifest = {
name: "Sealious Playground", name: "Sealious Playground",
@ -47,4 +50,13 @@ export default class TheApp extends App {
...App.BaseCollections, ...App.BaseCollections,
tasks, tasks,
}; };
mailer =
process.env.SEALIOUS_MAILER === "mailcatcher"
? new SMTPMailer({
host: "mailcatcher",
port: 1025,
user: "any",
password: "any",
})
: new LoggerMailer();
} }

Loading…
Cancel
Save