Skip to content

Commit

Permalink
website: init
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jul 9, 2024
1 parent 75f722f commit 50e2bc8
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This repository currently manages these services:
- Several buildbot-workers
- IP address wizard at [config.berlin.freifunk.net](https://config.berlin.freifunk.net/)
- The vpn03 servers which route our traffic to the internet
- The public website for the berlin community at [berlin.freifunk.net](https://berlin.freifunk.net/)

## Requirements

Expand Down
2 changes: 2 additions & 0 deletions inventory/host_vars/berlin.freifunk.net
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
caddy_caddyfile: Caddyfile_website.j2
2 changes: 2 additions & 0 deletions inventory/hosts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ download-master.berlin.freifunk.net
[uisp]
uisp.berlin.freifunk.net ansible_host=10.31.130.158 # New uisp VM

[website]
berlin.freifunk.net
6 changes: 6 additions & 0 deletions play.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@
- tunneldigger
tags:
- tunneldigger

- name: Set up website
hosts: website
become: true
roles:
- caddy
113 changes: 113 additions & 0 deletions templates/Caddyfile_website.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# www redirect
www.berlin.freifunk.net {
redir https://berlin.freifunk.net{uri}
}

# production
berlin.freifunk.net {
root * /srv/www/berlin.freifunk.net
encode gzip

@de_before_en {
header_regexp Accept-Language de.*en
path /
}
@en_before_de {
header_regexp Accept-Language en.*de
path /
}
@de_only {
header_regexp Accept-Language de
path /
}
@fallback {
path /
}

redir @de_before_en /de 302
redir @en_before_de /en 302
redir @de_only /de 302
redir @fallback /en 302

redir /index_en /en 301
redir /network /de/map 301
redir /contact /de/contact/ 301
redir /contact_en /en/contact 301
redir /download /de/downloads 301
redir /participate/ /de/participate 301
redir /p /de/participate 301
redir /impressum /de/impressum 301
redir /wiki /de/wiki 301
redir /meshwiki /de/wiki 301

file_server
}

# development
dev.berlin.freifunk.net {
root * /srv/www/dev.berlin.freifunk.net
encode gzip

@de_before_en {
header_regexp Accept-Language de.*en
path_regexp branch ^\/([[:alnum:]]+)(\/$|$)
}
@en_before_de {
header_regexp Accept-Language en.*de
path_regexp branch ^\/([[:alnum:]]+)(\/$|$)
}
@de_only {
header_regexp Accept-Language de
path_regexp branch ^\/([[:alnum:]]+)(\/$|$)
}
@fallback {
path_regexp branch ^\/([[:alnum:]]+)(\/$|$)
}

redir @de_before_en /{re.branch.1}/de 302
redir @en_before_de /{re.branch.1}/en 302
redir @de_only /{re.branch.1}/de 302
redir @fallback /{re.branch.1}/en 302

@index_en {
path_regexp branch ^\/([[:alnum:]]+)\/index\_en
}
redir @index_en /{re.branch.1}/en 301

@network {
path_regexp branch ^\/([[:alnum:]]+)\/network
}
redir @network /{re.branch.1}/de/map 301

@contact {
path_regexp branch ^\/([[:alnum:]]+)\/contact
}
redir @contact /{re.branch.1}/de/contact 301

@contact_en {
path_regexp branch ^\/([[:alnum:]]+)\/contact_en
}
redir @contact_en /{re.branch.1}/en/contact 301

@download {
path_regexp branch ^\/([[:alnum:]]+)\/download
}
redir @download /{re.branch.1}/de/downloads 301

@participate {
path_regexp branch ^\/([[:alnum:]]+)\/(participate|p$)
}
redir @participate /{re.branch.1}/de/participate 301

@impressum {
path_regexp branch ^\/([[:alnum:]]+)\/impressum
}
redir @impressum /{re.branch.1}/de/impressum 301

@wiki {
path_regexp branch ^\/([[:alnum:]]+)\/(meshwiki|wiki)
}
redir @wiki /{re.branch.1}/de/wiki 301

file_server
}

0 comments on commit 50e2bc8

Please sign in to comment.