Differences

This shows you the differences between two versions of the page.

Link to this comparison view

dcss:server:setting_up_dgamelaunch_and_webtiles [2020-01-08 19:06]
araganzar
dcss:server:setting_up_dgamelaunch_and_webtiles [2021-06-16 21:44] (current)
gammafunk [13. Other notes]
Line 1: Line 1:
 ====== Setting Up dgamelaunch and WebTiles ====== ====== Setting Up dgamelaunch and WebTiles ======
  
-WORK IN PROGRESS -- Last edited by floraline 2018-06-14 [Build on Ubuntu 14.04/Debian9]+WORK IN PROGRESS -- Last edited by advil apr 2020 [Build on Ubuntu 18.04]
  
 This document describes how to set up an official Crawl server with support for webtiles and console, automatic updates, This document describes how to set up an official Crawl server with support for webtiles and console, automatic updates,
 Sequell/scoring integration, and public ttyrecs.  If you just want to run a webtiles server for friends and coworkers, the process is much simpler: see [[http://s-z.org/neil/git/?p=crawl.git;a=blob;f=crawl-ref/source/webserver/README|webserver/README]] in the Crawl source. Sequell/scoring integration, and public ttyrecs.  If you just want to run a webtiles server for friends and coworkers, the process is much simpler: see [[http://s-z.org/neil/git/?p=crawl.git;a=blob;f=crawl-ref/source/webserver/README|webserver/README]] in the Crawl source.
 +
 +This page corresponds to a set of scripts in the official dgamelaunch-config repository that build and test a container following the core steps illustrated here. See [[https://github.com/crawl/dgamelaunch-config/blob/master/utils/testing-container/README.md]], [[https://github.com/crawl/dgamelaunch-config/blob/master/utils/build-testing-container.sh]], etc.
  
 For debugging issues related to this setup or a running server, see [[maintaining_dgamelaunch_and_webtiles|maintaining dgamelaunch and webtiles]]. For debugging issues related to this setup or a running server, see [[maintaining_dgamelaunch_and_webtiles|maintaining dgamelaunch and webtiles]].
Line 11: Line 13:
 Create the users ''crawl'' and ''crawl-dev'', with their associated user groups. The former will be used for running crawl, and the latter for administering it. Create the users ''crawl'' and ''crawl-dev'', with their associated user groups. The former will be used for running crawl, and the latter for administering it.
  
-  ~$ sudo adduser crawl +  sudo adduser crawl 
-  ~$ sudo adduser crawl-dev+  sudo adduser crawl-dev
  
 Write down the ''uid'' and ''gid'' for these users, you will need it later Write down the ''uid'' and ''gid'' for these users, you will need it later
  
-  ~$ id crawl +  id crawl 
-  ~$ id crawl-dev+  id crawl-dev
  
 These groups and permissions will save a lot of headaches: These groups and permissions will save a lot of headaches:
  
-  ~$ sudo usermod -G root -a crawl +  sudo usermod -G root -a crawl 
-  ~$ sudo usermod -G root -a crawl-dev +  sudo usermod -G root -a crawl-dev 
-  ~$ sudo usermod -G www-data -a crawl +  sudo usermod -G www-data -a crawl 
-  ~$ sudo usermod -G www-data -a crawl-dev +  sudo usermod -G www-data -a crawl-dev 
-  ~$ sudo usermod -G crawl -a root +  sudo usermod -G crawl -a root 
-  ~$ sudo usermod -G crawl -a www-data +  sudo usermod -G crawl -a www-data 
-  ~$ sudo usermod -G crawl-dev -a root +  sudo usermod -G crawl-dev -a root 
-  ~$ sudo usermod -G crawl-dev -a www-data+  sudo usermod -G crawl-dev -a www-data
  
 ====1. Set up chroot==== ====1. Set up chroot====
 Set up a chroot in ''/home/crawl/DGL/''.  On Debian-like systems you can do: Set up a chroot in ''/home/crawl/DGL/''.  On Debian-like systems you can do:
  
-  ~$ debootstrap stable /home/crawl/DGL/+  debootstrap stable /home/crawl/DGL/
  
-Ubuntu users should change 'stable' to match their build env (e.g. 'precise' for 12.04'trustyfor 14.04)+Ubuntu users should change 'stable' to match their build env (e.g. 'bionic' for ubuntu 18.04). If you are running this within a docker container, this step will fail unless the container was started with ''--privileged''.
  
-//note from espais//+On Ubuntu 18 and later, the chroot will not yet be able to use apt. Use the following steps to finish setting up the chroot (as recommended by https://wiki.ubuntu.com/DebootstrapChroot):
  
-If you are using Ubuntu 18, the default repositories list within chroot does not contain the appropriate sources This will cause liblua5.1 to not be found.  An easy fix is to copy the /etc/apt/sources.list from the server to within the chroot.  For instance:+  sudo cp /etc/resolv.conf /home/crawl/DGL/etc/resolv.conf 
 +  sudo cp /etc/apt/sources.list /home/crawl/DGL/etc/apt/
  
-  ~$ sudo mv /home/crawl/DGL/etc/apt/source.list /home/crawl/DGL/etc/apt/source.list.bak +If you are using a different distribution in your chroot than the outer distribution (not really covered by this guide) you will then need to edit ''sources.list'' to change the distribution name; see the ubuntu debootstrap guide linked above for further details.
-  ~$ sudo cp /etc/apt/sources.list /home/crawl/DGL/etc/apt/. +
-   +
-// note from araganzar // I believe you need to change source.list above to sources.list +
 ====2. Install prerequisites==== ====2. Install prerequisites====
 Install some prerequisites into the chroot.  Besides the base system that debootstrap installed, you need the libraries for running crawl, bzip2 for compressing save backups, the sqlite3 binary for interfacing with the user and version databases, locales, terminal definitions, and a minimal install of python (because character codecs are loaded at runtime). For Debian* systems: Install some prerequisites into the chroot.  Besides the base system that debootstrap installed, you need the libraries for running crawl, bzip2 for compressing save backups, the sqlite3 binary for interfacing with the user and version databases, locales, terminal definitions, and a minimal install of python (because character codecs are loaded at runtime). For Debian* systems:
  
-  ~$ sudo chroot /home/crawl/DGL/ +  sudo chroot /home/crawl/DGL/
  
 This enters the environment in which crawl will run. This enters the environment in which crawl will run.
 After running this then install packages as root of the chroot: After running this then install packages as root of the chroot:
  
-  ~# apt update && apt upgrade +  apt update && apt upgrade 
-  ~# apt install bzip2 python-minimal ncurses-term locales-all sqlite3 libpcre3 liblua5.1-0 locales autoconf build-essential lsof bison libncursesw5-dev libsqlite3-dev flex sudo libbot-basicbot-perl+  apt install bzip2 python-minimal ncurses-term locales-all sqlite3 libpcre3 liblua5.1-0 locales autoconf build-essential lsof bison libncursesw5-dev libsqlite3-dev flex sudo libbot-basicbot-perl
      
 **Xenial note:** If you can't find ''locales-all'' or ''libbot-basicbot-perl'', you probably need to enable ''universe'' packages with ''add-apt-repository universe && apt update''. If you don't have ''add-apt-repository'', you'll need to install ''software-properties-common'', or edit ''/etc/apt/sources.list'' manually to enable ''universe'' packages. **Xenial note:** If you can't find ''locales-all'' or ''libbot-basicbot-perl'', you probably need to enable ''universe'' packages with ''add-apt-repository universe && apt update''. If you don't have ''add-apt-repository'', you'll need to install ''software-properties-common'', or edit ''/etc/apt/sources.list'' manually to enable ''universe'' packages.
  
-// note from araganzar // On Ubuntu 14.04 I was unable to find locales-all even after checking universe is in sources.list.  Was also unable to install the add-apt-repository package even after adding software-properties-common.   Upgrading to 16.04 resolved these issues.  You will also want to install vim and git using apt-get install if you don't have them.   +// note from araganzar // On Ubuntu 14.04 I was unable to find locales-all even after checking universe is in sources.list.  Was also unable to install the add-apt-repository package even after adding software-properties-common.   Upgrading to 16.04 resolved these issues.  You will also want to install vim and git using apt-get install if you don't have them. For crawl install, you also need to install libxtst-dev and libpng++-dev
- +
-For crawl install, you also need to install libxtst-dev and libpng++-dev +
  
  
 Once all required packages are installed, generate locales and users: Once all required packages are installed, generate locales and users:
  
-  ~# locale-gen en_US.UTF-8 +  locale-gen en_US.UTF-8 
-  ~# dpkg-reconfigure locales +  dpkg-reconfigure locales 
-  ~# adduser crawl +  adduser crawl 
-  ~# adduser crawl-dev+  adduser crawl-dev
  
 //note from geekosaur// //note from geekosaur//
Line 76: Line 74:
 Change uid and gid to match the previous uid and gid: Change uid and gid to match the previous uid and gid:
  
-  ~# usermod -u NEW_UID <username> +  usermod -u NEW_UID <username> 
-  ~# groupmod -g <NEW_GID> <groupname>+  groupmod -g <NEW_GID> <groupname>
  
 Exit the chroot. Exit the chroot.
  
-  ~# exit+  exit
  
 * Ubuntu is similar: ~# chroot /home/crawl/DGL apt-get ... * Ubuntu is similar: ~# chroot /home/crawl/DGL apt-get ...
Line 87: Line 85:
 Note: Note:
   *If you're interested in reducing bandwidth at the expense of a little bit of rebuild time, you can install ''advancecomp'' and ''pngcrush'' on the host system. The makefile will automatically detect those and use them to optimise/recompress the tilesheets.   *If you're interested in reducing bandwidth at the expense of a little bit of rebuild time, you can install ''advancecomp'' and ''pngcrush'' on the host system. The makefile will automatically detect those and use them to optimise/recompress the tilesheets.
 +  *If you're building things from a very clean image, you may also have needed some basic prerequisites in the outer OS, e.g. ''apt install sudo git build-essential autoconf automake bison libncursesw5-dev flex liblua5.1-0-dev libsqlite3-dev libz-dev pkg-config python3 python3-pip python3-yaml ccache libpng-dev sqlite3 libpcre3 libpcre3-dev apache2'', possibly others. The in-repository CI setup code is usually a good guide to the minimal package set here. (TODO: expand)
 +  *''pip3 install tornado''. (This will install tornado 6, which is supported, but in some circumstances you may wish to install earlier versions.)
 +  *For modern versions of tornado, you will have to get the library duplicated into the chroot as well. If you are sticking with python-minimal, the quickest way to do this on the instructions here, using ubuntu 18.04, is, ''cp -R /usr/local/lib/python3.6/dist-packages/tornado/ /home/crawl/DGL/usr/local/lib/python3.6/dist-packages/''. 
  
 ====3. Mount /proc and /dev/pts==== ====3. Mount /proc and /dev/pts====
 Various programs running in the chroot will need /proc and /dev/pts, so mount those.  It's probably best to add them to your system's fstab so they're mounted on boot: Various programs running in the chroot will need /proc and /dev/pts, so mount those.  It's probably best to add them to your system's fstab so they're mounted on boot:
  
-  ~$ sudo vim /etc/fstab+  sudo vim /etc/fstab
      
 You can **either** mount the filesystems directly: You can **either** mount the filesystems directly:
Line 107: Line 108:
 Either way, these lines should come after the existing entries for your host system's /proc and /dev/pts.  Now you should be able to mount them with just the name. Either way, these lines should come after the existing entries for your host system's /proc and /dev/pts.  Now you should be able to mount them with just the name.
  
-  ~# mount /home/crawl/DGL/proc +  mount /home/crawl/DGL/proc 
-  ~# mount /home/crawl/DGL/dev/pts+  mount /home/crawl/DGL/dev/pts
  
 NOTE: Root can trivially escape a chroot using /proc/1/cwd ! NOTE: Root can trivially escape a chroot using /proc/1/cwd !
Line 114: Line 115:
 You'll also need to make sure your 'crawl' user can write to /dev/ptmx inside the chroot: You'll also need to make sure your 'crawl' user can write to /dev/ptmx inside the chroot:
  
-  ~# chmod 666 /home/crawl/DGL/dev/ptmx+  chmod 666 /home/crawl/DGL/dev/ptmx
  
 +//Docker note//: you may want to accomplish the mounts in this section via an entrypoint script rather than ''/etc/fstab'' (which isn't even used for e.g. ubuntu umages). The following is a complete script which can be used as an entrypoint script or run manually when starting up the container to minimally start webtiles and dgl; obviously the init.d commands will not actually work until later in these instructions.
 +
 +  #!/bin/bash
 +  mount --bind /proc/ /home/crawl/DGL/proc/
 +  mount --bind /dev/pts/ /home/crawl/DGL/dev/pts/
 +  /etc/init.d/ssh start
 +  /etc/init.d/webtiles start
 ====4. Create crawl-dev dirs==== ====4. Create crawl-dev dirs====
 Make the directories /home/crawl-dev/logs and /home/crawl-dev/run, owned by and writable by crawl-dev.  Unless noted otherwise, subsequent commands should be run by user crawl-dev. Make the directories /home/crawl-dev/logs and /home/crawl-dev/run, owned by and writable by crawl-dev.  Unless noted otherwise, subsequent commands should be run by user crawl-dev.
  
-  ~# su crawl-dev +  su crawl-dev 
-  ~# mkdir /home/crawl-dev/logs +  mkdir /home/crawl-dev/logs 
-  ~# mkdir /home/crawl-dev/run+  mkdir /home/crawl-dev/run
  
 ====5. Download dgamelaunch==== ====5. Download dgamelaunch====
-Check out the cszo branch of ''dgamelaunch'' and ''dgamelaunch-config'' as crawl-dev user.  You might also want a copy of Sizzell if you intent to announce milestones and games in IRC.+Check out the master branch of ''dgamelaunch'' and ''dgamelaunch-config'' as the crawl-dev user.  You might also want a copy of Sizzell if you intent to announce milestones and games in IRC.
  
 # TODO: publish dgamelaunch and sizzell branches # TODO: publish dgamelaunch and sizzell branches
  
-  ~$ cd +  cd 
-  ~$ git clone -b szorg git://github.com/neilmoore/dgamelaunch.git +  git clone git://github.com/crawl/dgamelaunch.git 
-  ~$ git clone -b szorg git://github.com/neilmoore/dgamelaunch-config.git +  git clone git://github.com/crawl/dgamelaunch-config.git 
-  ~$ git clone git://github.com/neilmoore/sizzell.git+  git clone git://github.com/crawl/sizzell.git
  
 +//historical note//: the ''crawl'' org version of dgamelaunch-config is not what most servers have used in the past: see https://github.com/neilmoore/dgamelaunch-config/. However, this guide is most recently verified (by advil) to work with this newly official version.
 ====6. Build dgamelaunch==== ====6. Build dgamelaunch====
-Build ''dgamelaunch''; copy the binary into ''/usr/local/sbin/'' on your main system, and the ee and virus binaries into ''/bin'' on the chroot. 
- 
-  ~$ cd dgamelaunch 
-  ~$ git checkout szorg 
-  ~$ ./autogen.sh --enable-debugfile --enable-sqlite --enable-shmem 
- 
-Edit the Makefile and add ''-pthread'' to ''LIBS='': 
- 
-  ~$ vim Makefile 
- 
 Build ''dgamelaunch'': Build ''dgamelaunch'':
  
-  ~$ sudo make VIRUS=1+  cd dgamelaunch 
 +  ./autogen.sh --enable-debugfile --enable-sqlite --enable-shmem 
 +  make
  
-If you get ''fatal error: curses.h: No such file or directory'', edit the makefile and add ''-I/usr/include/ncursesw'' to ''CFLAGS=''.+Copy the binary into ''/usr/local/sbin/'' on your main systemand the ''ee'' and ''virus'' binaries into ''/bin'' on the chroot:
  
-Copy the binary into /usr/local/sbin/ on your main system, and the ee and virus binaries into /bin on the chroot: +  sudo make install 
- +  sudo cp ee virus /home/crawl/DGL/bin
-  ~$ sudo make install +
-  ~$ sudo cp ee virus /home/crawl/DGL/bin+
  
 ====7. Configure sudo access==== ====7. Configure sudo access====
-  ~$ sudo visudo+  sudo visudo
  
 Give user ''crawl-dev'' permission to run ''dgl'' binary with sudo. We'll also need permissions for a few additional scripts, as well as webtiles. Give user ''crawl-dev'' permission to run ''dgl'' binary with sudo. We'll also need permissions for a few additional scripts, as well as webtiles.
Line 182: Line 181:
  
 ====8. Configure dgamelaunch-config==== ====8. Configure dgamelaunch-config====
-Check out branch "szorg" of dgamelaunch-config and look over the various configuration files.  You may wish to change directory names etc. +Look over the various configuration files.  You may wish to change directory names etc.
- +
-  ~$ cd ../dgamelaunch-config +
-  ~$ view dgl-manage.conf crawl-git.conf dgamelaunch.conf config.py +
- +
-You might want to remove the entries for rfk, atc, and boggle.  If you do, also edit the menus under chroot/data/menus/ +
-You definitely need to change the uid= and gid= lines in config.py (the webtiles config) to match the numeric IDs of the 'crawl' user. Likewise shed_uid and shed_gid in dgamelaunch.conf. +
- +
-  ~$ vim config.py +
- +
-  *Edit ip addresses, ssl certs, server names, which game modes you want to support, and run on port 8080 for non-ssl, make sure uid and guid of crawl user too! +
-  *Setting up SSL, assuming you know cert files, bundles or appending them as a .pem, and private server key  +
-  *create directory www/crawl_ssl in the chroot. Store files there and point to /var/www/crawl_ssl/file in ssl options. +
-  *Make sure ssl options is set to ''None'' if you are not using ssl, or webtiles will not start+
  
-  ~$ vim crawl-git.conf+  cd ../dgamelaunch-config 
 +  view dgl-manage.conf crawl-git.conf dgamelaunch.conf config.py
  
-  *Change the gitourious link to this link: %%https://github.com/crawl/crawl.git%%+  vim config.py
  
-  ~$ vim dgamelaunch.conf+  * Edit ip addresses, ssl certs, server names, which game modes you want to support, and run on port 8080 for non-ssl. //Docker note (possibly mac-specific):// You may need to bind address to 0.0.0.0 rather than 127.0.0.1 in order to successfully expose the port to the docker host. 
 +  * Make sure ssl options is set to ''None'' if you are not using ssl, or webtiles will not start; this is the default in the dgamelaunch-config repository. //It is strongly recommended that you use SSL on a production server//, but setting this up fully is beyond the scope of this guide. 
 +  * Setting up SSL, assuming you know cert files, bundles or appending them as a .pem, and private server key9 
 +  * create directory www/crawl_ssl in the chroot. Store files there and point to /var/www/crawl_ssl/file in ssl options.
  
-  *Server name, shed_guid and shed_uid to be aligned with crawl+  vim dgamelaunch.conf
  
-  ~$ vim dgl-manage.conf+  vim dgl-manage.conf
  
   *Edit DGL_SERVER and uid to match crawl   *Edit DGL_SERVER and uid to match crawl
 +  *Modify contents of ''/home/crawl-dev/dgamelaunch-config/chroot/data'' as appropriate for your server and versions. This involves copying and manually editing files as appropriate. (TODO: expand on this)
  
 Exit crawl-dev: Exit crawl-dev:
  
-  ~$ exit+  exit
  
 ====9. Create directories==== ====9. Create directories====
 Make the needed directories.  There are a bunch, and I've probably forgotten some, but at the very least you need the following under the chroot ''/home/crawl/DGL/''. Make the needed directories.  There are a bunch, and I've probably forgotten some, but at the very least you need the following under the chroot ''/home/crawl/DGL/''.
  
-  ~$ cd /home/crawl/DGL +  cd /home/crawl/DGL 
-  ~$ sudo mkdir crawl-master +  sudo mkdir crawl-master 
-  ~$ sudo mkdir crawl-master/webserver/ +  sudo mkdir crawl-master/webserver/ 
-  ~$ sudo mkdir crawl-master/webserver/run/ +  sudo mkdir crawl-master/webserver/run/ 
-  ~$ sudo mkdir crawl-master/webserver/sockets/ +  sudo mkdir crawl-master/webserver/sockets/ 
-  ~$ sudo mkdir crawl-master/webserver/templates/ +  sudo mkdir crawl-master/webserver/templates/ 
-  ~$ sudo mkdir dgldir +  sudo mkdir dgldir 
-  ~$ sudo mkdir dgldir/data/ +  sudo mkdir dgldir/data/ 
-  ~$ sudo mkdir dgldir/dumps/ +  sudo mkdir dgldir/dumps/ 
-  ~$ sudo mkdir dgldir/morgue/ +  sudo mkdir dgldir/morgue/ 
-  ~$ sudo mkdir dgldir/rcfiles/ +  sudo mkdir dgldir/rcfiles/ 
-  ~$ sudo mkdir dgldir/ttyrec/ +  sudo mkdir dgldir/ttyrec/ 
-  ~$ sudo mkdir dgldir/data/menus/ +  sudo mkdir dgldir/data/menus/ 
-  ~$ sudo mkdir dgldir/inprogress/+  sudo mkdir dgldir/inprogress/
  
 You will also need the following set of directories for each crawl version you will support: You will also need the following set of directories for each crawl version you will support:
  
-  ~$ sudo mkdir dgldir/inprogress/crawl-git-sprint/ +  sudo mkdir dgldir/inprogress/crawl-git-sprint/ 
-  ~$ sudo mkdir dgldir/inprogress/crawl-git-tut/ +  sudo mkdir dgldir/inprogress/crawl-git-tut/ 
-  ~$ sudo mkdir dgldir/inprogress/crawl-git-zotdef/ +  sudo mkdir dgldir/inprogress/crawl-git-zotdef/ 
-  ~$ sudo mkdir dgldir/inprogress/crawl-git/ +  sudo mkdir dgldir/inprogress/crawl-git/ 
-  ~$ sudo mkdir dgldir/rcfiles/crawl-git/ +  sudo mkdir dgldir/rcfiles/crawl-git/ 
-  ~$ sudo mkdir dgldir/data/crawl-git-settings/+  sudo mkdir dgldir/data/crawl-git-settings/
  
 For example: For example:
  
-  ~$ sudo mkdir dgldir/inprogress/crawl-17-sprint/ +  sudo mkdir dgldir/inprogress/crawl-24-sprint/ 
-  ~$ sudo mkdir dgldir/inprogress/crawl-17-tut/ +  sudo mkdir dgldir/inprogress/crawl-24-tut/ 
-  ~$ sudo mkdir dgldir/inprogress/crawl-17-zotdef/ +  sudo mkdir dgldir/inprogress/crawl-24-zotdef/ 
-  ~$ sudo mkdir dgldir/inprogress/crawl-17+  sudo mkdir dgldir/inprogress/crawl-24
-  ~$ sudo mkdir dgldir/rcfiles/crawl-0.17+  sudo mkdir dgldir/rcfiles/crawl-0.24
-  ~$ sudo mkdir dgldir/data/crawl-0.17-settings/+  sudo mkdir dgldir/data/crawl-0.24-settings/
  
 They should all be writable by user 'crawl', and the morgues, ttyrecs, and rcfiles should probably be readable by your web server. They should all be writable by user 'crawl', and the morgues, ttyrecs, and rcfiles should probably be readable by your web server.
Line 253: Line 244:
 DO NOT chown the whole chroot: various programs and directories inside the chroot need to be owned by root or other users. DO NOT chown the whole chroot: various programs and directories inside the chroot need to be owned by root or other users.
  
-  ~$ sudo chown -R crawl:crawl crawl-master +  sudo chown -R crawl:crawl crawl-master 
-  ~$ sudo chown -R crawl:crawl dgldir+  sudo chown -R crawl:crawl dgldir
  
 Also create the file ''dgamelaunch'' directly under the chroot; it will be used as a shared memory key. Contents don't matter. Also create the file ''dgamelaunch'' directly under the chroot; it will be used as a shared memory key. Contents don't matter.
  
-  ~$ sudo touch /home/crawl/DGL/dgamelaunch+  sudo touch /home/crawl/DGL/dgamelaunch
  
 If you want debug messages, also create the file ''dgldebug.log'' and make it writable for crawl. Warning, the file has a reputation of not being incredibly useful: If you want debug messages, also create the file ''dgldebug.log'' and make it writable for crawl. Warning, the file has a reputation of not being incredibly useful:
  
-  ~$ sudo touch /home/crawl/DGL/dgldebug.log +  sudo touch /home/crawl/DGL/dgldebug.log 
-  ~$ sudo chown crawl:crawl /home/crawl/DGL/dgldebug.log+  sudo chown crawl:crawl /home/crawl/DGL/dgldebug.log
  
 Finally, ensure that user crawl has write access to ''/var/mail'' so that console messages can be sent. Finally, ensure that user crawl has write access to ''/var/mail'' so that console messages can be sent.
Line 270: Line 261:
 Create the crawl versions database and the save and data directories for trunk: Create the crawl versions database and the save and data directories for trunk:
  
-  ~$ sudo /home/crawl-dev/dgamelaunch-config/bin/dgl create-versions-db +  sudo /home/crawl-dev/dgamelaunch-config/bin/dgl create-versions-db 
-  ~$ sudo /home/crawl-dev/dgamelaunch-config/bin/dgl create-crawl-gamedir+  sudo /home/crawl-dev/dgamelaunch-config/bin/dgl create-crawl-gamedir
  
 Copy the resulting crawl-git directory for each other version you will support: Copy the resulting crawl-git directory for each other version you will support:
  
-  ~$ cd /home/crawl/DGL/crawl-master +  cd /home/crawl/DGL/crawl-master 
-  ~$ sudo cp -a ./crawl-git ./crawl-0.17+  sudo cp -a ./crawl-git ./crawl-0.24
  
 ====10. Publish dgamelaunch configs==== ====10. Publish dgamelaunch configs====
 Publish the configs into the chroot (and the dgamelaunch config into /etc). Publish the configs into the chroot (and the dgamelaunch config into /etc).
  
-  ~$ sudo /home/crawl-dev/dgamelaunch-config/bin/dgl publish --confirm+  sudo /home/crawl-dev/dgamelaunch-config/bin/dgl publish --confirm
  
 ====11. Install crawl==== ====11. Install crawl====
 Try installing your crawl versions (run as user crawl-dev): Try installing your crawl versions (run as user crawl-dev):
  
-  ~$ /home/crawl-dev/dgamelaunch-config/bin/dgl update-stable 0.17 +  /home/crawl-dev/dgamelaunch-config/bin/dgl update-trunk 
-  ~$ /home/crawl-dev/dgamelaunch-config/bin/dgl update-trunk+  /home/crawl-dev/dgamelaunch-config/bin/dgl update-stable 0.24
  
 Notes: Notes:
Line 296: Line 287:
 Webtiles require an UTF-8 locale: Webtiles require an UTF-8 locale:
  
-  ~$ sudo update-locale LANG=en_US.UTF-8+  sudo update-locale LANG=en_US.UTF-8
  
-I add this line to the beginning, so I have a log of all +I add this line to the beginning, so I have a log of all updates:
-updates: +
-     exec >> /home/crawl-dev/logs/update.log 2>&1+
  
-===11.2 HTML templates=== +  exec >> /home/crawl-dev/logs/update.log 2>&1
-Currently, you will need to copy and edit the html files from the git repo to the templates directory in the chroot +
- +
-  ~$ sudo cp /home/crawl-dev/dgamelaunch-config/crawl-build/crawl-git-repository/crawl-ref/source/webserver/templates/*.html /home/crawl/DGL/crawl-master/webserver/templates/+
  
 Exit crawl user: Exit crawl user:
  
-  ~$ exit+  exit
  
 ====12. Create symlinks==== ====12. Create symlinks====
Line 316: Line 302:
 Create a folder named ''crawl'' Create a folder named ''crawl''
  
-  ~$ mkdir /var/www/crawl+  mkdir /var/www/crawl
  
 In ''/var/www/crawl'', create symlinks In ''/var/www/crawl'', create symlinks
  
-  ~$ cd /var/www/crawl +  cd /var/www/crawl 
-  ~$ sudo ln -s /home/crawl/DGL/dgldir/morgue/ +  sudo ln -s /home/crawl/DGL/dgldir/morgue/ 
-  ~$ sudo ln -s /home/crawl/DGL/dgldir/rcfiles/ +  sudo ln -s /home/crawl/DGL/dgldir/rcfiles/ 
-  ~$ sudo ln -s /home/crawl/DGL/dgldir/ttyrec/+  sudo ln -s /home/crawl/DGL/dgldir/ttyrec/
  
 ===12.5 Apache configuration=== ===12.5 Apache configuration===
Line 330: Line 316:
 On Debian: On Debian:
  
-  ~$ sudo a2enmod rewrite +  sudo a2enmod rewrite 
-  ~$ sudo service apache2 reload+  sudo service apache2 reload
      
-// note from araganzar // - Apache 2.4 and later has different access rules - http://httpd.apache.org/docs/2.4/upgrading.html#access +// note from araganzar // - Apache 2.4 and later has different access rules - http://httpd.apache.org/docs/2.4/upgrading.html#accessYou no longer use "Order allow,deny" and "Allow from all", these should be replaced with "Require all granted" - or "Require all denied" if the 2nd directive is "Deny from all"
- +
-You no longer use "Order allow,deny" and "Allow from all", these should be replaced with "Require all granted" - or "Require all denied" if the 2nd directive is "Deny from all"+
  
 ~Apache Configuration in full~ ~Apache Configuration in full~
Line 394: Line 378:
     SSLEngine on     SSLEngine on
      
-    SSLCertificateFile /var/www/crawl_ssl/.crt+    SSLCertificateFile9/var/www/crawl_ssl/.crt
     SSLCertificateKeyFile /var/www/crawl_ssl/server.key     SSLCertificateKeyFile /var/www/crawl_ssl/server.key
     SSLCertificateChainFile /var/www/crawl_ssl/.ca-bundle     SSLCertificateChainFile /var/www/crawl_ssl/.ca-bundle
Line 423: Line 407:
 Restart apache Restart apache
  
-  ~$ sudo service apache2 reload+  sudo service apache2 reload
  
 ===12.6 Start webtiles=== ===12.6 Start webtiles===
 Start Webtiles as crawl-dev via: Start Webtiles as crawl-dev via:
  
-  ~$ sudo /etc/init.d/webtiles start+  sudo /etc/init.d/webtiles start 
 + 
 +//docker  note//: at this point, to test out webtiles you will need to connect to the relevant port (probably 80 or 8080) on your container. The best practice for doing that (which is required on a mac) is to expose the relevant port to the host with the command line argument like ''-p 8080:8080''. If you didn't do this when you first started the container, commit your current state, stop the container, and restart it with this command. (Don't forget that you will need to rebuild your chroot mounts when restarting the container.)
  
 ==Troubleshooting Notes:== ==Troubleshooting Notes:==
 +
 +If nothing happens and the server doesn't start up, disable daemonizing in the chroot copy of `config.py` and run the webserver directly from `/home/crawl/DGL/crawl-master/webserver/`; this will allow you to see the crash. Keep in mind that if you run `dgl publish` during this sort of troubleshooting, it'll wipe out config.py in this directory.
 +
 +//Important note//: the following troubleshooting note is deprecated and you shouldn't be using a version of tornado < 5. However, I'll keep it here for a little while just in case:
 +
 +If you get:
  
 <code> <code>
Line 438: Line 430:
 </code> </code>
  
-  *Need to install edlothiol's patch for Tornado. As crawl-dev, from /home/crawl-dev:+You need to install edlothiol's patch for Tornado. As crawl-dev, from /home/crawl-dev:
  
-  ~$ fetch git://github.com/flodiebold/tornado.git into /home/crawl-dev/tornado +  su crawl-dev 
-  ~$ git checkout http-timeouts-2.4 +  cd 
-  ~$ python setup.py build+   
 +  git clone git://github.com/flodiebold/tornado.git --branch http-timeouts-2.4 /home/crawl-dev/tornado 
 +  cd /home/crawl-dev/tornado 
 +  python setup.py build
  
 NOTE from johnstein: NOTE from johnstein:
  
->/etc/init.d/webtiles sets PYTHONPATH for this, so you shouldn't need to install this, but I wasn't able to make it work and needed to ~# python setup.py install+>/etc/init.d/webtiles sets PYTHONPATH for this, so you shouldn't need to install this, but I wasn't able to make it work and needed
 + 
 +  python setup.py install
  
 NOTE from ZiBuDo: NOTE from ZiBuDo:
Line 458: Line 455:
  
 >I have had an issue with dgamelaunch/WebTiles on Ubuntu 16.04 where the mounting procedure and permissions get trounced upon rebooting.  To resolve this I added the following to /etc/rc.local (before exit 0) >I have had an issue with dgamelaunch/WebTiles on Ubuntu 16.04 where the mounting procedure and permissions get trounced upon rebooting.  To resolve this I added the following to /etc/rc.local (before exit 0)
-     
-    # unmount and remount pts/proc 
-    umount /home/crawl/DGL/dev/pts 
-    umount /home/crawl/DGL/proc 
-    mount /home/crawl/DGL/dev/pts 
-    mount /home/crawl/DGL/proc 
-    # fix ptmx permissions  
-    chmod 666 /home/crawl/DGL/dev/ptmx 
-    # restart webtiles -- webtiles restart doesn't seem to work very well 
-    /etc/init.d/webtiles stop    
-    /etc/init.d/webtiles start 
  
-    exit 0 # normally already in /etc/rc.local+  # unmount and remount pts/proc 
 +  umount /home/crawl/DGL/dev/pts 
 +  umount /home/crawl/DGL/proc 
 +  mount /home/crawl/DGL/dev/pts 
 +  mount /home/crawl/DGL/proc 
 +   
 +  # fix ptmx permissions  
 +  chmod 666 /home/crawl/DGL/dev/ptmx 
 +   
 +  # restart webtiles -- webtiles restart doesn't seem to work very well 
 +  /etc/init.d/webtiles stop    
 +  /etc/init.d/webtiles start 
 +   
 +  exit 0 # normally already in /etc/rc.local
  
 NOTE from floraline: NOTE from floraline:
Line 485: Line 484:
 ===13.1 user database=== ===13.1 user database===
 To create the user database, either run webtiles, or do: To create the user database, either run webtiles, or do:
-  ~$ sqlite3 /home/crawl/DGL/dgldir/dgamelaunch.db+  sqlite3 /home/crawl/DGL/dgldir/dgamelaunch.db
   sqlite3> CREATE TABLE dglusers (id integer primary key, username text, email text, env text, password text, flags integer);   sqlite3> CREATE TABLE dglusers (id integer primary key, username text, email text, env text, password text, flags integer);
   sqlite3> .quit;   sqlite3> .quit;
Line 519: Line 518:
  
 ===13.4 dgamelaunch ssh user=== ===13.4 dgamelaunch ssh user===
 +
 +Install sshd, if not already installed:
 +
 +  sudo apt install openssh-server
 +
 +Add an ssh user: (This will prompt for a password, if you want an empty password you will have to set that elsewhere; also recommended to use an ssh key)
 +
 +  sudo useradd crawler --shell /usr/local/sbin/dgamelaunch
 +  echo crawler:crawler | sudo chpasswd
 +
 Note that your ssh user should have ''/usr/local/sbin/dgamelaunch'' as their shell, and should have forwarding (particularly TCP forwarding) disabled. You could use the following at the end of your ''/etc/ssh/sshd_config'' (note that "Match" affects all options until the next "Match" or the end of the file). Note that your ssh user should have ''/usr/local/sbin/dgamelaunch'' as their shell, and should have forwarding (particularly TCP forwarding) disabled. You could use the following at the end of your ''/etc/ssh/sshd_config'' (note that "Match" affects all options until the next "Match" or the end of the file).
  
Line 526: Line 535:
    X11Forwarding no    X11Forwarding no
    PasswordAuthentication yes  # only if you want to allow passwords    PasswordAuthentication yes  # only if you want to allow passwords
 +
 +If it's not already running, start the sshd server:
 +
 +  /etc/init.d/ssh start
  
 ===13.5 dgl-status=== ===13.5 dgl-status===
Line 537: Line 550:
   exec /usr/local/sbin/dgamelaunch -s   exec /usr/local/sbin/dgamelaunch -s
  
-Send the URL to Wensley (on IRC freenode##crawl-dev, ''!tell Wensley the-url/cgi-bin/dgl-status'')+Send the URL to Wensley (on Libera IRC, #crawl-dev, ''!tell Wensley the-url/cgi-bin/dgl-status'')
  
 ===13.6 inotify=== ===13.6 inotify===
 Launch the inotify watcher which is necessary to populate the "current location" field in DGL. Launch the inotify watcher which is necessary to populate the "current location" field in DGL.
  
-  ~$ sudo /home/crawl-dev/dgamelaunch-config/bin/dgl crawl-inotify-dglwhere+  sudo /home/crawl-dev/dgamelaunch-config/bin/dgl crawl-inotify-dglwhere
  
 Notes: Notes:
Line 559: Line 572:
 with symlinks to each milestone, logfile, and score file (you will need to individually link each score file for each sprint map). with symlinks to each milestone, logfile, and score file (you will need to individually link each score file for each sprint map).
  
-    ~$ ls -lt /var/www/crawl/meta/git/    +    ls -lt /var/www/crawl/meta/git/    
     meta/git:     meta/git:
     total 8     total 8
Line 573: Line 586:
  
 It's recommended to also publish your rcfiles, morgue files, and ttyrec files. It's recommended to also publish your rcfiles, morgue files, and ttyrec files.
-    ~$ ls -lt /var/www/crawl+    ls -lt /var/www/crawl
     total 12     total 12
     drwxr-xr-x 2 root root 4096 Jan  5 00:55 keys     drwxr-xr-x 2 root root 4096 Jan  5 00:55 keys
Line 581: Line 594:
     lrwxrwxrwx 1 root root   31 Jan  2 01:33 rcfiles -> /home/crawl/DGL/dgldir/rcfiles/     lrwxrwxrwx 1 root root   31 Jan  2 01:33 rcfiles -> /home/crawl/DGL/dgldir/rcfiles/
     lrwxrwxrwx 1 root root   30 Jan  2 01:31 morgue -> /home/crawl/DGL/dgldir/morgue/     lrwxrwxrwx 1 root root   30 Jan  2 01:31 morgue -> /home/crawl/DGL/dgldir/morgue/
-  +9 
- sudo mkdir /var/www/crawl/meta/git/ +9sudo mkdir /var/www/crawl/meta/git/ 
- sudo mkdir /var/www/crawl/meta/0.17/+9sudo mkdir /var/www/crawl/meta/0.24/
  
- Do this in /var/www/crawl/meta/git+9Do this in /var/www/crawl/meta/git
  
- sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/logfile +9sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/logfile 
- sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/logfile-sprint +9sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/logfile-sprint 
- sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/logfile-zotdef +9sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/logfile-zotdef 
- sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/milestones +9sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/milestones 
- sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/milestones-sprint +9sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/milestones-sprint 
- sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/milestones-zotdef +9sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/milestones-zotdef 
- sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/scores +9sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/scores 
- sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/scores-sprint +9sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/scores-sprint 
- sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/scores-zotdef+9sudo ln -s /home/crawl/DGL/crawl-master/crawl-git/saves/scores-zotdef
  
 ===13.8 redirect port 80=== ===13.8 redirect port 80===
Line 601: Line 614:
 This was noted in the full apache config above This was noted in the full apache config above
 Create the following config file: Create the following config file:
-    ~# sudo vi /etc/apache2/conf.d/mysite+    sudo vi /etc/apache2/conf.d/mysite
          
     <VirtualHost *:80>     <VirtualHost *:80>
Line 619: Line 632:
 then restart apache then restart apache
  
-  ~$ sudo service apache2 reload+  sudo service apache2 reload
  
 ===13.9 admins=== ===13.9 admins===
 To add admins to the server (allows access to backup saves and wizmode!): To add admins to the server (allows access to backup saves and wizmode!):
  
-  ~$ sudo /home/crawl-dev/dgamelaunch-config/bin/dgl admin add <name>+  sudo /home/crawl-dev/dgamelaunch-config/bin/dgl admin add <name>
  
 ====14. Security notes==== ====14. Security notes====
Logged in as: Anonymous (VIEWER)
dcss/server/setting_up_dgamelaunch_and_webtiles.txt · Last modified: 2021-06-16 21:44 by gammafunk
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki