-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
add caddy server as system install #1070
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
cmd/system/caddy.go
Outdated
} | ||
|
||
command.Flags().StringP("version", "v", "", "The version or leave blank to determine the latest available version") | ||
command.Flags().String("path", "/usr/local/bin", "Installation path, where a caddy subfolder will be created") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not the usual pattern, but Caddy installs to /usr/bin/
Have a look at the faasd script to see what else may be missing, including adding users etc.
For adding users, we will need to detect the OS from /etc/os-release and reject the command if it's not debian or ubuntu.
In the future, if someone needs this for Alpine or Fedora, they can add a patch to run useradd with the correct syntax for their distro.
There are also some directories created and chmod is run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start, but there's more needed for a system install to match how Caddy is installed with faasd: https://github.com/openfaas/faasd/blob/master/hack/install.sh
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
The new changes look like what I was expecting. Could you test this and see if Caddy starts up correctly on a new Linux VM you create somewhere? If you need a sample Caddyfile, you can change the domains for the below:
|
} | ||
|
||
commands := strings.Join(shellCmds, "; ") | ||
if err = exec.Command(commands).Run(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try go-execute which is used elsewhere? It has a shell option if needed.
// TODO: Add empty CaddyFile and if required FAAS_DOMAIN setup too | ||
|
||
shellCmds := []string{ | ||
"$SUDO chown --recursive caddy:caddy /var/lib/caddy", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think $SUDO could be removed, and arkade could be run as sudo arkade
if needed.
|
||
caddyUser := "caddy" | ||
if _, err = user.Lookup(caddyUser); errors.Is(err, user.UnknownUserError(caddyUser)) { | ||
addUserCmd := fmt.Sprintf("$SUDO useradd --system --home %s --shell /bin/false %s", caddyHomeDir, caddyUser) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try go-execute again which splits out cmd vs args
@nitishkumar71 suggested using the "get" method from the tools code. I think it would be worth trying out as an experiment. |
Description
Motivation and Context
design/approved
by a maintainer (required)Closes Add Caddy Server as System install #1069
How Has This Been Tested?
Executed the command
arkade system install caddy
produced below outputIf updating or adding a new CLI to
arkade get
, run:Types of changes
Documentation
./arkade get --format markdown
./arkade install --help
Checklist:
git commit -s