Skip to content

sydomo/discourse-shell-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discourse Shell Scripts

Quickly run / backup / migrate your discourse instance

Dependencies

Optional - if you don't need backup or migrate

Installation

$ git clone https://github.com/sydomo/discourse-shell-scripts.git ~/.discourse
$ chmod +x discourse-manager
# (Optional) Edit .env file and set password variables

# Install mise
$ curl https://mise.run | sh
$ echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
$ source ~/.bashrc && mise --version

# Enable mise
$ cp .env.example .env
$ mise trust mise.toml

Update

$ cd ~/.discourse
$ git checkout discourse-manager; git pull; chmod +x discourse-manager

Usage

$ cd ~/.discourse
$ ./discourse-manager help

Run Discourse

# Run A Discourse Instance
$ ./discourse-manager install
$ vim /var/discourse/containers/app.yml
$ ./discourse-manager rebuild

# Config Email SMTP
$ vim /var/discourse/containers/app.yml
$ ./discourse-manager restart
# Or Manually Create Admin Account
$ ./discourse-manager enter
$ rake admin:create

Backup Discourse Data

# Install Rclone for Upload Backup
$ curl -sSf https://rclone.org/install | bash
$ rclone version
# Config Rclone Storage Provider
$ rclone config

# Install 7z for Compress & Encrypt Backup
$ apt-get install p7zip-full
$ 7z | grep "7-Zip"

$ ./discourse-manager backup [rclone-remote-name]

Automatic scheduled backup (Crontab.guru):

$ mkdir -p /tmp/discourse
$ crontab -e
# If your Rclone remote name is "pcloud_crypt"
$ 5 4 * * *		bash -c "${HOME}/.discourse/discourse-manager backup pcloud_crypt" &>> /tmp/discourse/backup.log

Migrate Discourse Data

# Install uv
$ curl -LsSf https://astral/uv/install | sh
$ uv -V

# Install Magic Wormhole
$ uv tool install magic-wormhole
$ wormhole --version

Old Server:

$ ./discourse-manager migrate

New Server:

$ cd /var/discourse/shared/standalone/backups/default
$ wormhole receive [wormhole-code]

About

Quickly run / backup / migrate your discourse instance

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages