Error during parsing: Unknown directive 'run'

1. My Caddy version (caddy -version):

root@Serviceflow-inlets:~# curl https://getcaddy.com | bash -s personal
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7380 100 7380 0 0 32800 0 --:–:-- --:–:-- --:–:-- 32654
Downloading Caddy for linux/amd64 (personal license)…
Download verification OK
Extracting…
Putting caddy in /usr/local/bin (may require password)
Caddy v1.0.4 (h1:wwuGSkUHo6RZ3oMpeTt7J09WBB87X5o+IZN4dKehcQE=)
Successfully installed
root@Serviceflow-inlets:~#

2. How I run Caddy:

/usr/local/bin/caddy run --config /etc/caddy/Caddyfile --adapter caddyfile --resume --environ

a. System environment:

OS, relevant versions, systemd? docker? etc.

root@Serviceflow-inlets:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic

Running it has systemd

b. Command:

/usr/local/bin/caddy run --config /etc/caddy/Caddyfile --adapter caddyfile --resume --environ

c. Service/unit/compose file:

root@Serviceflow-inlets:~# systemctl status caddy
● caddy.service - Caddy Web Server
   Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2020-02-13 14:15:19 UTC; 4s ago
     Docs: https://caddyserver.com/docs/
  Process: 7472 ExecStart=/usr/local/bin/caddy run --config /etc/caddy/Caddyfile --adapter caddyfile --resume --environ (code=exited, status=1/FAILURE)
 Main PID: 7472 (code=exited, status=1/FAILURE)

Feb 13 14:15:18 Serviceflow-inlets systemd[1]: Started Caddy Web Server.
Feb 13 14:15:19 Serviceflow-inlets caddy[7472]: 2020/02/13 14:15:19 args:2 - Error during parsing: Unknown directive 'run'
Feb 13 14:15:19 Serviceflow-inlets systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Feb 13 14:15:19 Serviceflow-inlets systemd[1]: caddy.service: Failed with result 'exit-code'.```

#### d. My complete Caddyfile:

root@Serviceflow-inlets:~# cat /etc/systemd/system/caddy.service
[Unit]
Description=Caddy Web Server
Documentation=https://caddyserver.com/docs/
After=network.target

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

[Install]
WantedBy=multi-user.target
root@Serviceflow-inlets:~#


### 3. The problem I'm having:

I'm not able to start caddy using the below command

/usr/local/bin/caddy run --config /etc/caddy/Caddyfile --adapter caddyfile --resume --environ


Below file is also empty

/etc/caddy/Caddyfile

root@Serviceflow-inlets:~# cd /etc/ca
ca-certificates/ calendar/
root@Serviceflow-inlets:~#



### 4. Error messages and/or full log output:

Don't know where is log file. Checked in ```/var/log/``` didn't find anything there

Hi! Welcome around.

The caddy run is introduced in Caddy v2. You’re using Caddy v1.0.4. The command is just caddy and maybe pass the config.

2 Likes

Yup!

To elaborate a bit further, the feature in v1 that’s giving you that response is the “Short Caddyfile”, which lets you follow up the command straight away with directives you’d usually put in a Caddyfile itself:

https://caddyserver.com/v1/docs/cli#short-caddyfile

v2 does indeed behave differently.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.