📝 Add systemd deployment instructions to README

This commit is contained in:
jwinterm
2025-12-25 08:45:01 -05:00
parent 07e99c272a
commit 799da43869
+146
View File
@@ -139,6 +139,152 @@ Example output:
Go to your browser: http://127.0.0.1:8081
## Production Deployment with systemd
This section covers running the explorer as a systemd service on a production server.
### Prerequisites
- Wownero daemon (`wownerod`) running and synced
- Wownero compiled from source (for libraries)
### 1. Create a dedicated user (optional but recommended)
```bash
# Create user for running the explorer
sudo useradd -r -m -s /bin/bash wowexplorer
# Or use an existing user like 'jw' that runs wownerod
```
### 2. Clone and build as the service user
```bash
# Switch to the user
sudo -u wowexplorer -i
# Clone the explorer
git clone https://codeberg.org/wownero/onion-wownero-blockchain-explorer-themefork.git
cd onion-wownero-blockchain-explorer-themefork
# Build
mkdir build && cd build
cmake -DMONERO_DIR=/path/to/wownero ..
make -j$(nproc)
# Create templates symlink in build dir (required for runtime)
ln -s ../src/templates templates
```
### 3. Create the systemd service file
Create `/etc/systemd/system/wowexplorer.service`:
```ini
[Unit]
Description=Wownero Blockchain Explorer
After=network-online.target wownerod.service
Wants=wownerod.service
[Service]
User=wowexplorer
Group=wowexplorer
WorkingDirectory=/home/wowexplorer/onion-wownero-blockchain-explorer-themefork/build
Type=simple
ExecStart=/home/wowexplorer/onion-wownero-blockchain-explorer-themefork/build/xmrblocks \
--daemon-url=http://127.0.0.1:34568 \
--enable-json-api \
--enable-autorefresh-option \
--enable-emission-monitor \
--port 8081
Restart=always
RestartSec=10
# Hardening
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=read-only
ReadWritePaths=/home/wowexplorer/.wownero
[Install]
WantedBy=multi-user.target
```
### 4. Enable and start the service
```bash
# Reload systemd
sudo systemctl daemon-reload
# Enable on boot
sudo systemctl enable wowexplorer
# Start the service
sudo systemctl start wowexplorer
# Check status
sudo systemctl status wowexplorer
# View logs
sudo journalctl -u wowexplorer -f
```
### 5. Example: Running as same user as wownerod
If you run `wownerod` as user `jw`, you can run the explorer as the same user:
```ini
[Unit]
Description=Wownero Blockchain Explorer
After=network-online.target wownerod.service
Wants=wownerod.service
[Service]
User=jw
Group=jw
WorkingDirectory=/home/jw/onion-wownero-blockchain-explorer-themefork/build
Type=simple
ExecStart=/home/jw/onion-wownero-blockchain-explorer-themefork/build/xmrblocks \
--daemon-url=http://127.0.0.1:34568 \
--enable-json-api \
--enable-autorefresh-option \
-b /home/jw/.wownero/lmdb
Restart=always
[Install]
WantedBy=multi-user.target
```
### 6. Reverse proxy with nginx (optional)
To serve on port 80/443 with SSL:
```nginx
server {
listen 80;
server_name explorer.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name explorer.example.com;
ssl_certificate /etc/letsencrypt/live/explorer.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/explorer.example.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
```
## The explorer's command line options
```