-
Notifications
You must be signed in to change notification settings - Fork 69
Historical Artifacts
Song Zheng edited this page Jan 13, 2022
·
2 revisions
Due to house move, we need to migrate everything that is hosted locally to remote hosting. All of the big items will have to be moved.
Acquire a new DO server.-
Install Postgres on new machineCreate new user (CREATE USER john WITH PASSWORD '0aoAOUE';
)Create database (createdb c0d3_testing
)
Postgres should allow remote connections: Modify file in/etc/postgresql/12/main/postgresql.conf
.Restart Postgres:service postgresql restart
Postgres DB Dump c0d3 data (in old machine) -pg_dump c0d3_prod > ~/aug23-2020-c0d3_prod.sql
Xfer dump to new machine:scp aug23-2020-c0d3_prod.sql postgres@new-ip:~/
Postgres DB Import c0d3 db into new machine -psql c0d3_testing < aug23-2020-c0d3_prod.sql -U c0d3_admin --password
switch databases on vercelTesting - create new account on new c0d3.com and the old c0d3.com website did not reflect the new account, proving that the new c0d3.com is using the new database
Upgrade Mattermost (old server)DB Dump of mattermost chat serverInstall Mattermost (new server)DB Populate mattermost chat postgres to new dbSetup loadbalancer myProxy (old computer) to point to new serverMake sure old and new configurations matchesPlugin SetupMake sure access tokens (for chatroom updates) work
Install myProxy into new server.DNS mapping to new serverMigrate existing apps to new server
- Change user password
ALTER USER user_name WITH PASSWORD 'new_password';
- Create database
CREATE DATABASE dbname OWNER rolename;
We migrated to discord, so mattermost is no longer used
To upgrade the Mattermost server that runs c0d3's chat, follow through these steps.
Most of the instructions here are from the Mattermost upgrading guide, so if something doesn't work first check the official documentation.
- SSH into the server and switch to the
root
user. If you don't have access, ask for help in the engineering channel.
# Replace <user> with your username
ssh <user>@chat.c0d3.com
sudo su
- Before doing anything related to Mattermost, make a backup of the PostgreSQL database. First switch to the
postgres
user and then make a backup usingpg_dump
.
# From here, you can assume the commands are run as root
su - postgres
pg_dump mattermost > mattermost_db_$(date +'%F-%H-%M').psql
logout # return to root user
- Download and extract the new Mattermost server files.
cd /tmp
# Replace X.X.X with the Mattermost version (e.g. 5.27.0)
wget https://releases.mattermost.com/X.X.X/mattermost-X.X.X-linux-amd64.tar.gz
# Extract the files to 'mattermost-upgrade'
tar -xf mattermost*.gz --transform='s,^[^/]\+,\0-upgrade,'
# Change ownership of the new files
chown -hR mattermost:mattermost /tmp/mattermost-upgrade/
- Stop the server and make a backup of the current Mattermost server files.
# Stop the server
systemctl stop mattermost
# Backup current server
cp -ra /opt/mattermost/ /opt/mattermost-back-$(date +'%F-%H-%M')/
- Copy the new version files to the installation directory.
# Remove all files except special directories from within the current mattermost directory.
find /opt/mattermost/ /opt/mattermost/client/ -mindepth 1 -maxdepth 1 \! \( -type d \( -path /opt/mattermost/client -o -path /opt/mattermost/client/plugins -o -path /opt/mattermost/config -o -path /opt/mattermost/logs -o -path /opt/mattermost/plugins -o -path /opt/mattermost/data \) -prune \) | sort | xargs rm -r
# Copy the new files
cp -an /tmp/mattermost-upgrade/. /opt/mattermost/
- Enable Mattermost to bind to lower ports.
setcap cap_net_bind_service=+ep /opt/mattermost/bin/mattermost
- Start the service back again to run the server.
systemctl start mattermost
- After the upgrade remove the temporary files.
rm -rf /tmp/mattermost-upgrade
rm /tmp/mattermost*.gz