Changeset f2215d09 in darkpeak-services
- Timestamp:
- Sep 28, 2018, 12:54:43 AM (2 years ago)
- Branches:
- keycloak, master, pleroma
- Children:
- f97b97d9
- Parents:
- 04cf77d5
- Location:
- roles
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
roles/apache2/defaults/main.yml
r04cf77d5 rf2215d09 1 1 service_name: default 2 domain: "{{ domain_name }}" 2 3 # Not specifying a domain makes this the default vhost 4 domain: "" 3 5 domain_alias: "" 4 6 5 # The name of the service that is providing our home page, 6 # apache2 will redirect the default bare domain to this service 7 redirect_to_service: wiki 7 web_root: "{{ default_web_root }}/{{ service_name }}" -
roles/apache2/tasks/main.yml
r04cf77d5 rf2215d09 69 69 - name: Configure apache for default site 70 70 include: configure-apache-site.yml 71 72 - name: Install placeholder index for default site 73 copy: 74 src: index.html 75 dest: "{{ web_root }}/index.html" 76 group: www-data 77 owner: root 78 mode: 0640 79 80 - name: TODO - Add users to the www-data group instead of setting 777 here 81 file: 82 state: directory 83 path: "{{ web_root }}" 84 group: www-data 85 owner: root 86 mode: 0777 -
roles/apache2/templates/apache.incl.conf.j2
r04cf77d5 rf2215d09 1 # This file is for service-specific apache configuration 1 # This is the default, catch-all vhost, so we probably want to 2 # do something based on the hostname of incoming requests 3 4 # Use of rewrite engine is necessary in order to interrogate 5 # the server variables like HTTP_HOST 6 RewriteEngine on 7 RewriteCond %{HTTP_HOST} ^([a-zA-Z0-9-.]+)$ 8 9 # If there is a sub-directory that matches the hostname, then 10 # serve pages from that directory 11 RewriteCond {{ web_root }}/%1 -d 12 RewriteRule ^(.*) {{ web_root }}/%1$1 [L] 13 14 # Otherwise, just serve the placeholder page because the service 15 # doesn't exist yet 16 RewriteRule ^(.*) {{ web_root }}/index.html [L] 17 18 # vim: syntax=apache ts=4 sw=4 sts=4 sr noet -
roles/apache2/templates/apache.vhost.conf.j2
r04cf77d5 rf2215d09 1 1 <VirtualHost *:80> 2 2 ServerAdmin webmaster@{{ domain_name }} 3 {% if domain != '' %} 3 4 ServerName {{ domain }} 5 {% endif %} 4 6 {% if domain_alias != '' %} 5 7 ServerAlias {{ domain_alias }} … … 14 16 AliasMatch "^/(.well-known/acme-challenge/.*)" "/usr/share/certbot/$1" 15 17 16 {% if service_name == ' pages' %}18 {% if service_name == 'default' or service_name == 'pages' %} 17 19 # Special case for static pages; don't use HTTPS due to having no certificates for user sites 18 20 # So just include the site config here and don't redirect to HTTPS equivilents … … 28 30 <VirtualHost _default_:443> 29 31 ServerAdmin webmaster@{{ domain_name }} 32 {% if domain != '' %} 30 33 ServerName {{ domain }} 34 {% endif %} 31 35 {% if domain_alias != '' %} 32 36 ServerAlias {{ domain_alias }} 33 37 {% endif %} 34 38 35 {% if service_name == 'default' %}36 # Redirect the bare domain name to the service providing the home page37 Redirect / https://{{ redirect_to_service }}.{{ domain_name }}/38 {% else %}39 39 DocumentRoot {{ web_root }} 40 {% endif %}41 40 42 41 ErrorLog ${APACHE_LOG_DIR}/{{ service_name }}/error.log -
roles/mediawiki/defaults/main.yml
r04cf77d5 rf2215d09 2 2 subdomain: wiki 3 3 domain: "{{ subdomain }}.{{ domain_name }}" 4 domain_alias: "" 4 # Since we are using the wiki as our homepage, both the bare domain and the 5 # www domain should also serve the wiki - set aliases accordingly 6 domain_alias: "{{ domain_name }} www.{{ domain_name }}" 5 7 web_root: /var/lib/mediawiki 6 8 -
roles/pages/files/repo-specific/pages
r04cf77d5 rf2215d09 67 67 68 68 pages_dir=$HOME/pages/$GL_REPO 69 log_dir=$HOME/pages-log 70 cname_link=/cnames/$cname 71 cname_log_link=/cnames-log/$cname 69 cname_dir=/var/www/default 72 70 73 71 # check if file already exists at symlink location 74 if [ -L $cname_link]; then72 if [ -L "$cname_dir/$cname" ]; then 75 73 # already exists 76 74 # check if the symlink points the target we want 77 if ! [ "$(readlink $cname_ link)" = "$pages_dir" ]; then75 if ! [ "$(readlink $cname_dir/$cname)" = "$pages_dir" ]; then 78 76 # CNAME already in use 79 77 echo "======================" … … 89 87 # new CNAME 90 88 # remove any old CNAME symlinks for this repository 91 for file in /cnames/*; do92 if [ "$(readlink $file)" = = $pages_dir]; then89 for file in $cname_dir/*; do 90 if [ "$(readlink $file)" = "$pages_dir" ]; then 93 91 # points to current pages repo 94 92 rm $file 95 # we shouldn't need to clean up the access log link as if the96 # root is missing then nginx docs say it won't write to access97 # log, but lets remove it anyway98 rm /cnames-log/$(basename $file)99 93 fi 100 94 done 101 95 # add symlinks for new CNAME 102 ln -s $pages_dir $cname_link 103 ln -f -s $log_dir $cname_log_link 96 ln -s $pages_dir $cname_dir/$cname 104 97 fi 105 98 fi -
roles/pages/tasks/main.yml
r04cf77d5 rf2215d09 13 13 with_items: 14 14 - "repo-specific/pages" 15 16 # The pages hook needs a user-agnostic place to add symlinks if the17 # user wants to use a custom domain for their site18 - name: Create directories for pages CNAME support19 file:20 path: "{{ item }}"21 state: directory22 owner: root23 group: root24 mode: 077725 with_items:26 - "/cnames"27 - "/cnames-log"
Note: See TracChangeset
for help on using the changeset viewer.