permacomputing

Source repository for the main permacomputing wiki site
git clone http://git.permacomputing.net/repos/permacomputing.git # read-only access
Log | Files | Refs

installing.mdwn (7269B)


      1 **TODO: better structure with [[eik]] page and other similar infra info.**
      2 
      3 How does the actual site work?
      4 ------------------------------
      5 
      6 This site and a few other Permacomputing sites run on a small (1GB) VPS generously donated by [[Servus|https://core.servus.at/]]. The physical hardware is located in the [[Statdwerkstatt|https://stwst.at/]] in Linz, Austria.
      7 
      8 We strive to make the site reflect the principles we articulate here, so you probably notice a somewhat "bare bones" design with very few images and no custom fonts or fancy interactive features. 
      9 
     10 The site uses a [[static site generator]] to build HTML versions of the pages only when they are edited. The only dynamic components are the editing and search functions. For our system administration, this makes things much simpler to understand and maintain. 
     11 
     12 
     13 HTTP vs HTTPS
     14 -------------
     15 
     16 It is possible to consult this wiki on port 80, that is to say using <code>http://</code> instead of <code>https://</code>. The reason to keep providing such access is to allow modest but capable computers, as well as simple/legacy browsers, to access the content. Note that when registering, authenticating or editing, you will be redirected to port 443, <code>https://</code>.
     17 
     18 
     19 Local/Offline copies
     20 --------------------
     21 
     22 We use [[ikiwiki]] as wiki compiler. This wiki exists in fact as a collection of plaintext source files that are automatically turned into static HTML files whenever an edit is made to these source files.
     23 
     24 Because these plaintext source files and HTLM files are very portable and easy to copy, you are encouraged to have local copies in order to be less dependent on [[WWW]] or individual server installations.
     25 
     26 See [[cloning]] to learn how to make local/offline copies.
     27 
     28 
     29 Install Notes
     30 -------------
     31 
     32 If you are curious how this was all installed and configured, we took some notes on [[this page|installing]].
     33 
     34 These install notes make the following assumptions: Debian OS, nginx, fcgi-wrap, stagit. Also these are notes, not all the steps are provided, such as restarting nginx, enabling https, etc.
     35 
     36 ## Base installation
     37 
     38     sudo apt install ikiwiki
     39     sudo mkdir /var/www/damaged.bleu255.com-src /var/www/damaged.bleu255.com
     40     sudo chown $USER:$USER /var/www/damaged.bleu255.com*
     41     echo "hello" > /var/www/damaged.bleu255.com-src/index.mdwn
     42     mkdir ~/ikiwiki-cfg
     43     ikiwiki --verbose /var/www/damaged.bleu255.com-src /var/www/damaged.bleu255.com --url=https://damaged.bleu255.com --dumpsetup ~/ikiwiki-cfg/damaged.setup
     44     ikiwiki --setup ~/ikiwiki-cfg/damaged.setup
     45 
     46 ## Configuration changes
     47 
     48 IMPORTANT, any changes to the wiki configuration must be followed by this to reflect changes:
     49 
     50     ikiwiki --setup ~/ikiwiki-cfg/damaged.setup
     51 
     52 ## Enable CGI
     53 
     54     # ~/ikiwiki-cfg/damaged.setup
     55     cgiurl: 'https://damaged.bleu255.com/ikiwiki.cgi'
     56     cgi_wrapper: '/var/www/damaged.bleu255.com/ikiwiki.cgi'
     57 
     58     # /etc/nginx/sites-available/damages.bleu255.com
     59     server {
     60       listen 443;
     61     
     62       server_name damaged.bleu255.com;
     63 
     64       root /var/www/damaged.bleu255.com;
     65       index index.html index.htm;
     66       access_log /var/log/nginx/damaged.bleu255.com-access.log;
     67       error_log /var/log/nginx/damaged.bleu255.com-error.log;
     68 
     69       location / {
     70         try_files $uri $uri/ =404;
     71       }
     72 
     73       # Max size of file upload
     74       client_max_body_size 10m;
     75 
     76       location /ikiwiki.cgi {
     77         gzip off;
     78         fastcgi_pass unix:/var/run/fcgiwrap.socket;
     79         fastcgi_index ikiwiki.cgi;
     80         fastcgi_param SCRIPT_FILENAME /var/www/damaged.bleu255.com/ikiwiki.cgi;
     81         fastcgi_param DOCUMENT_ROOT /var/www/damaged.bleu255.com/;
     82         include /etc/nginx/fastcgi_params;
     83       }
     84     }
     85 
     86 ## Enable git
     87 
     88     ikiwiki-makerepo git /var/www/damaged.bleu255.com-src /var/www/git.bleu255.com/repos/damaged.bleu255.com.git
     89 
     90     # ~/ikiwiki-cfg/damaged.setup
     91     rcs: 'git'
     92 
     93     ikiwiki --changesetup ~/ikiwiki-cfg/damaged.setup
     94 
     95     # ~/ikiwiki-cfg/damaged.setup
     96     git_wrapper: /var/www/git.bleu255.com/repos/damaged.bleu255.com.git/hooks/post-update
     97     git_wrapper_background_command: git push
     98 
     99     ikiwiki --setup ~/ikiwiki-cfg/damaged.setup
    100     cd /var/www/damaged.bleu255.com-src
    101     git config pull.rebase false
    102 
    103 ## stagit hooks and stagit diff URLs
    104 
    105     cd /var/www/git.bleu255.com/repos/damaged.bleu255.com.git/hooks
    106     ln -s ../../../update_single.sh post-receive
    107 
    108     # ~/ikiwiki-cfg/damaged.setup
    109     diffurl: https://git.bleu255.com/damaged.bleu255.com/commit/\[\[sha1_commit\]\].html
    110 
    111 
    112 ## Limited web access
    113 
    114 There are 2 ways to deal with user:pass for web access (if we rule out external auth like openid):
    115 
    116 * outsource it to httpd-auth, implies that someone has to maintain the list of users and their passwd manually 
    117 * or add a password prompt during account creation, something we'd share with only trusted people, or people showing interest, etc. We choose this approach
    118 
    119     # ~/ikiwiki-cfg/damaged.setup
    120     account_creation_password: pa55w0rd
    121     ikiwiki --setup ~/ikiwiki-cfg/damaged.setup
    122 
    123 ## Support for sending emails
    124 
    125 Useful to reset passwords, etc.
    126 
    127     sudo apt install libmail-sendmail-perl
    128     
    129     # ~/ikiwiki-cfg/damaged.setup
    130     adminemail: yolo29383@hotmail.com
    131 
    132     ikiwiki --setup ~/ikiwiki-cfg/damaged.setup
    133 
    134 ## Stronger password hashes
    135 
    136     sudo apt install libauthen-passphrase-perl
    137 
    138     # ~/ikiwiki-cfg/damaged.setup
    139     password_cost: 16
    140 
    141 ## Disable OpenID and emailauth
    142 
    143     ikiwiki --setup ikiwiki-cfg/damaged.setup --disable-plugin openid
    144     ikiwiki --setup ikiwiki-cfg/damaged.setup --disable-plugin emailauth
    145 
    146     # ~/ikiwiki-cfg/damaged.setup
    147     disable_plugins: [emailauth, openid]
    148 
    149 ## Default git commit message when none provided
    150 
    151 Ikiwiki and a recent enough version of git allow for empty git messages (the "Optional description of this change" while editing on the web), that's nice but it makes stagit history impossible to browse because it uses such messages as links. To make ikiwiki provide a default commit message when non given, you can do this:
    152 
    153     diff --git a/git.pm.old b/git.pm
    154     index 2bc2500..2198207 100644
    155     --- a/git.pm.old
    156     +++ b/git.pm
    157     @@ -680,21 +680,8 @@ sub rcs_commit_helper (@) {
    158             $params{message} = IkiWiki::possibly_foolish_untaint($params{message});
    159             my @opts;
    160             if ($params{message} !~ /\S/) {
    161     -               # Force git to allow empty commit messages.
    162     -               # (If this version of git supports it.)
    163     -               my ($version)=`git --version` =~ /git version (.*)/;
    164     -               if ($version ge "1.7.8") {
    165     -                       push @opts, "--allow-empty-message", "--no-edit";
    166     -               }
    167     -               if ($version ge "1.7.2") {
    168     -                       push @opts, "--allow-empty-message";
    169     -               }
    170     -               elsif ($version ge "1.5.4") {
    171     -                       push @opts, '--cleanup=verbatim';
    172     -               }
    173     -               else {
    174     -                       $params{message}.=".";
    175     -               }
    176     +               # Force a message to commit if none given.
    177     +               $params{message}.="empty web commit";
    178             }
    179             if (exists $params{file}) {
    180                     push @opts, '--', $params{file};
    181 
    182