Deploy Code Updates - MLROOTC/MLR-OOTC GitHub Wiki
- Putty
- WinSCP
- Access to the server's IP address, username, and password, all of which can be found in the Passwords doc in the Internal OOTC Docs folder in Google Drive
- Review the files changed in the recent changes from a Merge Request. Download those files onto your pc.
- Make special note of any changes to config.ini.
- Any script change that imports a module as "src.Cogs." needs to be changed to "Cogs." due to the file structure on the host.
- Using WinSCP or similar program, log into the host.
- Credentials to log into the bot can be found on Vultr.com's website. Use the provided IP, provided userID and password saved in ootc's password document. Userid and Password can also be found on Vultr's website.
- Patch the files that need updating in their appropriate folders. Log out of WinSCP.
- Login to Vultr.com and go to the server detail page.
- Open up the web browser console on the top right of the page.
- If user has been logged out of the console, login the same way you did for WinSCP.
- Enter
jobs
into the console to see the scripts currently running in the background. - type
fg #
where # is the job# for the scipt discord_bot.py. - Press Ctrl+C to end the process.
- Start the bot up by entering the command:
sudo python3 discord_bot.py &
- Test the bot to see if the patch was accepted. Close the console if so.
- Log into the bot server via PuTTy
- Run
ps -ef
to get the list of running processes - Locate
sudo python3 discord_bot.py
on the list and note the process ID - Run
kill ####
with the #### being the process ID of the bot - Run
ps -ef
again to make sure the process is actually stopped -
cd
into the OtterBot directory - Start the process again using
sudo python3 discord_bot.py &
To stop the ump ping script, run the following command:
systemctl stop restart_ump_pings
To start the ump ping script, run the following command:
systemctl start restart_ump_pings
- Open a connection to the server with WinSCP
- Navigate to /root/var/www/swing420/website
- If any of the .py files have changed, drag and drop them in this directory
- Navigate to the /templates folder
- If any html files have changed, drag and drop them here
- We need to restart the apache server
- Open Putty
- Enter the IP address of the server under HostName
- It would be a good idea to enter a name for this session and save it into your Saved Sessions list
- Click Open or double click your saved session
- A command window should pop up. Type root when prompted for a username and hit enter
- Copy the password to your clip board, then right click in the command window to paste and hit Enter.
- You will not be able to see that anything has been typed in the command window.
- If you have logged in successfully the command window will say
root@fakebaseball:~#
- If you needed to make changes to the Apache config, you'll need to restart Apache.
systemctl reload apache2
- Restart the web server using the following command:
sudo service apache2 restart
- That should be it. You can now log out by closing the Putty and WinSCP windows and pat yourself on the back for a job well done.
- Create a file called .service
Ex:restart_ump_bot.service
In the file:
[Unit]
Description=Restart FakeBaseballBot
[Service]
Type=simple
WorkingDirectory=/root/OtterBot
ExecStart=/usr/bin/python3 /root/OtterBot/reddit_watcher.py
User=root
Restart=always
[Install]
WantedBy=multi-user.target
- Copy file to /etc/systemd/system/
- Issue following commands
systemctl daemon-reload
systemctl enable <name of the file without the .service extension>
systemctl start <name of the file without the .service extension>
- To stop the process and auto restart:
systemctl stop <name of the file without the .service extension>