Assuming the server has docker
and nginx
installed, and the server IP is accessible from the public network.
Pulling Images#
-
Pull the database image
docker pull postgres:15-alpine
-
Pull the
umami
imagedocker pull docker.umami.is/umami-software/umami:postgresql-latest
Starting the Database Service#
-
Create a local path to persistently save database data
mkdir postgresql-data
-
Create a
docker
network for theumami
container to accessdocker network create umami_sql_network
-
Start the database service, replacing
/root/umami/postgresql-data
with the full path created in the first stepdocker run -d --name umami_database --network umami_sql_network --network-alias umami_database -e POSTGRES_DB=umami -e POSTGRES_USER=umami -e POSTGRES_PASSWORD=umami -v /root/umami/postgresql-data:/var/lib/postgresql/data postgres:15-alpine
-
Check the database container logs and status
- Check the database container logs:
docker logs umami_database
- Check running
docker
containers:docker ps
- Check the database container logs:
Starting the umami
Container#
-
Replace
APP_SECRET
with a random string. If you do not neednginx
reverse proxy, change-p 127.0.0.1:3000:3000
to-p 3000:3000
to access directly athttp://your_ip:3000
docker run -d --name umami --network umami_sql_network -e DATABASE_URL=postgresql://umami:umami@umami_database:5432/umami -e DATABASE_TYPE=postgresql -e APP_SECRET=ewgyifufsrgyuyhuserfyger -p 127.0.0.1:3000:3000 docker.umami.is/umami-software/umami:postgresql-latest
-
Check the
umami
container logs:docker logs umami
-
Check running
docker
containers:docker ps
nginx
Reverse Proxy (Optional)#
Use nginx
to proxy the umami
service and configure the https certificate
.
Create a new configuration file /etc/nginx/conf.d/umami.conf
vim /etc/nginx/conf.d/umami.conf
Fill in the following configuration, with server_name
and https certificate
paths (ssl_certificate
, ssl_certificate_key
) for reference, and configure according to your domain and certificate paths.
server {
listen 443 ssl;
http2 on;
server_name umami.hyacm.com;
ssl_certificate /root/lobe-chat-db/hyacm.com.cert;
ssl_certificate_key /root/lobe-chat-db/hyacm.com.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:3000;
# proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 20000M;
}
}
Reload the nginx
service
systemctl reload nginx.service
Or restart the nginx
service
systemctl restart nginx.service