This is the multi-page printable view of this section.
Click here to print.
Return to the regular view of this page.
Getting Started
Here you will learn step by step how to set up your own 2log instance.
Preamble
2log is a free OpenSource project that can be used freely and without charge under the terms of the GPL v.3/ AGPL v.3. This means that the authors of 2log.io do not accept any liability for any damage or infringement of valid rights caused by the use of 2log.io.
Prerequisites
In order to operate 2log, certain technical requirements must be met.
Server and Network
To run your own 2log instance, a Docker-enabled computer with x86-64 architecture is recommended. Since 2log is implemented in a very resource-efficient way, a headless Linux server with a 1.4GHz dual core and 4GB memory is sufficient.
The 2log hardware components communicate with the server via WiFi. Accordingly, the server and the IoT devices must be able to reach each other over a 2.4GHz network.
For the operation of 2log the server must be able to send e-mails. For this purpose, an SMTP mail server is required.
Machines and devices
Since the 2log Switch controls access to the devices by connecting and disconnecting power, it is important to ensure that all connected machines can handle this.
Since 2log detects via power consumption whether the machine is in stand-by mode or actually working, it is ensured that a machine is never switched off from operation.
Depending on the smart sockets used for the 2log switches, it must be ensured that the machines do not draw more current than is supported by the connectors.
1 - 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 can be reached via Port 8080. If the server is running on your local machine, just visit http://localhost:8080 in your web browser and the UI should come up. You can now login into your instancy by accessing the WebSocket service which is by default accessible via port 4711. To check your instance is up and just type ws://localhost:4711
. The initial default login is “admin” with passwort “password”. Don’t forget to change the password after the first login!
Note:
The frontend does currently not work in mobile browsers. Since the frontend is written in Qt, it can easily be compiled as a native Android *.apk. (Which is much cooler anyway).
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 the 2log.io instance
To get the latest features and bug fixes it is recommended to update the 2log server regularly.
Attention!
The update process must necessarily happen outside of the operating hours, as all running processes are interrupted by the update process!
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.
2 - Let your community grow!
Learn how to add or import members to your 2log.io instance
To add new members you can either use the web portal or the 2log Admin app.
2log has two separate user administrations. Members and administrators are managed separately and independently. This page is only about adding members.
Add a single member
The easiest way to add a new member is via the app or web portal. The procedure is identical for both variants.
- Log in to your 2log instance with your admin account.
- Switch to the “User” menu item
- Click “New user”
- Fill in the form fields.
- The alias field is optional. The alias must be unique and can be used by the members besides the email address to log in. If there is already a user with this alias, an error message will be displayed. The alias can also be used to call the user by his nickname.
- The eMail address is mandatory and must be unique. If there is already a user with this email address, an error message will be displayed.
- Currently there are three different roles: “Member”, “employee” and “guest”. Unlike “employee”, “guest” is not yet used productively. The role Employee is relevant for the machine time accounting where there is the option “Free for employees”.
- In the “Account balance” box, a starting balance can be set and an RFID card can be added.
- If you use the app on an RFID-enabled smartphone, you can scan the new card directly with your phone.
- Alternatively, the use of an “Admin Dot” is possible. This can be set up in the “Administration” area and allows convenient reading of cards from the web app.
- Grant access rights to individual machines or groups
- Click on “Create user”.
Congratulations! This is your first community member.
Add members with the CSV importer
If many users are created at once, for example when the new class starts the semester, the CSV Importer is the better choice.
- Log in to your 2log instance with your admin account.
- Switch to the “User” menu item
- Click “CSV Import”
- Download the sample template to see an example of a valid import file.
- The importer uses the labeling of the header, i.e. the first line, to assign the individual fields. Accordingly, it does not cause any problems if additional fields or a different order is used.
- Upload your CSV File. You will now see a preview of the records found.
- If no role has been assigned yet, you can assign one using the button in the header of the preview. The same applies to the group. It is possible to add a group permission to a record uploaded via CSV.
- Confirm the import with a click on “start import”.
Note:
If a user with the specified email address or card ID already exists, the user is not created but edited accordingly. For example, the credit specified in the CSV is added to the existing account balance or a new email address is assigned.