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
umamiimagedocker 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
dockernetwork for theumamicontainer to accessdocker network create umami_sql_network -
Start the database service, replacing
/root/umami/postgresql-datawith 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
dockercontainers:docker ps
- Check the database container logs:
Starting the umami Container#
-
Replace
APP_SECRETwith a random string. If you do not neednginxreverse proxy, change-p 127.0.0.1:3000:3000to-p 3000:3000to access directly athttp://your_ip:3000docker 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
umamicontainer logs:docker logs umami -
Check running
dockercontainers: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