How to Setup ODK-X on Digital Ocean

Posted April 15, 2021 504 views
Initial Server Setup

Hi everyone, I am looking for help to set up ODK-X on Digital Ocean for our clean water charity. I did some searching but couldn’t find any walk-throughs. If there is anyone that can assist us, it would be an amazing help for our nonprofit. Thanks all :)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


There is a tutorial within ODK-X docs that seems to be useful. However, I am not sure whether you are looking just for such kind of help.

  • I followed the instructions and although I believe ODK is installed, there is NO gui console running.

    • Hi @dnelson,

      Have you got your ODK running yet ?
      What exactly error is when you try to get ODK web-ui ?

      I tried to replicate your issue and found difficult to get web-ui after droplet restart. However, I found workaround for it. If you encounter similar problem, I could share this solution here.

      • If you could share that I would super appreciate it, thank you :)

        • First things first, then. Let me explain what an issue I encountered.

          I could not get ODK web-ui after restarting a droplet (nginx 504 Gateway Time-out error in a web browser), however, I must admit that it sometimes happened that I could get it after some longer period of time since I restarted a droplet (15min - 1 hour).


          1. Use Ubuntu 20.04 LTS instead of 18.04 LTS.

          This workaround does not work in Ubuntu 18.04

          I assume that you follow ODK-X doc on how to setup ODK-X Sync Endpoint on DO. This workaround applies some changes to it.

          Modify python script as below to get a droplet with Ubuntu 20.04.

          import digitalocean
          import sys
          if len(sys.argv) != 3:
              print("Usage: python pyscript [DESIRED DROPLET NAME] [REGION CODE]")
          dtoken = input('Enter DO token: ')
          dname = sys.argv[1]
          dregion = sys.argv[2]
          script = open("cloud_init_DO.yml", "r")
          scripttext =
          # create a droplet with arguments passed in
          droplet = digitalocean.Droplet(token = dtoken,
                                         name = dname,
                                         image = 'ubuntu-20-04-x64',
                                         region = dregion,
                                         size_slug = "s-2vcpu-4gb",
                                         user_data = scripttext,
                                         backups = False)
          print("Droplet created! Now log on to DigitalOcean and run the script on our droplet!")
          As ODK-X doc on deployment sync endpoint in DO seems to be outdated, I exchanged size_slug with the one having similar parameters but cheaper by half. For security reasons, I moved entering DO token from command argument into script. Thanks to that, DO token will no longer remain in a shell command history.

          Note that now, you need to provide only three arguments to create a droplet with a python script (you had needed four arguments before modification). So, for example, to create a droplet with the name odkx in region lon1, you need to run the command as below:

          python3 odkx lon1

          When you have your droplet created and A DNS record set up, ensure that DNS changes you made are already propagated. Let’s assume that you set up to point at your droplet. Check whether you can resolve its name successfully:


          If you can see your droplet’s IP address within a result displayed by above command, you can continue with ODK-X installation. If you cannot see the IP, put the installation on hold until DNS setup is propagated.

          2. Rebuild odk/sync-web-ui docker image.

          If you get an issue with accessing web-ui (e.g. after restarting droplet’s OS), then follow the steps below.

          Firstly, remove docker stack:

          docker stack remove syncldap

          Then rebuild an image (--no-cache is crucial):

          docker build --pull --no-cache -t odk/sync-web-ui

          Finally, deploy a docker stack again.

          docker stack deploy -c sync-endpoint-default-setup/docker-compose.yml -c sync-endpoint-default-setup/docker-compose-https.yml syncldap


          1. Although ODK-X doc uses a root user for installation, I strongly recommend being inline with good security practices, and set up a sudoer and use it consequently along the installation.

          2. Use ssh client for ODK-X installation, instead of a recovery console of DO control panel. For ssh connections (for security reasons): set up public/private key authentication, disable password authentication, and disable root login.

          You can find the information helpful to apply above recommendations among DO documents and tutorials. Here are some links:

          I hope it helps.

          by Brian Boucheron
          When you first create a new Ubuntu 20.04 server, you should perform some important configuration steps as part of the basic setup. These steps will increase the security and usability of your server, and will give you a solid foundation for subsequent actions. In this tutorial you will create a user, give them sudo access, and set up a firewall.
  • What I would appreciate would be if I could do a zoom call with someone who knows how to set up ODK on Digital Ocean. I would share my screen and do a quick review of my settings.