MallocArray / obico-oraclecloud

Self Hosted Obico server on Oracle Cloud Free Tier
53 stars 3 forks source link

Email configuration is not set up, resulting in HTTP 500 error when trying to verify email #1

Closed timur-tabi closed 2 years ago

timur-tabi commented 2 years ago

https://github.com/TheSpaghettiDetective/obico-server/issues/178

Unfortunately, I'm not familiar enough with Docker to figure out how to fix this, but it appears that the EMAIL_HOST, EMAIL_HOST_USER, and EMAIL_HOST_PASSWORD variables need to be set.

Would it be possible to configure sendmail (or something like it) in the docker container so that Obico can send emails itself?

If not, can you include instructions on how to set these variables?

MallocArray commented 2 years ago

This would be part of the standard Obico setup process after the Oracle Stack has finished configuring the server, so somewhat outside of the scope of this project itself, but lets see what we can do. The instructions for configuring e-mail notifications are documented here: https://www.obico.io/docs/server-guides/email_guide/

I tried to get Gmail setup as the SMTP server but was never able to get it to work. Once I setup an Outlook.com account using smtp.office365.com I was able to get it working when it was still Spaghetti Detective. (I'm having some 500 errors with Obico as well, so double checking my settings to fix the things I didn't transfer correctly)

The instructions talk about renaming a file to make a file name ".env" in the project folder and modifying the values. I saw you opened an issue about not being able to get SSH setup so I'll take a look at that next, but what you could do is make a new file on your personal computer and name it .env and put this in the contents of it

EMAIL_HOST=""  # Such as "smtp.gmail.com"
EMAIL_HOST_USER="" # Such as your email address for a Gmail account
EMAIL_HOST_PASSWORD="" # Your email account password
EMAIL_PORT=587   # Check with your email provider to make sure. DO NOT surround it with quotes. Otherwise email won't be sent!
EMAIL_USE_TLS="True"  # Set it to 'False' if your email provider doesn't use TLS, which is uncommon
DEFAULT_FROM_EMAIL="changeme@example.com" # The "FROM" email address in all emails sent by the system

Put your values inside of the quote marks on each line and then save it. In the Oracle Cloud portal, navigate to the Bucket you created and use the "Upload" button under the Objects section to upload your .env file to the bucket. Then go to the Stack for Obico and Destroy and then Apply so it re-runs the setup and it should copy the file from the bucket into the Instance before it configures things, so hopefully you could do that without SSH access until we get that figured out.

MallocArray commented 2 years ago

There appears to be some documentation issues regarding the .env file, so hopefully it is clarified soon: https://github.com/TheSpaghettiDetective/obico-server/issues/643

Ultimately, when setting a variable, remove all of the # from the beginning and middle of the lines you need to configure, do not include any of the double quote marks, and remove the comments from the back of the line. Example: EMAIL_HOST=smtp.office365.com

Finally, after adding/modifying the .env file, you have to rebuild the container and not just restart

sudo docker-compose up --build -d
timur-tabi commented 2 years ago

It would be cool if the zipfile could set up the VM so that sendmail is installed and functioning. Then the .env file could be set up with the same values for everyone.

MallocArray commented 2 years ago

Modifying the Obico container images themselves is not in scope of this project, as this only covers provisioning a VM and starting up the docker containers.

You can make a Feature Request on a Obico project site if you would like, but I saw a similar one from April 2021 that has not been commented on. Maybe add a comment to it and see if that gains any traction: https://github.com/TheSpaghettiDetective/obico-server/issues/425

timur-tabi commented 2 years ago

I got email working, thanks.