-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #492 from SURFscz/add-demo-wordpress
Add demo wordpress
- Loading branch information
Showing
30 changed files
with
1,178 additions
and
96 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
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
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
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,36 @@ | ||
--- | ||
# Ugly docker deploy hack | ||
environment_name: vm | ||
letsencrypt_enabled: false | ||
# letsencrypt_staging: false | ||
|
||
sram_conf_dir: "/opt/sram" | ||
|
||
internal_network: sram | ||
|
||
containers: | ||
etherpad: sram-etherpad | ||
wordpress: sram-wordpress | ||
wordpress_cli: sram-wordpress-cli | ||
database: sram-db | ||
|
||
images: | ||
etherpad: ghcr.io/surfscz/sram-etherpad:main | ||
wordpress: wordpress:6 | ||
wordpress_cli: wordpress:cli | ||
database: mariadb:11 | ||
|
||
demo_hosts: | ||
demo1: demo1.vm.scz-vm.net | ||
|
||
ports: | ||
etherpad: 9001 | ||
wordpress: 9002 | ||
|
||
# oidc: | ||
# demo1: | ||
# client_id: client | ||
# client_secret: secret | ||
|
||
# letsencrypt_hosts: | ||
# - "{{ hostsnames.demo1 }}" |
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
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
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
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,12 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<p> | ||
<a href="/ep/">Etherpad Demo</a> | ||
</p> | ||
<p> | ||
<a href="/wp/">Wordpress Demo</a> | ||
</p> | ||
</body> | ||
<html> |
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,5 @@ | ||
--- | ||
- name: restart apache | ||
systemd: | ||
name: apache2 | ||
state: restarted |
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,38 @@ | ||
--- | ||
- name: Install apache | ||
apt: | ||
state: present | ||
name: | ||
- apache2 | ||
- libapache2-mod-auth-openidc | ||
|
||
- name: Enable apache modules | ||
apache2_module: | ||
state: present | ||
name: "{{ item }}" | ||
ignore_configcheck: true | ||
with_items: | ||
- rewrite | ||
- proxy_http | ||
- headers | ||
notify: "restart apache" | ||
|
||
- name: Remove default apache config | ||
file: | ||
path: "/etc/apache2/sites-enabled/000-default.conf" | ||
state: "absent" | ||
notify: "restart apache" | ||
|
||
- name: copy apache proxy config | ||
template: | ||
src: apache.conf.j2 | ||
dest: /etc/apache2/sites-enabled/10-demo1.conf | ||
mode: 0644 | ||
notify: "restart apache" | ||
|
||
- name: copy index.html | ||
copy: | ||
src: index.html | ||
dest: /var/www/html | ||
mode: 0644 | ||
notify: "restart apache" |
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,78 @@ | ||
{% if letsencrypt_enabled %} | ||
<VirtualHost *:443> | ||
{% else %} | ||
<VirtualHost *:80> | ||
{% endif %} | ||
ServerName {{ demo_hosts.demo1 }} | ||
|
||
ServerAdmin webmaster@localhost | ||
DocumentRoot /var/www/html | ||
|
||
Alias /.well-known/acme-challenge/ /var/www/certbot/.well-known/acme-challenge/ | ||
|
||
ErrorLog ${APACHE_LOG_DIR}/error.log | ||
CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
|
||
{% if letsencrypt_enabled %} | ||
SSLEngine on | ||
SSLCertificateFile /etc/letsencrypt/live/{{demo_hosts.demo1}}/fullchain.pem | ||
SSLCertificateKeyFile /etc/letsencrypt/live/{{demo_hosts.demo1}}/privkey.pem | ||
{% endif %} | ||
|
||
# Authentication Header | ||
{% if letsencrypt_enabled %} | ||
# Remove OIDC option when using Basic Auth | ||
OIDCProviderMetadataURL https://proxy.sram.surf.nl/.well-known/openid-configuration | ||
OIDCClientID {{ oidc.demo1.client_id }} | ||
OIDCClientSecret {{ oidc.demo1.client_secret }} | ||
OIDCResponseType "code" | ||
OIDCResponseMode "query" | ||
OIDCScope "openid profile uid" | ||
|
||
OIDCRedirectURI /redirect_uri | ||
OIDCCryptoPassphrase randompassword | ||
|
||
RequestHeader unset X-Authenticated-User | ||
RequestHeader unset X-Authenticated-Name | ||
RequestHeader set X-Authenticated-User expr=%{ENV:OIDC_CLAIM_uid} | ||
RequestHeader set X-Authenticated-Name expr=%{ENV:OIDC_CLAIM_uid} | ||
|
||
<LocationMatch ^/(redirect_uri|ep/|wp/wp-admin|wp/wp-login.php)> | ||
Require valid-user | ||
AuthType openid-connect | ||
</LocationMatch> | ||
{% else %} | ||
RequestHeader set X-Authenticated-User "demo1" | ||
RequestHeader set X-Authenticated-Name "Demo1" | ||
{% endif %} | ||
|
||
ProxyPreserveHost on | ||
#RequestHeader set X-Forwarded-Host expr=%{HTTP_HOST} | ||
#RequestHeader set X-Forwarded-Proto expr=%{HTTPS} | ||
#RequestHeader set X-Forwarded-Port "443" | ||
|
||
RewriteEngine on | ||
|
||
# Etherpad Reverse Proxy | ||
RedirectMatch 301 /ep$ /ep/ | ||
<LocationMatch "^/ep/(.*)"> | ||
RewriteCond %{HTTP:Connection} =Upgrade [NC] | ||
RewriteCond %{HTTP:Upgrade} =websocket [NC] | ||
RewriteRule /ep/(.*) ws://localhost:9001/$1 [P,L] | ||
RewriteCond %{HTTP:Connection} !=Upgrade [NC] | ||
RewriteCond %{HTTP:Upgrade} !=websocket [NC] | ||
RewriteRule /ep/(.*) http://localhost:9001/$1 [P,L] | ||
</LocationMatch> | ||
|
||
# Wordpress Reverse Proxy | ||
RedirectMatch 301 /wp$ /wp/ | ||
<LocationMatch "^/wp/(.*)"> | ||
ProxyPassMatch http://localhost:{{ports.wordpress}}/$1 | ||
ProxyPassReverse http://localhost:{{ports.wordpress}}/$1 | ||
</LocationMatch> | ||
</VirtualHost> | ||
|
||
# Letsencrypt fallback | ||
<VirtualHost *:80> | ||
DocumentRoot /var/www/certbot | ||
</VirtualHost> |
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,2 @@ | ||
--- | ||
etherpad_basedir: "{{ sram_conf_dir }}/etherpad" |
Oops, something went wrong.