summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-10-14 21:35:40 -0400
committerSacha Chua <sacha@sachachua.com>2022-10-14 21:35:40 -0400
commit5266ca74db9f1e1442d957bbd4be17335266b261 (patch)
tree9c6f8d6a9a1ba775fa58ba275037f6219e03bb3c
parent2d391af591700ae52b4f2630454eb31dcbbdd3ad (diff)
downloademacsconf-ansible-5266ca74db9f1e1442d957bbd4be17335266b261.tar.xz
emacsconf-ansible-5266ca74db9f1e1442d957bbd4be17335266b261.zip
Make docker wiki work
Diffstat (limited to '')
-rw-r--r--README.org10
-rw-r--r--docker-playbook.yml6
-rw-r--r--docker-reuse-playbook.yml2
-rw-r--r--docker-vars.yml.sample9
-rw-r--r--inventory.yml6
-rw-r--r--wiki-edit/tasks/main.yaml11
-rw-r--r--wiki/tasks/docker.yml45
-rw-r--r--wiki/tasks/main.yaml33
-rw-r--r--wiki/tasks/main.yml57
-rw-r--r--wiki/templates/emacsconf.setup41
-rwxr-xr-xwiki/templates/htmlscrubber.pm2
11 files changed, 158 insertions, 64 deletions
diff --git a/README.org b/README.org
index e115ef7..643817f 100644
--- a/README.org
+++ b/README.org
@@ -12,7 +12,10 @@ Docker: needs docker-vars.yml, see docker-vars.yml.sample
Creating:
ansible-playbook -i docker-inventory.yml docker-playbook.yml --tags wiki
-Hmm... How do I want to do this? I have a 2022-pages in my local repo, not pushed to the git. So Docker needs to mount it.
+Reusing:
+ansible-playbook -i docker-inventory.yml docker-reuse-playbook.yml --tags wiki
+
+http://localhost:28080/
** Publishing
*** Prod
To run the playbook and publish the main schedule:
@@ -26,10 +29,11 @@ ansible-playbook -i inventory.yml prod-playbook.yml --tags publish -e force_publ
*** Docker
Creating:
-- ansible-playbook -i docker-inventory.yml docker-playbook.yml
+ansible-playbook -i docker-inventory.yml docker-playbook.yml --tags wiki,publish
Reusing:
-- ansible-playbook -i docker-inventory.yml docker-reuse-playbook.yml
+ansible-playbook -i docker-inventory.yml docker-reuse-playbook.yml --tags publish
+
With docker:
https://stackoverflow.com/questions/24738264/how-to-test-ansible-playbook-using-docker
* Pad
diff --git a/docker-playbook.yml b/docker-playbook.yml
index 124c55d..be8472b 100644
--- a/docker-playbook.yml
+++ b/docker-playbook.yml
@@ -6,7 +6,7 @@
- include_vars:
file: docker-vars.yml
- name: Create a front container to be provisioned later
- tags: docker-front
+ tags: wiki
hosts: localhost
tasks:
- name: create docker container
@@ -14,13 +14,13 @@
name: emacsconf-front
image: python:3-buster
command: ["sleep", "1d"]
- pull: yes
+ volumes: "{{ ikiwiki_git_source }}:{{ ikiwiki_git_source_mount }}"
published_ports:
- "28080:80"
- "2022:22"
- name: Provision the emacsconf-front container created above
- tags: docker-front
+ tags: wiki
hosts: emacsconf-front
roles:
- wiki
diff --git a/docker-reuse-playbook.yml b/docker-reuse-playbook.yml
index 10df7d6..fd6eea2 100644
--- a/docker-reuse-playbook.yml
+++ b/docker-reuse-playbook.yml
@@ -15,7 +15,7 @@
- name: Set up the emacsconf-front wiki
hosts: emacsconf-front
- tags: front
+ tags: wiki
roles:
- wiki
diff --git a/docker-vars.yml.sample b/docker-vars.yml.sample
index aec5194..2d9476b 100644
--- a/docker-vars.yml.sample
+++ b/docker-vars.yml.sample
@@ -1,3 +1,12 @@
etherpad_api_key: CHANGEME
etherpad_database_password: CHANGEME
use_initd: true
+ikiwiki_git_branch: 2022-pages
+docker: true
+ikiwiki_plugin_path: /etc/perl/IkiWiki/Plugin/
+ikiwiki_git_source: /home/sacha/vendor/emacsconf-wiki
+ikiwiki_bare_git_dir: /var/www/wiki.git
+ikiwiki_src_dir: /var/www/wiki-src
+ikiwiki_git_source_mount: /wiki
+ikiwiki_dest: /var/www/html
+
diff --git a/inventory.yml b/inventory.yml
index 1e7f55e..10e7a2d 100644
--- a/inventory.yml
+++ b/inventory.yml
@@ -3,11 +3,15 @@ prod:
front:
ansible_host: front0.emacsconf.org
remote_user: orga
+ ansible_ssh_user: orga
+ ansible_python_interpreter: /usr/bin/python3
publish:
ansible_host: front0.emacsconf.org
remote_user: orga
+ ansible_ssh_user: orga
+ ansible_python_interpreter: /usr/bin/python3
pad:
- ansible_host: live0.emacsconf.org
+ ansible_host: front0.emacsconf.org
remote_user: orga
ansible_ssh_user: orga
ansible_python_interpreter: /usr/bin/python3
diff --git a/wiki-edit/tasks/main.yaml b/wiki-edit/tasks/main.yaml
index 11ca05b..f7eb650 100644
--- a/wiki-edit/tasks/main.yaml
+++ b/wiki-edit/tasks/main.yaml
@@ -1,4 +1,15 @@
---
+- name: Set up SSH directory
+ ansible.builtin.file:
+ path: /home/ikiwiki/.ssh
+ state: directory
+ mode: '0700'
+- name: Install SSH key for EmacsConf wiki
+ ansible.builtin.get_url:
+ url: https://emacsconf.org/id_rsa_anon_git_emacsconf
+ dest: /home/ikiwiki/.ssh/id_rsa_anon_git_emacsconf
+ mode: '0600'
+ owner: 'ikiwiki'
- name: Set up packages
become: yes
block:
diff --git a/wiki/tasks/docker.yml b/wiki/tasks/docker.yml
new file mode 100644
index 0000000..a5d73e2
--- /dev/null
+++ b/wiki/tasks/docker.yml
@@ -0,0 +1,45 @@
+- name: Set up docker stuff if on docker
+ apt:
+ pkg:
+ - lighttpd
+ - supervisor
+- name: Create the anon user
+ user:
+ name: anon
+- name: Set up Ikiwiki setup
+ template:
+ src: emacsconf.setup
+ dest: "{{ ikiwiki_path }}/emacsconf.setup"
+ owner: www-data
+ group: www-data
+- name: Set up the ikiwiki directories
+ file:
+ dest: /var/www/html
+ state: directory
+ owner: www-data
+ group: www-data
+- name: Clone the bare git repo
+ git:
+ bare: true
+ repo: "{{ ikiwiki_git_source_mount }}"
+ dest: "{{ ikiwiki_bare_git_dir }}"
+ version: "{{ ikiwiki_git_branch }}"
+- name: Change owner
+ file:
+ dest: "{{ ikiwiki_bare_git_dir }}"
+ recurse: true
+ owner: www-data
+ group: www-data
+- name: Clone the working git repo
+ git:
+ repo: "{{ ikiwiki_bare_git_dir }}"
+ dest: "{{ ikiwiki_src_dir }}"
+ version: "{{ ikiwiki_git_branch }}"
+- name: Copy supervisor config
+ template:
+ src: supervisord.conf
+ dest: /etc/supervisor/conf.d/ikiwiki.conf
+- name: Start lighttpd
+ service:
+ name: lighttpd
+ state: started
diff --git a/wiki/tasks/main.yaml b/wiki/tasks/main.yaml
deleted file mode 100644
index c685515..0000000
--- a/wiki/tasks/main.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
----
-- name: Set up packages
- ansible.builtin.apt:
- pkg:
- - ikiwiki
- - git
- - openssh-server
- - wget
- state: present
-- name: Create ikiwiki user
- user:
- name: ikiwiki
-- name: Set up SSH directory
- ansible.builtin.file:
- path: /home/ikiwiki/.ssh
- state: directory
- mode: '0700'
-- name: Install SSH key for EmacsConf wiki
- ansible.builtin.get_url:
- url: https://emacsconf.org/id_rsa_anon_git_emacsconf
- dest: /home/ikiwiki/.ssh/id_rsa_anon_git_emacsconf
- mode: '0600'
- owner: 'ikiwiki'
-- name: Set up or update repositories
- become: ikiwiki
- ansible.builtin.git:
- repo: git://git.emacsconf.org/emacsconf-wiki
- dest: /home/ikiwiki/emacsconf-wiki
-- name: Template the config
- ansible.builtin.template:
- src: /templates/emacsconf.setup
- dest: /home/ikiwiki/emacsconf.setup
- owner: ikiwiki
diff --git a/wiki/tasks/main.yml b/wiki/tasks/main.yml
new file mode 100644
index 0000000..0fa2336
--- /dev/null
+++ b/wiki/tasks/main.yml
@@ -0,0 +1,57 @@
+---
+- name: Set up packages
+ ansible.builtin.apt:
+ update_cache: true
+ pkg:
+ - ikiwiki
+ - git
+ - openssh-server
+ - libimage-magick-perl
+ - libtext-csv-perl
+ - libxml-writer-perl
+ - imagemagick
+ - nginx
+ - wget
+ state: present
+- name: Create ikiwiki group
+ group:
+ name: ikiwiki
+ state: present
+- name: Create ikiwiki user
+ user:
+ name: ikiwiki
+ group: ikiwiki
+ state: present
+- debug:
+ var: docker
+- name: Set up or update repositories
+ ansible.builtin.git:
+ repo: git://git.emacsconf.org/emacsconf-wiki
+ dest: "{{ ikiwiki_src_dir }}"
+ when: not docker|d(false)
+- name: Template the config
+ ansible.builtin.template:
+ src: emacsconf.setup
+ dest: "{{ ikiwiki_path }}/emacsconf.setup"
+ owner: ikiwiki
+- name: Copy Ikiwiki plugins
+ template:
+ src: "{{ item }}"
+ dest: "{{ ikiwiki_plugin_path }}"
+ loop:
+ - copyright.pm
+ - htmlscrubber.pm
+ - license.pm
+- include: docker.yml
+ when: docker is true
+- name: Chown all the files to ikiwiki
+ file:
+ dest: "{{ ikiwiki_path }}"
+ owner: ikiwiki
+ group: ikiwiki
+ recurse: true
+- name: Regenerate all the files
+ shell: ikiwiki --setup "{{ ikiwiki_path }}/emacsconf.setup" --rebuild --wrappers
+ register: output
+- debug:
+ var: output
diff --git a/wiki/templates/emacsconf.setup b/wiki/templates/emacsconf.setup
index 324f5b7..7ab3916 100644
--- a/wiki/templates/emacsconf.setup
+++ b/wiki/templates/emacsconf.setup
@@ -1,3 +1,6 @@
+# This file is managed by the wiki role in git@git.emacsconf.org:pub/emacsconf-ansible
+# Please make sure your changes are also reflected there.
+#
# IkiWiki::Setup::Yaml - YAML formatted setup file
#
# Setup file for ikiwiki.
@@ -10,26 +13,25 @@
# name of the wiki
wikiname: EmacsConf
# contact email for wiki
-adminemail: bandali@gnu.org
+adminemail: {{ikiwiki_admin}}
# users who are wiki admins
adminuser:
- bandali
# users who are banned from the wiki
banned_users: []
# where the source of the wiki is located
-srcdir: /home/ikiwiki/emacsconf
+srcdir: {{ ikiwiki_src_dir }}
# where to build the wiki
-#destdir: /home/ikiwiki/public_html/emacsconf
-destdir: /var/www/emacsconf.org
+destdir: {{ ikiwiki_dest }}
# base url to the wiki
-url: https://emacsconf.org
+url: {{ ikiwiki_url }}
# url to the ikiwiki.cgi
#cgiurl: https://emacsconf.org/ikiwiki.cgi
# do not adjust cgiurl if CGI is accessed via different URL
reverse_proxy: 0
# filename of cgi wrapper to generate
#cgi_wrapper: /home/ikiwiki/public_html/emacsconf/ikiwiki.cgi
-cgi_wrapper: /var/www/emacsconf.org/ikiwiki.cgi
+cgi_wrapper: {{ ikiwiki_path }}/ikiwiki.cgi
# mode for cgi_wrapper (can safely be made suid)
cgi_wrappermode: 06755
# number of seconds to delay CGI requests when overloaded
@@ -42,14 +44,9 @@ only_committed_changes: 0
rcs: git
# plugins to add to the default configuration
add_plugins:
-- goodstuff
-- theme
-#- websetup
-- license
-#- format
-- sidebar
-- attachment
-- remove
+{% for plugin in ikiwiki_plugins %}
+- {{ plugin }}
+{% endfor %}
# plugins to disable
disable_plugins: []
#disable_plugins:
@@ -58,7 +55,7 @@ disable_plugins: []
#templatedir: /usr/share/ikiwiki/templates
#templatedir: /home/ikiwiki/.ikiwiki/templates
# base wiki source location
-underlaydir: /usr/share/ikiwiki/basewiki
+underlaydir: {{ ikiwiki_underlay }}
# display verbose messages?
#verbose: 1
# log to syslog?
@@ -101,7 +98,7 @@ hardlink: 0
# extra library and plugin directories
libdirs: []
# extra library and plugin directory (searched after libdirs)
-libdir: /home/ikiwiki/.ikiwiki
+libdir: {{ ikiwiki_plugin_path }}
# environment variables
ENV: {}
# time zone name
@@ -116,7 +113,7 @@ wiki_file_chars: -[:alnum:]+/.:_
allow_symlinks_before_srcdir: 0
# cookie control
cookiejar:
- file: /home/ikiwiki/.ikiwiki/cookies
+ file: {{ ikiwiki_cookie_jar }}
# set custom user agent string for outbound HTTP requests e.g. when fetching aggregated RSS feeds
useragent: ikiwiki/3.20190228-1
# theme has a responsive layout? (mobile-optimized)
@@ -133,28 +130,28 @@ deterministic: 0
# git plugin
# git hook to generate
#git_wrapper: /home/ikiwiki/emacsconf.git/hooks/post-update
-git_wrapper: /home/ikiwiki/hooks/emacsconf
+git_wrapper: {{ ikiwiki_git_wrapper }}
# shell command for git_wrapper to run, in the background
#git_wrapper_background_command: git push github
# mode for git_wrapper (can safely be made suid)
#git_wrappermode: 06755
# git pre-receive hook to generate
#git_test_receive_wrapper: /git/wiki.git/hooks/pre-receive
-git_test_receive_wrapper: /home/ikiwiki/hooks/emacsconf-pre
+git_test_receive_wrapper: {{ ikiwiki_git_test_receive_wrapper }}
# unix users whose commits should be checked by the pre-receive hook
#untrusted_committers: []
untrusted_committers:
- anon
# gitweb url to show file history ([[file]] substituted)
#historyurl: http://git.example.com/gitweb.cgi?p=wiki.git;a=history;f=[[file]];hb=HEAD
-historyurl: //git.emacsconf.org/emacsconf-wiki/log/[[file]]
+historyurl: {{ ikiwiki_git_base_url }}/log/[[file]]
# gitweb url to show a diff ([[file]], [[sha1_to]], [[sha1_from]], [[sha1_commit]], and [[sha1_parent]] substituted)
#diffurl: http://git.example.com/gitweb.cgi?p=wiki.git;a=blobdiff;f=[[file]];h=[[sha1_to]];hp=[[sha1_from]];hb=[[sha1_commit]];hpb=[[sha1_parent]]
-diffurl: //git.emacsconf.org/emacsconf-wiki/diff/[[file]]?id=[[sha1_commit]]&id2=[[sha1_parent]]
+diffurl: {{ ikiwiki_git_base_url }}/diff/[[file]]?id=[[sha1_commit]]&id2=[[sha1_parent]]
# where to pull and push changes (set to empty string to disable)
#gitorigin_branch: origin
# branch that the wiki is stored in
-#gitmaster_branch: master
+#gitmaster_branch: {{ ikiwiki_git_branch }}
# htmlscrubber plugin
# PageSpec specifying pages not to scrub
diff --git a/wiki/templates/htmlscrubber.pm b/wiki/templates/htmlscrubber.pm
index 875b20e..904a2dc 100755
--- a/wiki/templates/htmlscrubber.pm
+++ b/wiki/templates/htmlscrubber.pm
@@ -91,7 +91,7 @@ sub scrubber {
}],
default => [undef, { (
map { $_ => 1 } qw{
- version xmlns x y fill font-size stroke-dasharray transform
+ version xmlns x y fill font-size stroke stroke-dasharray transform
data-start data-end data-video data-target data-tracks
kind label srclang default
abbr accept accept-charset accesskey