Skip to content

Commit

Permalink
Change Caddy installation to download from Github. (#702)
Browse files Browse the repository at this point in the history
Can't install Caddy from Cloudsmith all the time: caddyserver/dist#115.
  • Loading branch information
rohinb2 authored Apr 4, 2024
1 parent 21ca80e commit 8e59b23
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docker/slim/password-file-auth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN mkdir -p /app/ssh

# Install the required packages
RUN apt-get update --allow-insecure-repositories && \
apt-get install -y --no-install-recommends gcc python3-dev openssh-server rsync supervisor screen curl sudo ufw git awscli && \
apt-get install -y --no-install-recommends gcc python3-dev openssh-server rsync supervisor screen wget curl sudo ufw git awscli && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Expand Down
2 changes: 1 addition & 1 deletion docker/slim/public-key-auth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN mkdir -p /app/ssh

# Install the required packages
RUN apt-get update --allow-insecure-repositories && \
apt-get install -y --no-install-recommends gcc python3-dev openssh-server rsync supervisor screen curl sudo ufw git awscli && \
apt-get install -y --no-install-recommends gcc python3-dev openssh-server rsync supervisor screen wget curl sudo ufw git awscli && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Expand Down
16 changes: 12 additions & 4 deletions runhouse/servers/caddy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,19 @@ def _install(self):
# https://caddyserver.com/docs/running#using-the-service
logger.info("Installing Caddy...")

caddy_version = "2.7.6"
arch = subprocess.run(
"dpkg --print-architecture",
shell=True,
text=True,
check=True,
capture_output=True,
).stdout.strip()
caddy_deb_url = f"https://github.com/caddyserver/caddy/releases/download/v{caddy_version}/caddy_{caddy_version}_linux_{arch}.deb"

commands = [
"sudo apt update && sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https",
"yes | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg", # noqa
"yes | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list", # noqa
"sudo apt update && sudo apt install caddy -y",
f"sudo wget -q {caddy_deb_url}",
f'sudo apt install "./caddy_{caddy_version}_linux_{arch}.deb"',
]

for cmd in commands:
Expand Down

0 comments on commit 8e59b23

Please sign in to comment.