Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] 2.2.1 version of caddy does not start with systemd on Ubuntu 18.04 #185

Merged
merged 1 commit into from
Jul 13, 2021

Conversation

markopolo123
Copy link

Updated to 2.4.3

Signed-off-by: Mark Sharpley msh@Marks-MacBook-Pro.local

Description

updated install.sh to use 2.4.1 version of caddy.

Motivation and Context

Using this script with cloud init on Ubuntu 18.04. Systemd cannot start the service:

Jul 12 21:42:06 faasd caddy[3652]: {"level":"info","ts":1626126126.605867,"msg":"autosaved config","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Jul 12 21:42:06 faasd caddy[3652]: {"level":"info","ts":1626126126.6060488,"msg":"serving initial configuration"}
Jul 12 21:43:36 faasd systemd[1]: caddy.service: Start operation timed out. Terminating.
Jul 12 21:43:36 faasd caddy[3652]: {"level":"info","ts":1626126216.6931598,"msg":"shutting down apps then terminating","signal":"SIGTERM"}
Jul 12 21:43:37 faasd caddy[3652]: {"level":"info","ts":1626126217.693724,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc0002d41c0"}
Jul 12 21:43:38 faasd caddy[3652]: {"level":"info","ts":1626126218.1942427,"logger":"admin","msg":"stopped previous server"}
Jul 12 21:43:38 faasd caddy[3652]: {"level":"info","ts":1626126218.1942854,"msg":"shutdown done","signal":"SIGTERM"}
Jul 12 21:43:38 faasd systemd[1]: caddy.service: Failed with result 'timeout'.
Jul 12 21:43:38 faasd systemd[1]: Failed to start Caddy.
-- Subject: Unit caddy.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit caddy.service has failed.

How Has This Been Tested?

Tested manually:

ubuntu@faasd:~$ curl -sSL "https://github.com/caddyserver/caddy/releases/download/v2.4.3/caddy_2.4.3_linux_amd64.tar.gz" | sudo tar -xvz -C /usr/bin/ caddy
caddy

ubuntu@faasd:~$ sudo systemctl restart caddy
ubuntu@faasd:~$ sudo systemctl status caddy
● caddy.service - Caddy
   Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2021-07-12 21:53:54 UTC; 4s ago
     Docs: https://caddyserver.com/docs/
 Main PID: 3883 (caddy)
    Tasks: 8 (limit: 1120)
   CGroup: /system.slice/caddy.service
           └─3883 /usr/bin/caddy run --environ --config /etc/caddy/Caddyfile

Jul 12 21:53:54 faasd caddy[3883]: {"level":"info","ts":1626126834.9049375,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":f
alse,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Jul 12 21:53:54 faasd caddy[3883]: {"level":"info","ts":1626126834.9053664,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0
00264d20"}
Jul 12 21:53:54 faasd caddy[3883]: {"level":"info","ts":1626126834.9054606,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection polic
ies; adding one to enable TLS","server_name":"srv0","https_port":443}
Jul 12 21:53:54 faasd caddy[3883]: {"level":"info","ts":1626126834.9055247,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Jul 12 21:53:54 faasd caddy[3883]: {"level":"info","ts":1626126834.9059358,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["faasd.sharpley.
xyz"]}
Jul 12 21:53:54 faasd caddy[3883]: {"level":"info","ts":1626126834.9072638,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/var/lib/caddy/.local/sha
re/caddy"}
Jul 12 21:53:54 faasd caddy[3883]: {"level":"info","ts":1626126834.9124532,"logger":"tls","msg":"finished cleaning storage units"}
Jul 12 21:53:54 faasd caddy[3883]: {"level":"info","ts":1626126834.994078,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.j
son"}
Jul 12 21:53:54 faasd caddy[3883]: {"level":"info","ts":1626126834.994325,"msg":"serving initial configuration"}
Jul 12 21:53:54 faasd systemd[1]: Started Caddy.

Also used my fork of faasd which includes the new version of caddy to bootstrap the instance:

ubuntu@faasd:~$ systemctl status caddy
● caddy.service - Caddy
Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-07-12 22:34:53 UTC; 30min ago
Docs: https://caddyserver.com/docs/
Main PID: 2813 (caddy)
Tasks: 8 (limit: 1120)
CGroup: /system.slice/caddy.service
└─2813 /usr/bin/caddy run --environ --config /etc/caddy/Caddyfile

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

Commits:

  • I've read the CONTRIBUTION guide
  • My commit message has a body and describe how this was tested and why it is required.
  • I have signed-off my commits with git commit -s for the Developer Certificate of Origin (DCO)

Code:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.

Docs:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

…pdated to 2.4.3

Signed-off-by: Mark Sharpley <msh@Marks-MacBook-Pro.local>
Copy link
Member

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@alexellis
Copy link
Member

Thanks for the PR, but do you know why updating the version fixes this?

It worked well before and myself, @jsiebens and @Waterdrips all used it.

@alexellis
Copy link
Member

Is the admin endpoint a new thing on port 2019? Can that be disabled, or is it only exposed on localhost?

@markopolo123
Copy link
Author

Is the admin endpoint a new thing on port 2019? Can that be disabled, or is it only exposed on localhost?

by default it is exposed on localhost only.

@alexellis alexellis merged commit 9f1b5e2 into openfaas:master Jul 13, 2021
@markopolo123
Copy link
Author

Thanks for the PR, but do you know why updating the version fixes this?

It worked well before and myself, @jsiebens and @Waterdrips all used it.

can't comment as to previous uses, but I was hitting this:
https://caddy.community/t/cannot-start-caddy-as-a-service-with-systemd-ubuntu-20-04-github/12107/3

@alexellis
Copy link
Member

Merging, but I'd still like to know why this didn't work for you and it previously did work OK?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants