From 09aaa1b309355535caabc0ace4a509987c37d960 Mon Sep 17 00:00:00 2001 From: Justus Tumacder Date: Fri, 6 Jan 2023 13:54:57 +0800 Subject: [PATCH 1/5] Add feedback api and dummy smtp server --- .gitmodules | 3 +++ README.md | 6 ++++++ docker-compose.yml | 29 +++++++++++++++++++++++++++++ feedback-api/Dockerfile | 11 +++++++++++ feedback-api/feedback-api | 1 + 5 files changed, 50 insertions(+) create mode 100644 feedback-api/Dockerfile create mode 160000 feedback-api/feedback-api diff --git a/.gitmodules b/.gitmodules index e41c4a58..d5a7e7f7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "client/vendor/wormhole-william"] path = client/vendor/wormhole-william url = git@github.com:LeastAuthority/wormhole-william.git +[submodule "feedback-api/feedback-api"] + path = feedback-api/feedback-api + url = git@github.com:LeastAuthority/feedback-api.git diff --git a/README.md b/README.md index 2c923726..946e1dbb 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,12 @@ docker compose run -p 8080:8080 client gulp watch # equivalent command docker compose logs -f ``` +#### Email from Feedback API +We use a dummy SMTP server to log emails sent from `feedback-api`. To view the emails, run the following command: +```sh +docker compose logs -f dummy-smtp-server +``` + ### Stop development environment ```sh diff --git a/docker-compose.yml b/docker-compose.yml index aa2dacdf..2b573832 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,6 +21,35 @@ services: depends_on: - mailbox - relay + - feedback-api + feedback-api: + build: ./feedback-api + command: + [ + "app", + "-to", + "foo@barbaz.com", + "-smtp-server", + "dummy-smtp-server", + "-smtp-port", + "2500", + ] + ports: + - "8001:8001" + depends_on: + - dummy-smtp-server + environment: + - SMTP_USE_TLS=false + - SMTP_USERNAME=foo@foobar.in + - SMTP_PASSWORD=barbazquux + dummy-smtp-server: + image: python:latest + command: + ["python", "-m", "smtpd", "-n", "-c", "DebuggingServer", "0.0.0.0:2500"] + ports: + - "2500:2500" + environment: + - PYTHONUNBUFFERED=1 # build to run in CI client-ci: build: ./client diff --git a/feedback-api/Dockerfile b/feedback-api/Dockerfile new file mode 100644 index 00000000..113e838a --- /dev/null +++ b/feedback-api/Dockerfile @@ -0,0 +1,11 @@ +FROM golang:1.19 + +WORKDIR /usr/src/app + +COPY feedback-api/go.mod feedback-api/go.sum ./ +RUN go mod download && go mod verify + +COPY feedback-api . +RUN go build -buildvcs=false -v -o /usr/local/bin/app ./... + +CMD ["app"] \ No newline at end of file diff --git a/feedback-api/feedback-api b/feedback-api/feedback-api new file mode 160000 index 00000000..86333c18 --- /dev/null +++ b/feedback-api/feedback-api @@ -0,0 +1 @@ +Subproject commit 86333c182888be1fe35f6cffa0e4b6055b9d6751 From 0a29d69987a6706549242942d2f95cf38dcdf185 Mon Sep 17 00:00:00 2001 From: Justus Tumacder Date: Thu, 12 Jan 2023 11:20:13 +0800 Subject: [PATCH 2/5] Use dockerfile in feedback-api repo --- .gitmodules | 2 +- client/package-lock.json | 4 ++-- docker-compose.yml | 2 +- feedback-api | 1 + feedback-api/Dockerfile | 11 ----------- feedback-api/feedback-api | 1 - 6 files changed, 5 insertions(+), 16 deletions(-) create mode 160000 feedback-api delete mode 100644 feedback-api/Dockerfile delete mode 160000 feedback-api/feedback-api diff --git a/.gitmodules b/.gitmodules index d5a7e7f7..4c513756 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,5 +2,5 @@ path = client/vendor/wormhole-william url = git@github.com:LeastAuthority/wormhole-william.git [submodule "feedback-api/feedback-api"] - path = feedback-api/feedback-api + path = feedback-api url = git@github.com:LeastAuthority/feedback-api.git diff --git a/client/package-lock.json b/client/package-lock.json index b620c091..9b01a8bf 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -1,12 +1,12 @@ { "name": "winden", - "version": "0.5.2-beta", + "version": "0.5.3-beta", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "winden", - "version": "0.5.2-beta", + "version": "0.5.3-beta", "dependencies": { "@emotion/react": "^11.10.4", "@ionic/vue": "^5.4.0", diff --git a/docker-compose.yml b/docker-compose.yml index 2b573832..e9d3f639 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,7 @@ services: build: ./feedback-api command: [ - "app", + "/app/feedback-api", "-to", "foo@barbaz.com", "-smtp-server", diff --git a/feedback-api b/feedback-api new file mode 160000 index 00000000..0818690b --- /dev/null +++ b/feedback-api @@ -0,0 +1 @@ +Subproject commit 0818690b97f905dea171b7994d521e10cd047390 diff --git a/feedback-api/Dockerfile b/feedback-api/Dockerfile deleted file mode 100644 index 113e838a..00000000 --- a/feedback-api/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM golang:1.19 - -WORKDIR /usr/src/app - -COPY feedback-api/go.mod feedback-api/go.sum ./ -RUN go mod download && go mod verify - -COPY feedback-api . -RUN go build -buildvcs=false -v -o /usr/local/bin/app ./... - -CMD ["app"] \ No newline at end of file diff --git a/feedback-api/feedback-api b/feedback-api/feedback-api deleted file mode 160000 index 86333c18..00000000 --- a/feedback-api/feedback-api +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 86333c182888be1fe35f6cffa0e4b6055b9d6751 From 6b2c7cf4cbbc3268c453a86ae1ceaf06d2bf8915 Mon Sep 17 00:00:00 2001 From: Justus Tumacder Date: Thu, 12 Jan 2023 11:38:47 +0800 Subject: [PATCH 3/5] Switch from smtpd to aiosmtpd --- docker-compose.yml | 4 +--- dummy-smtp-server/Dockerfile | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 dummy-smtp-server/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index e9d3f639..430e2731 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,9 +43,7 @@ services: - SMTP_USERNAME=foo@foobar.in - SMTP_PASSWORD=barbazquux dummy-smtp-server: - image: python:latest - command: - ["python", "-m", "smtpd", "-n", "-c", "DebuggingServer", "0.0.0.0:2500"] + build: ./dummy-smtp-server ports: - "2500:2500" environment: diff --git a/dummy-smtp-server/Dockerfile b/dummy-smtp-server/Dockerfile new file mode 100644 index 00000000..42d9cca5 --- /dev/null +++ b/dummy-smtp-server/Dockerfile @@ -0,0 +1,7 @@ +FROM python:latest + +RUN pip install aiosmtpd + +EXPOSE 2500 + +CMD ["python", "-m", "aiosmtpd", "--nosetuid", "--debug", "--listen", "0.0.0.0:2500"] From 8e030a5eeb421bcdb42c3665e0b2502b978c8ff9 Mon Sep 17 00:00:00 2001 From: Justus Tumacder Date: Fri, 13 Jan 2023 13:34:52 +0800 Subject: [PATCH 4/5] Update feedback api submodule --- feedback-api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feedback-api b/feedback-api index 0818690b..4fdce8b3 160000 --- a/feedback-api +++ b/feedback-api @@ -1 +1 @@ -Subproject commit 0818690b97f905dea171b7994d521e10cd047390 +Subproject commit 4fdce8b3fe0455d751cf9731d2d46b0b08066416 From 275c5d087a21d9d3a5a3ec60ca6f7930b0af7223 Mon Sep 17 00:00:00 2001 From: Justus Tumacder Date: Fri, 13 Jan 2023 13:45:33 +0800 Subject: [PATCH 5/5] Use smtp Dockerfile provided by feedback-api --- docker-compose.yml | 6 +++--- dummy-smtp-server/Dockerfile | 7 ------- 2 files changed, 3 insertions(+), 10 deletions(-) delete mode 100644 dummy-smtp-server/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 430e2731..57dd1660 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,7 @@ services: "-smtp-server", "dummy-smtp-server", "-smtp-port", - "2500", + "1025", ] ports: - "8001:8001" @@ -43,9 +43,9 @@ services: - SMTP_USERNAME=foo@foobar.in - SMTP_PASSWORD=barbazquux dummy-smtp-server: - build: ./dummy-smtp-server + build: ./feedback-api/docker/smtp-server ports: - - "2500:2500" + - "1025:1025" environment: - PYTHONUNBUFFERED=1 # build to run in CI diff --git a/dummy-smtp-server/Dockerfile b/dummy-smtp-server/Dockerfile deleted file mode 100644 index 42d9cca5..00000000 --- a/dummy-smtp-server/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM python:latest - -RUN pip install aiosmtpd - -EXPOSE 2500 - -CMD ["python", "-m", "aiosmtpd", "--nosetuid", "--debug", "--listen", "0.0.0.0:2500"]