Skip to content

v4.2.0

Latest
Compare
Choose a tag to compare
@Rom1-J Rom1-J released this 18 Oct 20:43
· 113 commits to master since this release
  • migrate to docker

Migration process

Make a backup of old database

$ BACKUP_DIR_PATH="/tmp"  # prefer to save it on a local system
$ BACKUP_FILE_PREFIX="pre_4.2.0"

$ backup_filename="${BACKUP_FILE_PREFIX}_$(date +'%Y_%m_%dT%H_%M_%S').sql.gz"

$ pg_dump -d tuxbot | gzip > "${BACKUP_DIR_PATH}/${backup_filename}"

Retrieve and make changes

Assuming bot is in /opt/tuxbot-bot and owned by tuxbot

$ su - tuxbot
$ cd /opt/tuxbot-bot
$ cp -r data /tmp/data  # (make sure to save config, copy it to your desktop instead of /tmp)
$ git fetch
$ git checkout tags/v4.2.0
$ poetry shell  # (you might still have old virtualenv in data/)
$ poetry update
$ poetry run migrate-to-envs
$ mkdir logs
$ rm -rf data

Note : the migration might set wrong values in some keys, make sure in .envs/.production/ to have the following format :

Wrong Correct
TUXBOT_LOG_LEVEL="info" TUXBOT_LOG_LEVEL="20"
TUXBOT_CLIENT_DISABLED_EVENTS="['TYPING_START', 'PRESENCE_UPDATE']" TUXBOT_CLIENT_DISABLED_EVENTS="TYPING_START,PRESENCE_UPDATE]"
TUXBOT_CLIENT_OWNERS_ID="[171685542553976832, 269156684155453451]" TUXBOT_CLIENT_OWNERS_ID="171685542553976832,269156684155453451"
TUXBOT_CLIENT_PREFIXES="['.', 'beta.']" TUXBOT_CLIENT_PREFIXES=".,beta."
REDIS_URL="redis://localhost:6379/0" REDIS_URL="redis://redis:6379/0"
SENTRY_LOG_LEVEL="info" SENTRY_LOG_LEVEL="20"
TUXBOT_LOADED_COGS="['Admin', 'Auto', 'Dev',... TUXBOT_LOADED_COGS="tuxbot.cogs.Admin,tuxbot.cogs.Auto,tuxbot.cogs.Dev,..."

Build production

# docker compose -f production.yml up -d

Import old database

# cp "${BACKUP_DIR_PATH}/${backup_filename}" /var/lib/docker/volumes/tuxbot-bot_tuxbot_production_postgres_data_backups/_data
# docker compose -f production.yml run postgres backups  # make sure the backups is available
# docker compose -f production.yml run postgres restore pre_4.2.0_...