Deploying Genie apps

Deploying a Genie app online makes it easily shareable with a URL. There are many ways to do this, and this guide will cover a few of them, namely with a container or directly to a server.

Using docker

Containerization is a lightweight form of virtualization that encapsulates an application and its dependencies into a standalone, executable package. This makes apps portable and scalable, and solves the universal "it works on my machine" problem.

Docker makes container creation straightforward via its Dockerfile blueprint. Moreover, advanced workflows are possible such as including multiple containers running services such as databases or other backend services.

This Dockerfile, based on the official Julia image, can be used used to build a Genie app's container:

FROM julia:latest
RUN useradd --create-home --shell /bin/bash genie
RUN mkdir /home/genie/app
COPY . /home/genie/app
WORKDIR /home/genie/app
RUN chown -R genie:genie /home/
USER genie
RUN julia -e "using Pkg; Pkg.activate(\".\"); Pkg.instantiate(); Pkg.precompile();"
ENV JULIA_DEPOT_PATH "/home/genie/.julia"
ENV PORT "8000"
ENTRYPOINT ["julia", "--project", "-e", "using GenieFramework; Genie.loadapp(); up(async=false);"]

To use it, place the Dockerfile at the root of the app folder and build the image with

docker build . -t imagetag

Then, you can run the app in the container with

docker run -p 8000:8000 imagetag -d

The -p 8000:8000 option binds the port 8000 at localhost to the port 8000 on the container, whereas -druns it in detached mode in the background.

There exist dozens of deployment services for Docker, of which is one of the easiest to use. To deploy a Genie app on this service, install the flyctl cli and perform these steps:

  1. Place the Dockerfile at the root of the app folder.
  2. Run fly launch and follow the instructions in the terminal.
  3. Increase the computing instance's RAM with fly scale memory 1024.

The servers will build and deploy the image, making it accessible through a web address.

Deploying to a server


To expose the app over the internet, one needs access to a server. This can be a local machine or a cloud instance such as AWS EC2 or a Google Cloud Compute Engine for example.

If using a local server, a static IP is needed to ensure continuous access to the app. Internet service provider generally charge a fee for such extra service.

We assume that a Genie app has been developed and is ready for deployment and that it is hosted as a project on a git repository.

We assume that a Genie app MyGenieApp has its code is hosted at

Runing the app on the server

Access the server:

ssh -i "ssh-key-for-instance.pem" user@

Install Julia if not present. Then clone your app's code:

git clone
cd MyGenieAp

Install the app as with any other Julia project:

julia --project
pkg> instantiate

Now, configure the secret token with the following command:

julia --project=. --banner=no --eval="using Pkg; using Genie; Genie.Generator.write_secrets_file()

This will generate a secrets.jl file inside config/secrets.jl, and if it exists then it will update it with a new token string.

Finally, set the prod flag and launch the app in the background with nohup:

nohup export GENIE_ENV=prod && julia --project -e "using GenieFramework; Genie.loadapp(); up(async=false);" &

Now the Genie app should be running on the server and be accessible at port 8000 is open.

To launch the app on startup, you can use the supervisor utility. Install it with apt-get install supervisor, and create a genie-supervisor.conf file in the project folder with this content:

command=export GENIE_ENV=prod && julia --project -e "using GenieFramework; Genie.loadapp(); up(async=false);"

Next create a symbolic link to the supervisor config file

sudo ln -s /path/to/genie-supervisor.conf /etc/supervisor/conf.d/genie-supervisor.conf
sudo /etc/init.d/supervisor reload

The next time you restart your system, the Genie app will be automatically launched.


If the Genie app is not running on startup, you can try the following:

  1. Verify if the sudo systemctl status supervisor.service service is operational. If it's not working, you can start it and enable it for startup using the following commands:
sudo systemctl enable supervisor.service
sudo systemctl start supervisor.service

  1. To inspect the application logs, you can tail the log file as:
tail -f /var/log/genie-application.log

  1. Ensure that the port specified in the GENIE_ENV config file under server_port is open in the firewall and that no other process is bound to it.

For instance, to check if any process is running on port 80, do:

sudo lsof -t -i:80

If you need to terminate a process running on port 80, you can do:

if sudo lsof -t -i:80; then sudo kill -9 $(sudo lsof -t -i:80); fi