mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[GH-ISSUE #2990] [bug]: Self host backend container deploy fail and continuous restart when using Mailcatcher #970
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#970
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hoppscotchScope on GitHub (Apr 14, 2023).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2990
Originally assigned to: @balub on GitHub.
Is there an existing issue for this?
Current behavior
When setting up the beta self hosted Hoppscotch and running everything using the provided docker images and following the documentation, the hoppscotch-backend container goes into a continual restart loop as it keeps trying configure the mailer using the mailer config I've provided in my .env which is a locally hosted MailCatcher url, which is apparently supported according to the docs.
The error logs from the hoppscotch-backend container are below:
My .env file is as follows:
Steps to reproduce
Environment
Production
Version
Self-hosted
@AndrewBastin commented on GitHub (Apr 14, 2023):
Based on docker rules, you cannot directly connect to the host machine's localhost (or 127.0.0.1) via Docker containers directly. Instead you have to use
host.docker.internalin place of127.0.0.1.Please do let me know if this fixes the issue.
@hoppscotchScope commented on GitHub (Apr 14, 2023):
@AndrewBastin Thanks for getting back to me, no this didn't work I've the exact same issue:
I've just tried it there with using Gmail as the smpts, and the same issue, there appears maybe to be an issue with nodemailer possibly?
@AndrewBastin commented on GitHub (Apr 14, 2023):
We use Mailcatcher internally to debug our mailer so we are pretty sure this should work. 😅
Can you post the
.envfile (just the MAILER bits would be fine).@hoppscotchScope commented on GitHub (Apr 14, 2023):
Ah okay, now the worry that I've just misconfigured something is setting in... lol
The full .env file is posted above, but this is the mailer part from it:
@balub commented on GitHub (Apr 15, 2023):
@hoppscotchScope , like @AndrewBastin said we use mailcatcher to test the mailer and we are certain it works with mailcatcher. Could you change the
MAILER_ADDRESS_FROMto an actual email like justusername@domain.comand try.@hoppscotchScope commented on GitHub (Apr 17, 2023):
@balub I tried this using the following config:
Mailer config
MAILER_SMTP_URL='smtp://127.0.0.1:1025'
MAILER_ADDRESS_FROM='myPersonalEmail@gmail.com'
And no luck :(
The only other thing I can think of is I have MailCatcher running locally on my own machine and the hoppscotch-backend is running in the docker container, but that shouldn't cause any issues really
Any other thoughts?
@balub commented on GitHub (Apr 17, 2023):
@hoppscotchScope can you change
MAILER_SMTP_URLto equalsmtp://host.docker.internal:1025.@hoppscotchScope commented on GitHub (Apr 17, 2023):
@balub Yes sorry I should've said I tried that also:
And still the exact same error... I'm very perplexed.
Current error logging:
@hoppscotchScope commented on GitHub (Apr 17, 2023):
@balub Just to say as well I've tried this with smpts from gandi.net (couldnt try google as I've MFA enabled) and it doesn't work either, so there seems to do an actual issue with nodeMailer, or I've somehow misconfigured something - but I don't know how that would be possible as I'm just running your docker image.
Example of what I tried for gandi smtp:
and also tried it containing the port too:
Sorry for the long message, just trying to give as much detail as possible. So I don't think MailCatcher is the issue
@balub commented on GitHub (Apr 18, 2023):
@hoppscotchScope I have a few questions I would like the answer to be able to help you solve this problem:
@balub commented on GitHub (Apr 18, 2023):
Could you run the mailcatcher with the
-fflag, so essentially the command will bemailcatcher -fand try again.@hoppscotchScope commented on GitHub (Apr 18, 2023):
@balub
Which OS are you trying to run the service on?
System details:
Could you open an interactive terminal with the backend container and check to see if the env's are being set correctly?
Because the container doesn't start correctly due to the mailer issue the container is in a constant state of "Restarting", meaning when I try to exec in I get this error:
Error response from daemon: Container 60603137063e01a2f48d91483e597cbaca7083eae08b8eedfbaf90cfdfee40cb is restarting, wait until the container is runningAlthough due to the fact that the mailer error includes my custom MAILER_SMTP_URL from my .env file, I'd say it's safe to assume that the env vars are set correctly... unless there are others that might be off?
What command are you using to start mailcatcher?/Could you run the mailcatcher with the -f flag
I'm running mailcatcher as a systemd service so I could simply tail the logs but for good measure I ran it with "mailcatcher -f" and checked the logs, when I use my testScript to send an email MailCatcher reports back correctly:
But when I try to start the hoppscotch-backend container I don't see anything at all in the MailCatcher logs.
@hoppscotchScope commented on GitHub (Apr 19, 2023):
UPDATE:
docker-compose != docker compose lol I didn't realise there was such a difference between compose v1 and compose v2, so after I installed docker compose v2 this is my output:
So this is with my .env file the same as what I cited at the bug creation, it's failing to read a property that isn't there. So it seems that even if you have no intention of using Google or Microsoft Auth etc that you still need to leave the env var placeholders in the .env file otherwise it won't run.
So I made a copy of the example env file, and put in my own env vars without removing anything else and the container runs correctly:
I still have 2 issues:
1: Now I still have can't login because I'm having issues with the login with email, I get "Network Error" red pop up alert at the bottom of the screen.
2: I've updated my .env file to use a local postgresql db but when I exec into the backend container and print the env vars, it's still using the default db from the container? Note: It's only the database_url that won't update, every other var updates correctly.
Container envs:
.env file contents:
@balub commented on GitHub (Apr 19, 2023):
@hoppscotchScope glad to hear issues with a mailer has been solved, regarding the 2nd issue have you tried rebuilding the containers from scratch using the
--no-cacheflag (command will bedocker compose build --no-cache) and trying again?@torrswanson commented on GitHub (Apr 19, 2023):
I highly suggest creating a new thread for new issues.
What's the output of your browser console and network tracing when clicking "Login"?
I'm having a similar issue with CORS rejecting http://localhost:3170/v1/auth/signin and initially on load im getting http://localhost:3170/graphql being rejected
Created a new issue here: https://github.com/hoppscotch/hoppscotch/issues/3009
@balub commented on GitHub (Apr 20, 2023):
@hoppscotchScope regarding your database url not changing can you change the database url env explicitly stated in the docker compose file and try rebuilding again.
@AndrewBastin commented on GitHub (Sep 6, 2023):
Closing issue due to inactivity.
Please do reopen if the issue still persists in 2023.8.0
@restmad commented on GitHub (Dec 2, 2023):
how to resolve this dependency