Skip to content

Commit fbffffa

Browse files
committed
Add files for deployment
1 parent e4b7b4a commit fbffffa

5 files changed

Lines changed: 114 additions & 0 deletions

File tree

.github/renovate.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:base",
5+
"schedule:weekends"
6+
],
7+
"prHourlyLimit": 8,
8+
"packageRules": [
9+
{
10+
"paths": ["**"],
11+
"groupName": "backend"
12+
}
13+
]
14+
}

.github/workflows/deploy.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy
2+
3+
on: push
4+
5+
jobs:
6+
7+
build-and-deploy:
8+
name: build and deploy (main)
9+
timeout-minutes: 10
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
- name: Login to Docker registry
15+
uses: docker/login-action@v2
16+
with:
17+
registry: postmodern.alexdaniel.org
18+
username: 'alexdaniel'
19+
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
20+
- name: Build and push
21+
id: docker_build
22+
uses: docker/build-push-action@v4
23+
with:
24+
push: true
25+
tags: postmodern.alexdaniel.org/alexdaniel-backend:${{ github.sha }} ${{ github.ref == 'refs/heads/main' && ', postmodern.alexdaniel.org/alexdaniel-backend:latest' || '' }}
26+
- name: Set SSH key
27+
if: github.ref == 'refs/heads/main'
28+
uses: webfactory/ssh-agent@v0.8.0
29+
with:
30+
ssh-private-key: ${{ secrets.SSH_KEY }}
31+
- name: Auth
32+
if: github.ref == 'refs/heads/main'
33+
run: ssh-keyscan -H postmodern.alexdaniel.org >> ~/.ssh/known_hosts
34+
- name: Deploy
35+
if: github.ref == 'refs/heads/main'
36+
run: docker stack deploy --with-registry-auth -c compose.yaml alexdaniel-backend
37+
env:
38+
DOCKER_HOST: ssh://alexdaniel@postmodern.alexdaniel.org

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM httpd:2.4.58
2+
3+
RUN apt-get update
4+
RUN apt-get install -y libcgi-pm-perl libcapture-tiny-perl libdatetime-perl libcapture-tiny-perl libgeo-ip-perl
5+
6+
COPY ./httpd.conf /usr/local/apache2/conf/httpd.conf-extra
7+
RUN cat /usr/local/apache2/conf/httpd.conf-extra >> /usr/local/apache2/conf/httpd.conf
8+
9+
COPY ./htdocs/ /usr/local/apache2/htdocs/
10+
COPY ./cgi-bin/ /usr/local/apache2/cgi-bin/
11+
COPY ./config/ /usr/local/apache2/config/
12+
13+
# Set permissions to www-data, there's seems to be no other way to do that
14+
RUN sed -i 's/^exec /chown -R www-data:www-data \/srv\/data\n\nexec /' /usr/local/bin/httpd-foreground

compose.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: "3.7"
2+
3+
services:
4+
backend:
5+
image: postmodern.alexdaniel.org/alexdaniel-backend:latest
6+
build:
7+
context: .
8+
volumes:
9+
- /home/alexdaniel/data/alexdaniel/data:/srv/data
10+
- /home/alexdaniel/data/alexdaniel/logs:/srv/logs
11+
networks:
12+
- caddy
13+
deploy:
14+
replicas: 1
15+
update_config:
16+
parallelism: 1
17+
delay: 30s
18+
order: start-first
19+
20+
labels:
21+
caddy: alexdaniel.org, www.alexdaniel.org
22+
caddy.tls: alex.jakimenko+caddy@gmail.com
23+
caddy.reverse_proxy: "{{upstreams 80}}"
24+
25+
networks:
26+
caddy:
27+
external: true

httpd.conf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
LoadModule cgid_module modules/mod_cgid.so
2+
LoadModule rewrite_module modules/mod_rewrite.so
3+
4+
ServerAdmin alex.jakimenko+server@gmail.com
5+
DocumentRoot /usr/local/apache2/htdocs/
6+
7+
SetEnv WikiConfigFile /usr/local/apache2/config/config
8+
SetEnv WikiModuleDir /usr/local/apache2/config/modules
9+
SetEnv WikiDataDir /srv/data
10+
11+
<Directory />
12+
Options -ExecCGI -FollowSymLinks -Indexes -Includes
13+
AllowOverride None
14+
</Directory>
15+
16+
<Directory /usr/local/apache2/htdocs/>
17+
AllowOverride All
18+
</Directory>
19+
20+
ErrorLog /srv/logs/error.log
21+
CustomLog /srv/logs/access.log combined

0 commit comments

Comments
 (0)