Ruby-Cogs/levelup/generator
2025-05-28 02:15:39 -04:00
..
locales Upload 2 Cogs & Update README 2025-05-23 01:30:53 -04:00
pilmojisrc Upload 2 Cogs & Update README 2025-05-23 01:30:53 -04:00
styles Update ExtendedAudio cog to use a new embed color and enhance profile generation by defining a stats area for blur effects in default.py. 2025-05-28 02:15:39 -04:00
tenor Upload 2 Cogs & Update README 2025-05-23 01:30:53 -04:00
__init__.py Upload 2 Cogs & Update README 2025-05-23 01:30:53 -04:00
api.py Upload 2 Cogs & Update README 2025-05-23 01:30:53 -04:00
imgtools.py Enhance glass effect implementation in imgtools.py and default.py. Ensure images are in RGBA mode before applying effects, and update the glass effect application in the stats layer to use the glass background as a mask for improved visual consistency. 2025-05-24 07:25:02 -04:00
levelalert.py Add Skia support for image generation and update project metadata 2025-05-26 09:06:08 -04:00
README.md Upload 2 Cogs & Update README 2025-05-23 01:30:53 -04:00
requirements.txt Upload 2 Cogs & Update README 2025-05-23 01:30:53 -04:00
skia_generator.py Add Skia support for image generation and update project metadata 2025-05-26 09:06:08 -04:00

LevelUp API Service

This repository contains the code for the LevelUp API, a companion API for a leveling cog for the Red-DiscordBot. This guide will help you clone the repository and set up your own self-hosted API.

Prerequisites

  • Python 3.10 or higher
  • pip (Python package installer)
  • Virtual environment (venv)
  • git
  • systemd (for setting up the service)

Installation and Setup

1. Create a Virtual Environment

It's best practice to use a virtual environment to manage dependencies:

python3 -m venv apienv

2. Activate the Virtual Environment

Before installing the required packages, activate the virtual environment:

source apienv/bin/activate

3. Clone the Repository

git clone https://github.com/vertyco/vrt-cogs.git
cd vrt-cogs/levelup/generator

4. Install Dependencies

Install the required Python packages using pip:

pip install -r requirements.txt

5. Test the API

Before setting up the service, you can test the API to ensure it's working:

cd /home/ubuntu/vrt-cogs/levelup/generator
uvicorn api:app --host 0.0.0.0 --port 8888 --app-dir /home/ubuntu/vrt-cogs/levelup/generator

6. Set Up the systemd Service

Create a new systemd service file for the API:

sudo nano /etc/systemd/system/levelup.service

Add the following content to the file:

[Unit]
Description=LevelUp API Service
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/home/ubuntu/redenv/bin/uvicorn api:app --host 0.0.0.0 --port 8888 --workers 4 --app-dir /home/ubuntu/vrt-cogs/levelup/generator
User=ubuntu
Group=ubuntu
Restart=always
RestartSec=15

[Install]
WantedBy=multi-user.target

7. Reload systemd Daemon

Reload the systemd configuration to apply the changes:

sudo systemctl daemon-reload

8. Start and Enable the Service

Start the service:

sudo systemctl start levelup.service

Enable the service to start on boot:

sudo systemctl enable levelup.service

9. Check the Service Status

You can check the status of the service to ensure it is running correctly:

sudo systemctl status levelup.service

10. View Logs

You can view the logs for the service using:

sudo journalctl -u levelup.service -f

Troubleshooting

If you encounter any issues, please check the logs for more details:

sudo journalctl -u levelup.service -n 50 -f

DISCLAIMER

By using this API it is assumed you know your way around Python and hosting services. This guide is not exhaustive and may require additional steps based on your environment. I will not be providing support for setting up the API on your server.