dunglas / mercure

🪽 An open, easy, fast, reliable and battery-efficient solution for real-time communications
https://mercure.rocks
GNU Affero General Public License v3.0
3.98k stars 296 forks source link

Caddy open mercure.db: permission denied #477

Closed BonBonSlick closed 3 years ago

BonBonSlick commented 3 years ago
ar 04 11:58:36 s1-4-bhs5 caddy[36812]: {"level":"info","ts":1614859116.7449417,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Mar 04 11:58:36 s1-4-bhs5 caddy[36812]: {"level":"info","ts":1614859116.7477784,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["127.0.0.1:2019","localhost:2019","[::1]:2019"]}
Mar 04 11:58:36 s1-4-bhs5 caddy[36812]: {"level":"info","ts":1614859116.7482336,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
Mar 04 11:58:36 s1-4-bhs5 caddy[36812]: {"level":"info","ts":1614859116.782232,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00025b260"}
Mar 04 11:58:36 s1-4-bhs5 caddy[36812]: {"level":"info","ts":1614859116.8045318,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc00025b260"}
Mar 04 11:58:36 s1-4-bhs5 caddy[36812]: run: loading initial config: loading new config: loading http app module: provision http: server srv0: setting up route handlers: route 0: loading handler modules: position 0: loading module 'subroute': provision http.handlers.subroute: setting up subroutes: route 0: loading handler modules: position 0: loading module 'mercure': provision http.handlers.mercure: "bolt://mercure.db": invalid transport: open mercure.db: permission denied
Mar 04 11:58:36 s1-4-bhs5 systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit caddy.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Mar 04 11:58:36 s1-4-bhs5 systemd[1]: caddy.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit caddy.service has entered the 'failed' state with result 'exit-code'.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target

[Service]
User=caddy
Group=caddy
ExecStart=/usr/local/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/local/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
sudo systemctl status caddy
● caddy.service - Caddy
     Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Thu 2021-03-04 12:00:06 UTC; 1s ago
       Docs: https://caddyserver.com/docs/
    Process: 37164 ExecStart=/usr/local/bin/caddy run --environ --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
   Main PID: 37164 (code=exited, status=1/FAILURE)
:80
log {
   output stdout
   format json
}
route {
    mercure {
        # Enable the demo endpoint (disable it in production!)        
        demo
       publisher_jwt ~/publisher.key
       subscriber_jwt ~/susbcriber.key
        cors_origins *
        anonymous
        subscriptions
    }
    respond "Not Found" 404
}

Used install guide https://caddyserver.com/docs/install#linux-service

Issue is in mecure plugin, because disabling it will start caddy as supposed to.

BonBonSlick commented 3 years ago

disabling transport_url local:\local solves it Track logs with when log{ output stdout / sterr } Does not work

journalctl -xef -u caddy.service journalctl -u caddy --no-pager | less