summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--create-a-wiki-preview.mdwn205
-rw-r--r--create-a-wiki/additional.mdwn64
-rw-r--r--create-a-wiki/create-a-wiki.mdwn (renamed from create-a-wiki.mdwn)0
-rw-r--r--create-a-wiki/lab-wiki.mdwn28
-rw-r--r--index.mdwn6
-rw-r--r--wiki-preview.mdwn99
6 files changed, 299 insertions, 103 deletions
diff --git a/create-a-wiki-preview.mdwn b/create-a-wiki-preview.mdwn
new file mode 100644
index 0000000..05f8153
--- /dev/null
+++ b/create-a-wiki-preview.mdwn
@@ -0,0 +1,205 @@
+---
+title: Create a Fripost wiki preview
+...
+
+This article describes how to set up preview of Friposts wiki.
+
+**Table of contents**
+
+[[!toc]]
+
+The setup will produce the following layout:
+
+```
+ Bare remote Git repository
+ (git.fripost.org:fripost-wiki.git)
+ |
+ | Library and config
+ Repository for Local Edits (~/.ikiwiki/)
+ (~/git/fripost/wiki) |
+ | +---------+
+ | | Ikiwiki |
+ The Preview Ikiwiki Web Part -----| Pandoc |
+ (~/public_html/fripost-wiki) | Plugins |
+ | +---------+
+ +------------+ +---------+
+ | Web server | ---- | Browser |
+ +------------+ +---------+
+```
+
+Where *~/git/fripost/wiki* is a local git repository with remote
+tracking of Fripost's origin remote wiki repository
+*git.fripost.org:fripost-wiki.git*. The local preview version will
+reside in *~/public_html/fripost-wiki*. Eventually it will be accessed
+by pointing the browser to *http://fripost.localhost* and
+*http://wiki.fripost.localhost* respectively. The wiki configuration
+*~/.ikiwiki/fripost-wiki.setup* will be only minor modifications of
+Friposts wiki configuration.
+
+The guide assumes Debian stable. This is the overview of software
+needed:
+
+ * Git -- from Debian
+ * Ikiwiki -- from Debian
+ * Pandoc -- from Debian
+ * Some Ikiwiki plugins (e.g. for Pandoc) which will be provided from
+ Fripost's configuraiton
+ * Nginx -- webserver from Debian
+
+Install and configure Git
+=========================
+
+Refer to [Git och Fripost](git_och_fripost) for installation
+instructions.
+
+You will need the following repositories:
+
+ * <https://git.fripost.org/fripost-ansible>
+ * <https://git.fripost.org/fripost-wiki>
+
+Clone with SSH if you want to edit, which will require you to provide
+a public key to Fripost administrators. Below snippets assume:
+
+ git clone https://git.fripost.org/fripost-ansible ~/git/fripost/ansible
+ git clone https://git.fripost.org/fripost-wiki ~/git/fripost/wiki
+
+Install and configure Ikiwiki, Pandoc and plugins
+=================================================
+
+Refer to [ikiwiki setup](https://ikiwiki.info/setup/) at
+[ikiwiki's official website](https://ikiwiki.info) for initial
+install and configuration and
+[an article on Git](https://ikiwiki.info/rcs/git/) for more details on
+setting up Ikiwiki together with Git.
+
+Install packages referred to in the Ansible configuration:
+
+ sudo apt install \
+ ikiwiki \
+ libauthen-passphrase-perl \
+ highlight-common libhighlight-perl libimage-magick-perl \
+ libmail-sendmail-perl libnet-dns-sec-perl \
+ fcgiwrap spawn-fcgi \
+ pandoc \
+ clamdscan
+
+Copy Ikiwiki configuration from Fripost Ansible repository:
+
+ mkdir -p ~/public_html/fripost-wiki ~/.ikiwiki
+ cp -r ~/git/fripost/ansible/roles/wiki/files/var/lib/ikiwiki/* ~/.ikiwiki
+
+Modify the configuration *~/.ikiwkik/fripost-wiki.setup* according to
+the below (inspect */tmp/fripost-wiki.sed*):
+
+```
+cat <<EOF | tee /tmp/fripost-wiki.sed
+/adminemail:/ s/admin@/$USER@/
+/^adminuser:/,/^[a-z]*:/ {
+ /^ *-/ d
+ /^adminuser:/ a \\
+ - $USER
+}
+/^srcdir:/ s|:.*$|: $HOME/git/fripost/wiki|
+/^destdir:/ s|:.*$|: $HOME/public_html/fripost-wiki|
+/^cgi_wrapper:/ s|:.*$|: $HOME/public_html/fripost-wiki/ikiwiki.cgi|
+/url:/ s|:.*$|: http://wiki.fripost.localhost/ \# http://fripost.localhost/|
+/cgiurl:/ s|:.*$|: http://wiki.fripost.localhost/ikiwiki.cgi|
+/^libdir:\|^ *file:/ s|/var/lib/ikiwiki|$HOME/.ikiwiki|
+/^sslcookie:/ s/1/0/g
+/^git_wrapper:/ s/^/\#/g
+/^wrappergroup:/ s/^/\#/g
+/^historyurl:/ s/^/\#/g
+/^diffurl:/ s/^/\#/g
+/^gitorigin_branch:/ s|:.*$|: ''|
+EOF
+sed -f /tmp/fripost-wiki.sed \
+ < ~/git/fripost/ansible/roles/wiki/files/var/lib/ikiwiki/fripost-wiki.setup \
+ > ~/.ikiwiki/fripost-wiki.setup
+```
+
+*TODO investegate what to do with post update thing.*
+
+Run setup:
+
+ $ ikiwiki --setup ~/.ikiwiki/fripost-wiki.setup
+
+Install and conifgure Nginx and host files
+==========================================
+
+Fripost uses [Nginx](http://nginx.org/en/docs/). For installation and
+configuration
+follow [Ikiwiki on Dot CGI](https://ikiwiki.info/tips/dot_cgi/). Note
+the alexjj comment that on Debian the package *fcgiwrap* automatically
+spwans the FastCGI program.
+
+ sudo apt install nginx
+
+The follwing will configure *http://wiki.fripost.localhost* and
+*http://fripost.localhost*:
+
+```
+cat <<EOF | sudo tee /etc/nginx/sites-available/localhost.fripost.conf
+server {
+ listen [::]:80;
+ listen *:80;
+ server_name fripost.localhost;
+ access_log /var/log/nginx/access.log.localhost.fripost.log;
+ error_log /var/log/nginx/error.log.localhost.fripost.log;
+ location / {
+ root $HOME/public_html/fripost-wiki/website;
+ location /static {
+ root $HOME/public_html/fripost-wiki;
+ }
+ }
+}
+
+server {
+ listen [::]:80;
+ listen *:80;
+ server_name wiki.fripost.localhost;
+ access_log /var/log/nginx/access.log.localhost.fripost.wiki.log;
+ error_log /var/log/nginx/error.log.localhost.fripost.wiki.log;
+ location / {
+ root $HOME/public_html/fripost-wiki;
+ }
+}
+EOF
+```
+
+Make available, test and install:
+
+```
+sudo ln -s -r -t /etc/nginx/sites-enabled/ /etc/nginx/sites-available/localhost.fripost.conf
+sudo nginx -t && sudo systemctl restart nginx.service
+```
+
+Modify host files:
+
+```
+cat <<EOF > /tmp/hosts
+
+# Fripost wiki preview setup
+127.0.1.1 wiki.fripost.localhost fripost.localhost
+::1 wiki.fripost.localhost fripost.localhost
+EOF
+grep -q wiki.fripost.localhost /etc/hosts \
+ || { sudo cp /etc/hosts /etc/hosts.bac_$(date +%Y%m%d) \
+ && sudo sed -i '$ r /tmp/hosts' /etc/hosts ; }
+```
+
+Alternatives to Nginx include Apache. Fripost wiki used include
+configuration for Apache, but these are not maintained any
+longer. Brows this repository history for sample configurations.
+
+Refresh wiki
+============
+
+Now all is in place! Visit <http://wiki.fripost.localhost>. Use the
+following commands to refresh or fully rebuild the wiki:
+
+```
+ikiwiki --setup ~/.ikiwiki/fripost-wiki.setup --refresh
+ikiwiki --setup ~/.ikiwiki/fripost-wiki.setup --rebuild
+```
+
+Happy hacking!
diff --git a/create-a-wiki/additional.mdwn b/create-a-wiki/additional.mdwn
new file mode 100644
index 0000000..3c912a8
--- /dev/null
+++ b/create-a-wiki/additional.mdwn
@@ -0,0 +1,64 @@
+---
+title: Additional considerations for a Fripost wiki preview
+...
+
+Here follows a few additional configuration considerations. These are
+not mandatory for a naked preview setup. To follow instructions,
+however, a setup according
+to [Create a Fripost wiki preview](/create-a-wiki-preview) is
+presumed.
+
+[[!toc]]
+
+Absolute paths
+==============
+
+Many links on the Fripost wiki are absolute. That means that you
+sometimes will not be able to follow homepage page and wiki page links
+between your local preview wiki. For testing purposes, that can
+sometimes be necessary. The best strategy is to edit your */etc/hosts*
+table and make *fripost.org* and *wiki.fripost.org* point to
+*localhost*.
+
+Of course your web server need to be configured to serve those
+pages:
+
+```
+cat /etc/nginx/sites-available/localhost.fripost.conf \
+ | sed 's/\.localhost/\.org/g' \
+ | sudo tee /etc/nginx/sites-available/org.fripost.conf
+sudo ln -s -r -t /etc/nginx/sites-enabled/ /etc/nginx/sites-available/org.fripost.conf
+sudo nginx -t && sudo systemctl restart nginx.service
+```
+
+Modify the */etc/hosts* file:
+
+```
+sed -n '/fripost.localhost/ {s/\.localhost/.org/g; p}' < /etc/hosts | sudo tee /tmp/hosts
+grep -q wiki.fripost.org /etc/hosts \
+ || sudo sed -i '/::1.*fripost.localhost/ r /tmp/hosts' /etc/hosts
+```
+
+You might experience strange effects from that the web-browser has
+cached DNS information. Search Internet for how to flush your
+browser's DNS cache.
+
+
+Public www locations (userdir)
+==============================
+
+For to be able to access `http://localhost/~user` the "userdir"
+functionality is needed. For Nginx, put the following in e.g.
+*/etc/nginx/sites-available/localhost*:
+
+```
+server {
+ location ~ ^/~(.+?)(/.*)?$ {
+ alias /home/$1/public_html$2;
+ index index.html index.htm
+ autoindex on;
+ }
+}
+```
+
+This is of limited use in the context of Fripost's wiki.
diff --git a/create-a-wiki.mdwn b/create-a-wiki/create-a-wiki.mdwn
index b6736f1..b6736f1 100644
--- a/create-a-wiki.mdwn
+++ b/create-a-wiki/create-a-wiki.mdwn
diff --git a/create-a-wiki/lab-wiki.mdwn b/create-a-wiki/lab-wiki.mdwn
new file mode 100644
index 0000000..e3f27f8
--- /dev/null
+++ b/create-a-wiki/lab-wiki.mdwn
@@ -0,0 +1,28 @@
+---
+title: Create a fresh laboratory Ikiwiki install
+...
+
+*DRAFT! The article [Create a wiki](create-a-wiki) describes an
+outdated configuration of a fresh Ikiwiki install for laboratory
+purposes. This page is a stab on updating that configuration and
+guide. The update is not finished yet.*
+
+This guide has the history in attempts of the authors to understand
+how Ikiwiki is setup in order to write
+the [Create a Fripost wiki preview](/create-a-wiki-preview). The case
+is useful for those that want to create an fresh Ikiwiki install for
+other purposes, taking Fripost's as a starting point or for those that
+need a safe sandbox lab environment to really hack away.
+
+A setup according to [creation of a preview](/create-a-wiki-preview)
+presumed for preparation of all components.
+
+What we have in mind is to access the wiki, call it Lab wiki, through
+*http://wiki.lab.localhost` for web editing and
+`~/lab-wiki/wiki-slave` for local offline editing.
+
+It should be noted that what is described here probably is a perfectly
+_unsafe_ usage of a web server. Make sure that the computer does not
+except requests from Internet.
+
+*STOP*
diff --git a/index.mdwn b/index.mdwn
index d86ceb8..7c491d3 100644
--- a/index.mdwn
+++ b/index.mdwn
@@ -81,10 +81,8 @@ Tekniskt
* [Fria dokument](documents) – Hur kan man arbeta tillsammans med dokument
* [[Git och Fripost]] – versionshantering med Git och Friposts
Git-baserade projekt
-* [Förhandsgranskning av wikin](wiki-preview) – att förbereda sin miljö
- för förhandsgranskning av wikin
-* [Att skapa en egen labb-wiki](create-a-wiki) – att konstruera en egen
- ikiwiki-uppsättning för laborationer
+* [Skapa en förhandsgranskning av wikin](create-a-wiki-preview) – att förbereda
+ sin egen miljö för förhandsgranskning av wikin
Övrigt
diff --git a/wiki-preview.mdwn b/wiki-preview.mdwn
deleted file mode 100644
index 71cf7d1..0000000
--- a/wiki-preview.mdwn
+++ /dev/null
@@ -1,99 +0,0 @@
-Taking the [Create a Wiki](/create-a-wiki) article as a starting point, this article describes how to set up preview of Friposts wiki.
-
-The basic idea is something like the following:
-
- . Bare Git Repository
- . git.fripost.org:fripost-wiki.git
- . |
- . |
- . Repository for Local Edits
- . ~/git/fripost/wiki
- . |
- . |
- . The Preview Ikiwiki Web Part
- . ~/public_html/fripost-wiki-preview
-
-Where *~/git/fripost/wiki* is a local git repository with remote
-tracking of the main bare wiki repository
-*git.fripost.org:fripost-wiki.git*. I define an alias command for
-recompilation of the local version of the. The local preview version is accessed
-by pointing the browser to
-*http\://localhost/~<name>/fripost-wiki-preview/*.
-
-First the basics. According to [Create a Wiki](/create-a-wiki) do the following:
-
-* Install and configure Git
-* Install and configure Apache 2
-* Install Ikiwiki
-
-For the Ikiwiki configuration question, answer them as follows
-
- wikiname: fripost-wiki-preview
- url: http://localhost/~<name>/lab-wiki
- srcdir: ~/git/fripost/wiki
- destdir: ~/public_html/fripost-wiki-preview
- settings: ~/public_html/fripost-wiki-preview/wiki.setup
-
-Where *<name>* is the local user name and *~/git/fripost/wiki* is where the local wiki Git repository. This will generate a configuration file: *~/public_html/fripost-wiki-preview/wiki.setup*. Generate the first issue:
-
- $ ikiwiki --setup ~/public_html/fripost-wiki-preview/wiki.setup
-
-For to preview local edits, run:
-
- $ ikiwiki --setup ~/public_html/fripost-wiki-preview/wiki.setup --refresh
-
-and point your browser to *http\://localhost/~<name>/fripost-wiki-preview/*.
-
-You can also create an alias for to refresh the preview command.
-
- $ alias fripost-wiki-preview-refresh='ikiwiki -setup /home/gustav/lab-wiki/fripost-wiki.setup -refresh'
-
-
-Public www locations (userdir)
-------------------
-
-For to be able to access `http://localhost/~user` the "userdir"
-functionality is needed. For Nginx, put the following in e.g.
-*/etc/nginx/sites-available/localhost*:
-
-```
-server {
- location ~ ^/~(.+?)(/.*)?$ {
- alias /home/$1/public_html$2;
- index index.html index.htm
- autoindex on;
- }
-}
-```
-
-Relative paths
---------------
-
-Many links on the Fripost wiki are absolute. That means that you
-sometimes will not be able to follow homepage page and wiki page links
-between your local preview wiki. For testing purposes, that can
-sometimes be necessary. The best strategy is to edit your */etc/hosts*
-table and make *fripost.org* and *wiki.fripost.org* point to
-*localhost*. Of course your web server need to be configured to serve
-those pages. This is my Nginx configuration:
-
- # fripost.org
- server {
- server_name fripost.org;
- location / {
- root /home/gustav/public_html/fripost-wiki/website;
- location /static { root /home/gustav/public_html/fripost-wiki; }
- }
- }
-
- # wiki.fripost.org
- server {
- server_name wiki.fripost.org;
- location / {
- root /home/gustav/public_html/fripost-wiki;
- }
- }
-
-You might experience strange effects from that the web-browser has
-cached DNS information. Search Internet for how to flush your
-browser's DNS cache.