From 5266ca74db9f1e1442d957bbd4be17335266b261 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Fri, 14 Oct 2022 21:35:40 -0400 Subject: Make docker wiki work --- wiki/tasks/docker.yml | 45 +++++++++++++++++++++++++++++++++ wiki/tasks/main.yaml | 33 ------------------------ wiki/tasks/main.yml | 57 ++++++++++++++++++++++++++++++++++++++++++ wiki/templates/emacsconf.setup | 41 ++++++++++++++---------------- wiki/templates/htmlscrubber.pm | 2 +- 5 files changed, 122 insertions(+), 56 deletions(-) create mode 100644 wiki/tasks/docker.yml delete mode 100644 wiki/tasks/main.yaml create mode 100644 wiki/tasks/main.yml (limited to 'wiki') 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 -- cgit v1.2.3