Production Setup: Webserver

From Dreamwidth Notes
Revision as of 16:56, 7 November 2015 by Kaberett (Talk | contribs)

Jump to: navigation, search

Webservers are the basic building block of the site. They run most of the interactions of the site and are the majority of the servers that we have.

Emphasis on CPU and RAM. We don't need disk.

Setup

Current production setup steps:

  • Get slice for new webserver
  • SSH in as root with given password, change root's password.

Setup DW account.

adduser dw
echo "dw ALL=NOPASSWD: ALL" >> /etc/sudoers

Install base packages, still as root, and do a system update. This will take a little bit to run, so get some coffee real fast.

apt-get update
apt-get install vim-perl screen dh-make-perl \
  apache2-mpm-prefork libgtop2-dev libapache2-mod-perl2 libapache2-request-perl
apt-get dist-upgrade

Now let's get the DW user setup.

su - dw
echo -e "\nsource ~/.dwrc" >> .bashrc
echo -e 'export LJHOME="/home/dw/current"' > ~/.dwrc
exit

Now we log back into the DW user to continue (this sets up $LJHOME).

su - dw
mkdir production
ln -s production/ current
cd $LJHOME
wget http://hg.dwscoalition.org/dw-free/raw-file/tip/bin/bootstrap.pl
perl bootstrap.pl

This will also run for a while. It should say something about starting at the beginning, and then go bouncing along its merry way as it starts checking things out. Good times will be had by all.

Fix the hg repository, need to figure out why this is necessary.

cd cvs/dw-free
hg update -C tip
cd ..
hg clone http://hg.dwscoalition.org/dw-nonfree dw-nonfree
cp dw-nonfree/cvs/multicvs-local.conf .
hg clone http://hg.dwscoalition.org/dw-private dw-private
cd $LJHOME
bin/cvsreport.pl -s
bin/cvsreport.pl -s

Now let's get a list of modules to install, or try:

for i in `bin/checkconfig.pl --only=modules --needed-debs`; \
  do sudo apt-get -qq install $i; \
done

The package list looks something like this, incidentally:

libcaptcha-recaptcha-perl libclass-accessor-perl libclass-autouse-perl
libclass-data-inheritable-perl libclass-trigger-perl libcompress-zlib-perl
libcrypt-dh-perl libdbd-mysql-perl libdbi-perl libdatetime-perl
libdigest-hmac-perl libmd5-perl libdigest-sha1-perl libgd-gd2-perl
libgd-graph-perl libgnupg-interface-perl libhtml-parser-perl
libhtml-tagset-perl libhtml-template-perl libio-stringy-perl
perlmagick libimage-size-perl libwww-perl libwww-perl libmime-lite-perl
libmime-perl libmailtools-perl libmail-gnupg-perl libmath-bigint-gmp-perl
libnet-dns-perl libproc-process-perl librpc-xml-perl libsoap-lite-perl
libstring-crc32-perl libtext-vcard-perl liburi-fetch-perl liburi-perl
libunicode-maputf8-perl libxml-atom-perl libxml-rss-perl libxml-simple-perl

There are also some modules we have manually built:

sudo dpkg -i cvs/dw-private/debs/*.deb

Now let's see what modules didn't get installed for some reason:

bin/checkconfig.pl --only=modules --needed-debs

If there are any at this point, then we did something majorly wrong and we need to update something somewhere. Your build won't work.

Next up, we need to configure Apache.

sudo cp etc/SOMETHING/httpd.conf /etc/apache2/conf.d/dw.conf
sudo a2dissite default
sudo a2enmod apreq
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start

stuff