Vidensdatabase

IF Your Procfile has 'python main.py' or 'python3 main.py' as the run command: Print

  • 0

Managing and Deploying Your Service with HostingUp

Quick Start: Deploy Your Bot with Ease

Before you start, ensure that your repository’s start command is either python main.py or python3 main.py. Follow the appropriate method based on your requirements.

Method: Simple Commands for Quick Setup

This method is ideal for new VPS users with the latest setup. Existing VPS users will need to reinstall the OS to use these commands.

If Your Procfile Uses main.py

To Start Your Bot:

hmain <your-repo-url>

Replace <your-repo-url> with the URL of your GitHub repository. For example:

hmain https://github.com/your-username/your-repo.git

To Stop Your Bot:

hclosem {REPO_NAME}

Example: hclosem myfilterbot

Instructions:

  1. Replace https://github.com/your-username/your-repo.git with your repository URL.
  2. Choose the command based on your Procfile configuration.

Benefits:

  • Automatic Server Setup: Simplify your server setup process.
  • Continuous 24/7 Operation: Keep your bot running continuously.
  • Automatic Restarts: Your bot will restart automatically after server reboots.

Managing and Monitoring Your Service

Once your bot is up and running, you can manage and monitor it using systemd commands.

Re-deploying Bot with Changes

If you need to re-deploy the bot with some changes, follow these steps:

    1. Commit Changes to GitHub: Ensure that you have committed your changes to your GitHub repository. Changes made directly on the VPS will not be reflected unless they are pushed to your GitHub account.
    2. Run the Deployment Command: On the VPS, use the script with the following command:
hmain <GitHub Repo URL>

This command will pull the latest changes from your GitHub repository and redeploy the bot with those updates.

By following these steps, the changes will be reflected, and the bot will be restarted with the updated code.

Checking Service Status

View the Status of Your Service:

sudo systemctl status {REPO_NAME}.service

This command will show whether the service is running, stopped, or failed.

View Detailed Service Logs:

sudo journalctl -u {REPO_NAME}.service

This is useful for troubleshooting and viewing detailed log output.

View Logs from the Past Hour:

sudo journalctl -u {REPO_NAME}.service --since "1 hour ago"

This command filters logs to show entries from the past hour.

Follow Real-Time Logs:

sudo journalctl -u {REPO_NAME}.service -f

This command displays log output in real-time, similar to tail -f.

Managing the Service

Start the Service:

sudo systemctl start {REPO_NAME}.service

Stop the Service:

sudo systemctl stop {REPO_NAME}.service

Restart the Service:

sudo systemctl restart {REPO_NAME}.service

Reload the Service Configuration:

sudo systemctl reload {REPO_NAME}.service

Enable the Service to Start on Boot:

sudo systemctl enable {REPO_NAME}.service

Disable the Service from Starting on Boot:

sudo systemctl disable {REPO_NAME}.service

Note: Replace {REPO_NAME} with your actual repository folder name (e.g., myfilterbot). For example, to view logs, the command would be:

sudo journalctl -u myfilterbot.service

Need Help?

If you need further assistance, please reach out to our support team:

For additional information and to explore our affiliate program, visit our website and learn how you can benefit from HostingUp.

Watch Our Tutorial

For a visual guide, check out our YouTube tutorial:


Hjalp dette svar dig?
Back
WhatsApp Chat Need Help? Telegram Chat Chat on Telegram