FeministWiki:Server setup: Difference between revisions

no edit summary
No edit summary
Line 26: Line 26:


Before restarting the SSH service, make sure you've actually added your public key (the contents of {{C|~/.ssh/id_rsa.pub}} on your computer) to {{C|/root/.ssh/authorized_keys}} on the server, or you'll lock yourself out.
Before restarting the SSH service, make sure you've actually added your public key (the contents of {{C|~/.ssh/id_rsa.pub}} on your computer) to {{C|/root/.ssh/authorized_keys}} on the server, or you'll lock yourself out.
Some shell commands below reference the variable '''{{C|<nowiki>${SSH_PORT}</nowiki>}}'''.  This variable doesn't actually exist, unless you set it in your shell session.  So either set the variable, or just replace it with the actual value of the SSH port you've configured.


=== Copy SSH key from old server ===
=== Copy SSH key from old server ===
Line 50: Line 48:


  apt-get install ufw
  apt-get install ufw
  ufw allow proto tcp to 0.0.0.0/0 port ${SSH_PORT}
  ufw allow proto tcp to 0.0.0.0/0 port ${SSH_PORT} # Replace with actual port number
  ufw enable
  ufw enable


Line 165: Line 163:
Copy over the certs from the old server:
Copy over the certs from the old server:


  tar -czPf- /etc/fw-certs | ssh feministwiki.dev -p ${SSH_PORT} 'tar -xzPf-'
  tar -czPf- /etc/fw-certs | ssh feministwiki.dev 'tar -xzPf-'


The {{C|/etc/fw-certs}} directory and its contents should be owned by the group {{C|ssl-cert}}.  Make sure this is the case on the new server after running the command above, since the group ID might be different on the new server.  If the group doesn't exist at all, just create it.
The {{C|/etc/fw-certs}} directory and its contents should be owned by the group {{C|ssl-cert}}.  Make sure this is the case on the new server after running the command above, since the group ID might be different on the new server.  If the group doesn't exist at all, just create it.
Line 210: Line 208:
Then copy over the configuration database, by running the following commands from the old server:
Then copy over the configuration database, by running the following commands from the old server:


  slapcat -n 0 | ssh feministwiki.dev -p ${SSH_PORT} 'sudo -u openldap slapadd -n 0 -F /etc/ldap/slapd.d'
  slapcat -n 0 | ssh feministwiki.dev 'sudo -u openldap slapadd -n 0 -F /etc/ldap/slapd.d'


==== Breaking changes in OpenLDAP ====
==== Breaking changes in OpenLDAP ====
Line 247: Line 245:
# Open the file in a text editor and delete the block starting with the line {{C|<nowiki>dn: cn={4}ppolicy,cn=schema,cn=config</nowiki>}}, up to the next empty line (before the next block starting with a {{C|dn: ...}} line), and save the file.
# Open the file in a text editor and delete the block starting with the line {{C|<nowiki>dn: cn={4}ppolicy,cn=schema,cn=config</nowiki>}}, up to the next empty line (before the next block starting with a {{C|dn: ...}} line), and save the file.
# Feed the file to {{C|slapadd -n 1}} on the new server:
# Feed the file to {{C|slapadd -n 1}} on the new server:
#: <pre>cat slapcat.n0.out | ssh feministwiki.dev -p ${SSH_PORT} 'sudo -u openldap slapadd -n 0 -F /etc/ldap/slapd.d'</pre>
#: <pre>cat slapcat.n0.out | ssh feministwiki.dev 'sudo -u openldap slapadd -n 0 -F /etc/ldap/slapd.d'</pre>


== Copying over live data ==
== Copying over live data ==
Line 261: Line 259:
Then copy over the database by running the following command from the old server:
Then copy over the database by running the following command from the old server:


  slapcat -n 1 | ssh feministwiki.dev -p ${SSH_PORT} 'sudo -u openldap slapadd -n 1'
  slapcat -n 1 | ssh feministwiki.dev 'sudo -u openldap slapadd -n 1'


Although there may be breaking changes that make this command fail, just as with the copying of the configuration database explained earlier, the chance is much lower for the regular "data" database, so hopefully the command will run fine.
Although there may be breaking changes that make this command fail, just as with the copying of the configuration database explained earlier, the chance is much lower for the regular "data" database, so hopefully the command will run fine.
Line 290: Line 288:
               feministwiki_pt \
               feministwiki_pt \
               fff \
               fff \
   | gzip | ssh root@feministwiki.dev -p ${SSH_PORT} 'gunzip | /root/bin/sql'
   | gzip | ssh root@feministwiki.dev 'gunzip | /root/bin/sql'


You can use the {{C|show databases;}} 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 {{C|--all-databases}} option includes system databases that we don't want to copy.
You can use the {{C|show databases;}} 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 {{C|--all-databases}} option includes system databases that we don't want to copy.