This repository has been archived by the owner on Oct 29, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add caddy webserver with acme-dns for a smooth transation
- Loading branch information
Showing
4 changed files
with
243 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: deploy-caddy | ||
|
||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/caddy.yml' | ||
- 'caddy/**' | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Tailscale | ||
uses: tailscale/github-action@65cdd9a05d7ebe4ef4e8c70141f5d84e1cd4cab4 | ||
with: | ||
oauth-client-id: ${{ secrets.TAILSCALE_CLIENT_ID }} | ||
oauth-secret: ${{ secrets.TAILSCALE_SECRET }} | ||
tags: tag:deploy-ci | ||
hostname: Github-actions | ||
version: ${{ vars.TAILSCALE_VERSION }} | ||
|
||
- name: Add secrets to config files | ||
env: | ||
CLOUDFLARE_TOKEN: ${{ secrets.cloudflare_token }} | ||
EMAIL: ${{ secrets.email }} | ||
run: | | ||
sed -i "s|(email)|$EMAIL|g" $GITHUB_WORKSPACE/caddy/docker-compose.yml | ||
sed -i "s|(cloudflare_token)|$CLOUDFLARE_TOKEN|g" $GITHUB_WORKSPACE/caddy/docker-compose.yml | ||
- name: Start Deployment | ||
uses: FarisZR/[email protected] | ||
env: | ||
EMAIL: ${{ secrets.email }} | ||
with: | ||
remote_docker_host: ${{ secrets.server_address }} | ||
tailscale_ssh: true # no need for manual private and public keys | ||
compose_file_path: caddy/docker-compose.yml | ||
args: -p caddy up -d --remove-orphans | ||
upload_directory: true | ||
docker_compose_directory: caddy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
email {env.EMAIL} | ||
admin off | ||
acme_dns cloudflare { | ||
token {env.CLOUDFLARE_TOKEN} | ||
} | ||
} | ||
# generate cert for turn.aosus.org, but don't serve anything | ||
turn.aosus.org { | ||
abort | ||
} | ||
|
||
mail.aosus.org { | ||
tls { | ||
key_type rsa4096 | ||
} | ||
abort | ||
} | ||
|
||
www.aosus.org { | ||
redir https://aosus.org{uri} | ||
header Cache-Control "max-age=2592000, stale-while-revalidate=2592000" | ||
} | ||
|
||
import /etc/caddy/configs/*.caddyfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
version: "3.7" | ||
|
||
networks: | ||
web: | ||
external: true | ||
discourse: | ||
external: true | ||
|
||
services: | ||
caddy: | ||
image: oci.fariszr.com/fariszr/caddy-dns:cloudflare-alpine | ||
container_name: caddy | ||
restart: always | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
- "443:443/udp" | ||
environment: | ||
- EMAIL=(email) | ||
- CLOUDFLARE_TOKEN=(cloudflare_token) | ||
configs: | ||
- source: Caddyfile | ||
target: /etc/caddy/Caddyfile | ||
volumes: | ||
- /home/aosus/caddy/configs:/etc/caddy/configs:ro | ||
- /home/aosus/caddy/proxy_error_page.html:/srv/proxy_error_page.html:ro | ||
- data:/data | ||
- config:/config | ||
networks: | ||
web: | ||
discourse: | ||
|
||
configs: | ||
Caddyfile: | ||
file: /home/aosus/caddy/Caddyfile | ||
|
||
volumes: | ||
data: | ||
config: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<!doctype html> | ||
<html lang="ar"> | ||
|
||
<head> | ||
<div dir="RTL"> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="refresh" content="60"> | ||
<title>هذه الخدمة غير متوفرة حاليا</title> | ||
<style> | ||
.center { | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
.container { | ||
background: #ececec; | ||
max-width: 500px; | ||
padding: 50px 50px 30px 50px; | ||
margin-top: 50px; | ||
border-radius: 20px; /* Rounded corners */ | ||
} | ||
|
||
.title { | ||
padding-top: 20px; | ||
} | ||
|
||
h1, | ||
p { | ||
font-family: “Helvetica Neue”, Helvetica, Arial, sans-serif; | ||
} | ||
|
||
@keyframes spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
|
||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
.spinner { | ||
animation: spin 2s infinite linear; | ||
height: 30px; | ||
width: 30px; | ||
border: 4px solid #919191; | ||
border-right-color: transparent; | ||
border-radius: 50%; | ||
margin-top: 20px; | ||
} | ||
|
||
/* Center the buttons */ | ||
.button-container { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
/* Style the buttons */ | ||
.button { | ||
border: none; /* Remove border */ | ||
color: white; /* White text */ | ||
padding: 15px 32px; /* Add some padding */ | ||
text-align: center; /* Centered text */ | ||
text-decoration: none; /* Remove underline */ | ||
display: inline-block; /* Inline element */ | ||
font-size: 16px; /* Set a font size */ | ||
border-radius: 30px; /* Rounded corners */ | ||
box-shadow: 0 2px 5px 0 rgba(0,0,0,0.26); /* Add a shadow */ | ||
transition: 0.3s; /* Add a transition effect */ | ||
} | ||
|
||
/* Change the button color on hover */ | ||
.button:hover { | ||
box-shadow: 0 4px 10px 0 rgba(0,0,0,0.37); /* Bigger shadow */ | ||
} | ||
|
||
/* Green button */ | ||
.green { | ||
background-color: green; /* Green background */ | ||
} | ||
|
||
/* Green button on hover */ | ||
.green:hover { | ||
background-color: #66bb6a; /* Lighter green */ | ||
} | ||
|
||
/* Cyan button */ | ||
.cyan { | ||
background-color: #0088CC; /* Cyan background */ | ||
} | ||
|
||
/* Cyan button on hover */ | ||
.cyan:hover { | ||
background-color: #00aaff; /* Lighter cyan */ | ||
} | ||
|
||
/* Add some margin between the buttons */ | ||
.button + .button { | ||
margin: 10px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div class="center"> | ||
<div class="container"> | ||
<div class="center"> | ||
<img src="https://cdn-cf-discourse.aosus.org/original/2X/c/c3ea74b68d4f80fbf949a0b6989e44a1b33dce29.svg" | ||
alt="Discourse logo" width="244" height="66"> | ||
</div> | ||
<h1 class="title">هذه الخدمة غير متوفرة حاليا…</h1> | ||
<div class="center"> | ||
<p>ربما يتم تحديثها او تواجه صعوبات تقنية <br /> | ||
تأكد من حالة خدمات مجتمع عبر الزر بالاسفل | ||
</p> | ||
</div> | ||
<div class="button-container"> | ||
<a href="https://status.aosus.org" class="button green">حالة خدمات أسس</a> | ||
<a href="https://t.me/aosus" class="button cyan"> أسس على التيليجرام</a> | ||
</div> | ||
<div class="center"> | ||
<p>الصفحة يتم تحديثها تلقائيا كل 60 ثانية</p> | ||
</div> | ||
<div class="center"> | ||
<div class="spinner"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
</html> |