You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Massive 3be5e60fdd First commit 3 years ago
..
data First commit 3 years ago
Dockerfile First commit 3 years ago
README.md First commit 3 years ago
lokinet.ini First commit 3 years ago
start.sh First commit 3 years ago

README.md

Caddy routed with Lokinet inside Docker

Run caddy server pre-configured with Lokinet. Running a Lokinet SNApp has never been easier.

Compiling

Attention: you don't need to do this! There's already a pre-built image on DockerHub. You might want to do compile the image by yourself only if the DockerHub one doesn't work on your architecture or you don't trust that image.

After cloning the repository and CD-ing in the correct folder, run:
sudo docker build . -t massiveboxe/caddy-lokinet

Running

Read all section before running!

sudo docker run --name caddy-lokinet --cap-add=NET_ADMIN --device=/dev/net/tun -v DATA_PATH:/caddy/data --restart unless-stopped massiveboxe/caddy-lokinet:latest

Replace DATA_PATH with the absolute path to the folder that contains the Caddyfile, static files you want to serve, and where your Private Key will be stored. Do not replace NET_ADMIN.
We have included a data folder that works with the repo. If you want to use that one, replace DATA_PATH with /ABSOLUTE_PATH_OF_FOLDER_WHERE_YOU_CLONED_THIS_REPO/caddy-lokinet/data.

You should see the Lokinet bootstrap warns and infos (they should vaguely look like this, it's normal to have warnings), and after 90 seconds (that amount of time has been pre-determined to allow Lokinet to start even under non ideal conditions, and is only needed for the first time you run the container) you will get a message saying Here is your address: SOMETHINGSOMETHING.loki, and it will be saved inside an address.txt file inside your data folder.

Troubleshooting

I see no Lokinet startup logs

  1. sudo docker exec -it caddy-lokinet /bin/sh
  2. /lokinet/build/daemon/lokinet
    • If you get a messages that includes "what(): Address already in use", remove the address.txt from the data folder and try again.
    • If your error message contains "Illegal instruction (core dumped)", you'll have to build the standalone Lokinet image from source (here's how) and then this image again (guide). But don't worry, it's just as easy as building this container, and it still does not require to install Lokinet in the host machine.

On bootstrap, I get "Here is your address:" and no actual address

  1. sudo docker exec -it caddy-lokinet /bin/sh
  2. curl http://probably.loki/echo.sh
    • If you get a "request timed out" error, wait some time and try again. If after a minute it hasn't worked yet, kill the container, remove it, remove the address.txt file from the data folder, and try again. Watch out for the bootstrap logs, and proceed to the next section. If you get an address, proceed to the next bullet point.
    • If you get an actual address, it just means the Lokinet bootstrap took more than the arbitrary 90 seconds. Place that address in the address.txt file in the data folder, and you're good to go.

I see an error message/warning in the Lokinet bootstrap, should I worry?

  • Generally, all warns (yellow) can be ignored. The only exception is if keep getting warns that contain [somethingsomething].loki has no first hop candidate after 1:30 mins of runtime. You should consider restarting your container.
  • If you get an error saying Cannot open /dev/net/tun: No such file or directory, make sure you have included --cap-add=NET_ADMIN --device=/dev/net/tun when running docker run. This error could also happen when trying to use this container in Windows, where I don't think there's a workaround other than getting a decent OS.

The address changes every time I start the container

Make sure you have included -v DATA_PATH:/caddy/data in the docker run command, and replaced DATA_PATH with the actual absolute path where the container data is located. More info above, in the "Running" section.

Support, Licensing, etc.

For support, licensing information, etcetera take a look at the main README.