Digital Ocean with Traefik and own Domain Name
Hello!
I'm attempting to manage a study on JATOS with a droplet server on Digital Ocean, and am encountering some difficulty launching the server with proper encryption and my own domain name. I followed all the instructions on https://www.jatos.org/JATOS-on-DigitalOcean.html, using the following code in the initial script of the Droplet:
DOMAIN_NAME="langdevjatos.ca" EMAIL="my.email@foo.com" curl https://raw.githubusercontent.com/JATOS/JATOS/master/deploy/docker-compose.yaml > /root/docker-compose.yaml curl https://raw.githubusercontent.com/JATOS/JATOS/master/deploy/traefik.toml > /root/traefik.toml sed -i "s/<DOMAIN_NAME>/${DOMAIN_NAME}/g" /root/docker-compose.yaml sed -i "s/<DOMAIN_NAME>/${DOMAIN_NAME}/g" /root/traefik.toml sed -i "s/<EMAIL>/${EMAIL}/g" /root/traefik.toml touch /root/acme.json chmod 600 /root/acme.json docker network create proxy docker-compose -f /root/docker-compose.yaml up -d
I am able to get JATOS running with the basic script
#!/bin/bash # Run JATOS as docker container docker run -d --restart=always -p 80:9000 jatos/jatos:latest
But not with any encryption, which is required and expected through ethics. I'm inputting my email between the quotes above.
I continue to get an ERR_CONNECTION_TIMED_OUT message when I try both the iPv4 address (http://159.203.15.124/). My computer appears to successfully ping the ip, and there shouldn't be any difficulty with firewall or proxy so I'm unsure what is going on. The also tried to follow the DNS settings appropriately.
Any help is appreciated!
Thanks, Riss
Comments
Hi Riss,
Not sure what's going on with your server. But for a start it seems like your HTTP(S) ports aren't open:
Maybe you have to configure a firewall (usually ufw)?
Best,
Kristian
Hi Kristian,
The set-up instructions on JATOS have no mention of best-practice firewall rules. I just set up HTTPS inbound and outbound rules for the droplet and restarted it, but still no luck.
The console says:
Any other ideas? I really appreciate the help.
Thanks, Riss
Hi Riss,
To open the ports for HTTP and HTTPS it should the following commands for ufw:
and
but if you still use JATOS default port 9000:
Here is a tutorial for ufw: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-22-04.
When I wrote the docs for JATOS on DigitalOcean ufw wasn't activated by default. Maybe they changed this recently.
Best,
Kristian
Hey Kristian,
I followed the instructions in the tutorial, and now the error has changed to ERR_CONNECTION_REFUSED. The firewall inbound should be open to HTTP and HTTPS and SSH, but again, no response. I even allowed my own personal IP.
I cannot ping the server ip address anymore either.
Not sure what to try next.
Thanks, Riss
Hi Riss,
Your JATOS docker is running and port 9000 is exposed? What is the output of
docker ps
in the terminal? And ufw? What is the output ofsudo ufw status verbose
?Best,
Kristian
Hi Kristian,
Here's the output of ufw status verbose:
And the output for docker ps:
Edit: I see now that should things be in order, there would be a functioning container, right?
My Docker is indeed running and I believe 9000 is exposed. I notice now that I have /tcp for ports 22 and 80 (I believe 2375 and 2376 are for docker), but not 443 or 9000. Would that make a difference?
Thanks, Riss
You have no Docker container running. There should be traffic and JATOS running as containers. Let's see what happens when you run the JATOS' docker-compose script:
K.
Hi Kristian,
It works now! I did as you said, only to run into the error that docker-compose was not found. So I installed docker with 'snap install docker':
Then had to redo the final two lines of code from the original script:
I can now access JATOS with my domain name.
Thank you for your help! I wonder if adding 'snap install docker' to the original code would save others the same trouble as I.
Regards, Riss
Hi Riss,
Nice you got it running!
I think if you choose the right image in the beginning, extra installing Docker is not necessary. DigitalOcean has those 'Docker x on Ubuntu y' images right to be used.
Best,
Kristian
'Docker x on Ubuntu y' is indeed the image I used.
Regards, Riss.
I see. Hm. Maybe it has to do with what I found in their docs (https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-22-04):
Note: Starting with Docker Compose v2, Docker has migrated towards using the
compose
CLI plugin command, and away from the originaldocker-compose
as documented in our previous Ubuntu 20.04 version of this tutorial. While the installation differs, in general the actual usage involves dropping the hyphen fromdocker-compose
calls to becomedocker compose
. For full compatibility details, check the official Docker documentation on command compatibility between the newcompose
and the olddocker-compose
.Maybe they do not ship the 'Docker x on Ubuntu y'
docker-compose
anymore butdocker compose
?Looks like it's deprecated: https://docs.docker.com/compose/release-notes/.
Looks like the I have to update https://www.jatos.org/JATOS-on-DigitalOcean.html. But apart from the removed hyphen it has the some syntax (https://docs.docker.com/compose/reference/).
I'll give it a shot with this bash script here:
Best,
K.
Okay, I can confirm, it was just removing the hyphen and then it worked again.
I updated the docs: https://www.jatos.org/JATOS-on-DigitalOcean.html. And since you just used it, can you please have a look at the page and check that it is correct, especially the first section "Setup a simple JATOS server on DigitalOcean"?
Hi,
First of all, thank you for creating JATOS and providing such clear and comprehensive documentation!
I was following the documentation on how to run JATOS on a Digital Ocean droplet and the updated steps in this post. However, it still does not work for me.
After the last step `docker-compose -f /root/compose.yaml up -d`, I see that traefik and jatos are running, but when I navigate to the Droplet's IP, I only get a 404 Page Not Found.
Here are the step:
I'd be extremely grateful for any hints on how to fix this.
Thank you!
Hi!
Nice you like JATOS (and its documentation) :)
First I want to say, that it would have been better to open a new thread in this forum, since your issue is only remotely related to the current one. This way other people can easier navigate the forum and find information and solutions for their problems.
You say, you use Traefik and JATOS with Docker Compose. Please excuse my stupid question: do you have a domain for your server and does the domain point to the IP of your server? If you don't have a domain and don't intend to use one, you don't need a reverse proxy like Traefik and a simple installation is enough.
And some more comments:
Install Docker with snapd, because it was apparently not install by the initialisation script
It is not necessary to install Docker if you chose the proper image with Ubuntu and Docker from DigitalOcean's Marketplace.
Open Firewall for http, https, and port 9000 (as described in this post)
Usually it's not necessary to open the firefall (uwf?) since it is not activated on the Ubuntu image with Docker by default. But I might be wrong here and Ubuntu activated it by default recently.
Run `docker compose -f /root/compose.yaml up -d`
It shouldn't be necessary to call this manually - the init script should do this after you click on "Create Droplet".
Best,
Kristian
Hi Kristian,
Thank you for your help. I think I must have accidentally selected the wrong image. I can confirm that the instructions work with the Image Docker 23.0.6 on Ubuntu 22.04.
Best,
Joe