Skip to content

Linux Installation

Kozejin edited this page Dec 2, 2024 · 5 revisions

Install Dependencies

  1. Update the package list.
sudo apt update
  1. Install the dependencies.
sudo apt install python3.11 python3.11-venv python3.11-dev git virtualenv nano

Installation (Linux)

  1. Create a new user and switch to it.a
sudo adduser ascension
su - ascension
  1. Clone the Arkon bot repository with the following commands
git clone https://github.com/dkoz/ascension-bot
cd ascension-bot
  1. Now you need to create a virtual env and install the requirements.
virtualenv venv
source venv/bin/activate
pip install setuptools
pip install -r requirements.txt
  1. Configure the environment variables.
cp .env.example .env
nano .env
  1. Now run the bot.
python main.py

Setting up auto-restart using systemd

  1. Create a service file.
sudo nano /etc/systemd/system/ascension.service
  1. Paste the following contents and save the file. Shortcuts: ctrl+o and hit enter, then ctrl+x to exit.
[Unit]
Description=Ascension Bot
After=network.target

[Service]
User=ascension
Group=ascension
WorkingDirectory=/home/ascension/ascension-bot
ExecStart=/home/ascension/ascension-bot/venv/bin/python -u main.py
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
  1. Reload systemd configuration.
sudo systemctl daemon-reload
  1. Enable the service, then start it.
sudo systemctl enable ascension.service
sudo systemctl start ascension.service
  1. Then check the status of the Ascension bot or journal logs.
sudo systemctl status ascension.service
sudo journalctl -eu ascension.service

Updating the bot

  1. Switch to the bot user and cd into the directory.
su - ascension
cd ascension-bot
  1. Pull the latest changes and run the requirements again.
git pull
source venv/bin/activate
pip install -r requirements.txt
  1. Restart the bot and verify that it's running.
sudo systemctl restart ascension.service
sudo systemctl status ascension.service
sudo journalctl -eu ascension.service