Setup the 2log.io Server Application

Learn how to set up a 2log instance

The easiest way to set up your 2log instance is to use Docker.

Using Docker

The easiest way to set up your 2log instance is to use the Dockerfile provided in the repository. First, make sure that Docker is installed with the associated tool docker-compose.

mkdir ~/2log
cd ~/2log
wget https://gitlab.com/2log-io/2log.io/-/raw/main/docker/docker-compose.yaml
docker-compose up

By default, the WebAssembly frontend is served by Caddy and can be reached via port 80. If the server is running on your local machine, just visit http://localhost in your web browser and the UI should come up. The initial default login is “admin” with password “password”. Don’t forget to change the password after the first login!

Setup Mail Server

The mail server can be configured directly via the environment variables. The easiest way to define these settings is directly in the docker-compose file.

#--------- Mail Server config
#- MAIL_HOST=smtp.mydomain.com
#- MAIL_USER=admin
#- MAIL_PASS=password
#- MAIL_ADDR=2log@mydomain.com //sender eMail address
#- MAIL_CONNECTION_TYPE=TLS // or SSL or TCP
#- MAIL_SENDER=2log.io // readable sender name (optional)
#- MAIL_PORT=587
Variable Description Example
MAIL_HOST How to reach the mailserver smtp.mydomain.com
MAIL_USER The login string admin
MAIL_PASS The mail server password xF5s42F1337@r!
MAIL_ADDR Sender eMail Adesse 2log@mydomain.com
MAIL_CONNECTION_TYPE Security settings. Supported are TLS, SSL or TCP TLS
MAIL_PORT The port where the mail server is listening 587

Update from 2log.io version 1.x to 2.x

Version 2.x introduces architectural changes to how the web frontend is served. In version 1.x, the 2log container itself served the WebAssembly UI on port 8080. In version 2.x, a dedicated Caddy web server takes over the hosting of static assets (the WASM UI) and serves them on port 80. This means the docker-compose.yaml file has changed significantly and must be re-downloaded.

Step-by-step upgrade

1. Stop the running instance

cd ~/2log
docker-compose down

2. Back up your data and your current docker-compose file

cp docker-compose.yaml docker-compose.yaml.bak

All operational data is stored in ./2log.io/. It is strongly recommended to create a backup of this folder before proceeding.

3. Download the new docker-compose file

wget -O docker-compose.yaml https://gitlab.com/2log-io/2log.io/-/raw/main/docker/docker-compose.yaml

4. Transfer your mail server settings

If you had configured mail server environment variables in your old docker-compose.yaml, you need to transfer them into the new file. Open the new docker-compose.yaml and uncomment/set the corresponding environment variables under the 2log service, just like before:

environment:
    - MONGODB_HOST=mongodb
    - MAIL_HOST=smtp.mydomain.com
    - MAIL_USER=admin
    - MAIL_PASS=password
    # ... etc.

You can reference your backup file docker-compose.yaml.bak to copy over the values.

5. Keep your existing MongoDB version

mongodb:
    image: mongo:4.4.13   # keep your previous version!

6. Start the updated instance

docker-compose up -d

What changed in the new docker-compose file

Change Details
Port 8080 removed The 2log container no longer serves the web UI directly. Port 8080 is no longer mapped.
Caddy web server added A new caddy service serves the WASM frontend on port 80.
New volume ./2log.io/caddy/ The 2log container copies the Caddyfile and WASM UI files into this shared volume at startup. Caddy then serves them from there.
Custom entrypoint The 2log container now has an entrypoint script that prepares the Caddy webroot before starting the server.
restart: unless-stopped All services now automatically restart after a crash or system reboot.
MongoDB version New installations default to mongo:8. Existing installations must keep their current MongoDB version (see step 5).

Update the 2log.io instance within a major version

To get the latest features and bug fixes it is recommended to update the 2log server regularly.

Updating the 2log instance when using the Docker Compose file is very simple. Just enter the following commands in the command line:

docker-compose pull 2log
docker-compose up

Backup data

All operational data of the 2log instance is stored in the folder ./2log.io. It is strongly recommended to back up the folder at regular intervals.