Skip to content

πŸš€ Setup

Ringo Hoffmann edited this page May 6, 2021 · 5 revisions

Requirements and Preparation

First of all, please read the Security manual before setting up ranna. If you skip this step, you are at your own risk. πŸ€·β€β™€οΈ

Of course, you need Docker to be installed on the host system (even if you don't want to host ranna inside a container itself!). If you want to use the Memory and MemorySwap limitations, you may need to take some steps to enable it.

First, check if the swap limit support is enabled. To do so, use the following command.

$ docker info

If you see the following warning ...

WARNING: No swap limit support

... open the grub config file (/etc/default/grub) and add the following to the GRUB_CMDLINE_LINU variable.

cgroup_enable=memory swapaccount=1

After that, execute the following command as root and restart the server.

$ sudo update-grub

Also, you may want to install docker-compose, if you want to use it for the setup.

$ sudo apt install -y docker-compose

Now, you have three options to set up ranna.

A) Via docker-compose (recommended)

Simply take this docker-compose.yml.

$ curl -Lo docker-compose.yml https://raw.githubusercontent.com/zekroTJA/ranna/master/docker-compose.yml

It contains the service definitions for ranna as well as for traefik, which is used as edge server. As example, there is also a rate limit middleware defined. You can also add an authorization middleware, if you want to give access only to certain people/services.

Of course, you need to enter your e-mail address as ACME address and as well, you need to change the Host rule for the ranna service.

To start up the stack, just execute the following command.

$ docker-compose up -d

B) Docker

The ranna project provides pre-built docker images. You can pull the image using docker-pull.

$ docker pull ghcr.io/ranna-go/ranna:latest

Then, run the container using the following command.

$ docker run --name ranna \
    -e RANNA_HOSTROOTDIR=/var/opt/ranna \
    -v /var/opt/ranna:/var/opt/ranna \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p 8080:8080 \
    ranna

C) As Binary

If you really want to, you can compile ranna to a binary and run it directly on the host.

First of all, clone the source files.

$ git clone https://github.com/zekroTJA/ranna .

Compile the binary using the go toolchain.

$ go build -o ranna cmd/ranna/main.go

For configuration, you can either use environment variables, an .env file, a config.yml or config.json file or command line arguments (use ./ranna -h for more info).

Docker socket and API configuration still needs to be done via environment variables or .env file, if you are not using the default settings.

Then, just run the binary.

./ranna
Clone this wiki locally