Aller au contenu

« FeministWiki:Server setup » : différence entre les versions

aucun résumé des modifications
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 4 : Ligne 4 :


== Initial setup of the new server ==
== Initial setup of the new server ==
This section describes various initialization tasks for the new server that are independent of the old server.
=== Make feministwiki.dev point to the new server ===
During setup and testing of the new server, we want to make it accessible under the '''feministwiki.dev''' domain.  So change the <code>A</code> entry of the feministwiki.dev DNS settings to point to the IP address of the new server.


=== Update & upgrade ===
=== Update & upgrade ===
Ligne 47 : Ligne 53 :
  ufw enable
  ufw enable


=== Install server components ===
=== Enable extra repositories ===


We will now install all the software used for the various FeministWiki services.  But first we might want to add some additional package repositories so we can use the latest version of some of the used software.
We might want to add some additional package repositories so we can use the latest version of some of the used software.


Backports:
Backports is always OK to add since the packages don't get priority over the stable ones:


  echo deb http://deb.debian.org/debian $(lsb_release -sc)-backports main > /etc/apt/sources.list.d/backports.list
  echo deb http://deb.debian.org/debian $(lsb_release -sc)-backports main > /etc/apt/sources.list.d/backports.list
Ligne 67 : Ligne 73 :
  echo "deb http://mirror.23media.de/mariadb/repo/10.4/debian $(lsb_release -sc) main" > /etc/apt/sources.list.d/mariadb.list
  echo "deb http://mirror.23media.de/mariadb/repo/10.4/debian $(lsb_release -sc) main" > /etc/apt/sources.list.d/mariadb.list


Now we can install everything:
=== Install server components ===
 
Now we can install all the software used for the various FeministWiki services:


  php_version=7.4 # or whatever version we're on
  php_version=7.4 # or whatever version we're on
Ligne 91 : Ligne 99 :
Example for installing ejabberd from backports instead:
Example for installing ejabberd from backports instead:


  apt-get install ejabberd/$(lsb_release -sc)-backports
  apt-get install ejabberd/$(lsb_release -sc)-backports # e.g. ejabberd/buster-backports


=== Enable Apache modules ===
=== Enable Apache modules ===
Ligne 110 : Ligne 118 :
=== Put config files in place ===
=== Put config files in place ===


The principle is simple: take all the config files from <code>/root/repo/etc</code> and put them where they belong in <code>/etc</code>.  However, since a new server might mean much newer software, it's possible that some config files aren't compatible anymore, or that some new sensible defaults might be overwritten by the old config.  Sadly figuring out these incompatibilities is a manual process (compare new default config with old config) and this guide cannot help you much.
The principle is simple: take all the config files from <code>/root/repo/etc</code> and put them where they belong in <code>/etc</code>.  However, since a new server might mean much newer software, it's possible that some config files aren't compatible anymore, or that some new sensible defaults might be overwritten by the old config.  Sadly figuring out these incompatibilities is a manual process: compare the new default config with the old default config and to our old config, to figure out what our new config should look like.


There's one special thing to remember, which is that after copying in the new <code>/etc/aliases</code> file, you have to run the <code>newaliases</code> command for the changes to take effect.
There's one special thing to remember, which is that after copying in the new <code>/etc/aliases</code> file, you have to run the <code>newaliases</code> command for the changes to take effect.
=== Make feministwiki.dev point to the new server ===
This is a good time to change the DNS record for feministwiki.dev to point to the new IP address.


=== Initialize LetsEncrypt ===
=== Initialize LetsEncrypt ===
Ligne 137 : Ligne 141 :
== Copying over live data ==
== Copying over live data ==


=== Stop services on old server ===
We want to make a first run of this copy process purely for testing purposes, before shutting down the services on the old server and repeating it to ensure integrity of live data.
 
'''At this point, all services on the old server should be stopped, because we will now begin to transfer all the actual data.'''


=== Copy over LDAP databases ===
=== Copy over LDAP databases ===
Ligne 147 : Ligne 149 :
=== Copy over SQL databases ===
=== Copy over SQL databases ===


The following command can be used to create a dump of all databases and import it on the new server.  You can use the <code>show databases;</code> command in the SQL console to make sure that the list of databases is complete.  (Unfortunately they have to be listed manually, because using the <code>--all-databases</code> option includes system databases that we don't want.)
Stop the database server:
 
systemctl stop mariadb
 
The following command can be used to create a dump of all databases and import it on the new server.  You can use the <code>show databases;</code> command in the SQL console to make sure that the list of databases is complete.  (Unfortunately they have to be listed manually, because using the <code>--all-databases</code> option includes system databases that we don't want to copy.)


  mysqldump -u root -p"$(cat /root/pwd/mysql)" \
  mysqldump -u root -p"$(cat /root/pwd/mysql)" \
Ligne 171 : Ligne 177 :
  tar -czf - . | ssh root@feministwiki.dev 'cd /var/www; tar -xzf -'
  tar -czf - . | ssh root@feministwiki.dev 'cd /var/www; tar -xzf -'


== Finishing up ==
=== Reboot ===


=== Open ports ===
We could restart a lot of services manually to ensure they've read their new config, but it's easiest to just reboot.


We are finally ready to serve:
reboot


for port in 25 80 443 465 587 993 995 5222 5223 5269 5270 5443 6697 7777
=== Test! ===
do ufw allow proto tcp to 0.0.0.0/0 port $port
done
 
=== Reboot ===


We could restart a lot of services manually, but it's easiest to just reboot.
At this point you should test everything using the feministwiki.dev domain name.


reboot
== Finishing up ==


After that, you might want to do some testing with the '''feministwiki.dev''' domain.
'''Now, all services on the old server should be stopped, because we will begin the final transfer of live data.'''


=== Update DNS entries ===
=== Update DNS entries ===
Ligne 210 : Ligne 212 :


For these, you only have to change the main <code>A</code> entry, since they don't use SMTP or XMPP.
For these, you only have to change the main <code>A</code> entry, since they don't use SMTP or XMPP.
=== Open ports ===
We are almost ready to serve:
for port in 25 80 443 465 587 993 995 5222 5223 5269 5270 5443 6697 7777
do ufw allow proto tcp to 0.0.0.0/0 port $port
done


=== Update the certificate ===
=== Update the certificate ===


Run the <code>letsencrypt-refresh</code> script to get a new certificate which includes all our domain names, since we had started out with just feministwiki.dev.
Run the <code>letsencrypt-refresh</code> script to get a new certificate which includes all our domain names, since we had started out with just feministwiki.dev.
(This requires at least port 80 to be opened via the command in the last step.)
After this, everything should be functional.  If not, it's time for some debugging!