Clog (Compact Electronic Logbook System) is a web-based logbook system aimed to be used in accelerators. The goal is to design and implement a logbook system with modern web technology but in a very simple way.
/srv/clog2
English version
Chinese version
Login page for local database authentication
Login page for LDAP authentication
Login page for CSNS OAuth2 authentication
The append=true
query parameter will append the text to the end of a log instead of creating a new one if the log with the title exists.
import requests
headers = {
'Authorization':'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWNjLW1zIiwiZW1haWwiOiJjc25zLWFjY29AaWhlcC5hYy5jbiIsImFkbWluIjpmYWxzZSwiaWF0IjoxNjgyMDQ1OTk5LCJleHAiOjE2ODIwOTI4MDN9.AgXSTsVgVp2ifbvpY_bI3Nu15h4Tj5HFuwv1v7G8pP8'
}
data={
'log':'{"logbook":"6423a38977784806a220b058","category":"Info","title":"API test","description":"send from python"}'
}
response = requests.post('http://10.1.236.131:3000/api/logs?append=true',
headers=headers, data=data)
print(response.text)
Edit the following files if needed.
frondend/src/config/configuraion.js
backend/config/frontend.js
backend/config/login.js
backend/config/ldap.js
backend/config/smtp.js
Go to docs directory
cd docs
mongorestore --db clog2 database
Go to frontend directory
cd frontend
npm install
npm run serve
Go to backend directory
cd backend
npm install
npm run dev
Go to frontend directory
cd frontend
npm ci
npm run build
cp -r dist/* /var/www/html
Go to backend directory
cd backend
npm ci
pm2 start server.js
http://localhost:8080/
Test users in the database are as follows:
username: admin password: 1 admin: true
username: user1 password: 1 admin: false
username: user2 password: 1 admin: false
One compose.yaml and two Dockerfiles (one for frontend and one for backend) are provided to create the following three containers,
Prior to building images and running containers, the values of serverPath
in frontend/src/config/configuration
and url
in backend/config/database.js
need to be consistent with the host IP address, because localhost
or 127.0.0.1
of the host is not accessible from inside containers by default.
The following commands can be used to build images and run containers,
docker compose build --no-cache
docker compose up
If building and running succeed, the following page can be accessed,
http://ip_address:8080/
Docker deployment has been tested in the following environment,