PheeZz / wireguard-bot

telegram bot for manage Wireguard server
MIT License
81 stars 20 forks source link

problem with start #16

Closed Bilalline closed 1 month ago

Bilalline commented 7 months ago

systemctl status wireguard-bot.service

x wireguard-bot.service - WireGuard VPN Bot Loaded: loaded (/etc/systemd/system/wireguard-bot.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Wed 2024-02-07 18:17:23 UTC; 12min ago Duration: 1ms Main PID: 8771 (code=exited, status=127) CPU: 1ms

Feb 07 18:17:23 botgw systemd[1]: Started wireguard-bot.service - WireGuard VPN Bot. Feb 07 18:17:23 botgw bash[8771]: /bin/bash: line 1: /bin/python3.10: No such file or directory Feb 07 18:17:23 botgw systemd[1]: wireguard-bot.service: Main process exited, code=exited, status=127/n/a Feb 07 18:17:23 botgw systemd[1]: wireguard-bot.service: Failed with result 'exit-code'.

ls /usr/bin/python*

/usr/bin/python3 /usr/bin/python3.11

PheeZz commented 7 months ago

problem with python3.10, it's not installed. You have two ways: 1. install python 3.10 and project dependencies or try to install project dependencies over your python 3.11

steps to install dependencies over python 3.11:

  1. cd ~/wireguard-bot/
  2. pip install poetry
  3. poetry install
  4. fix your /etc/systemd/system/wireguard-bot.service file

ExecStart... line must be something like:

 ExecStart=/bin/bash -c 'cd ~/wireguard-bot/ && $(poetry env info --path)/bin/python3.11 app.py'
  1. reload .service sudo systemctl daemon-reload sudo systemctl reload wireguard-bot.service
PheeZz commented 7 months ago

@Bilalline if you still have problems with launch, I can try to put project inside docker containers in 24h

Bilalline commented 7 months ago

it would be great to have a ready-made container with the ability to edit environment variables

By the way, after entering the command

pip install poetry

I received an error, a quick solution to which was

rm /usr/lib/python3.11/EXTERNALLY-MANAGED

systemctl reload wireguard-bot.service

Failed to reload wireguard-bot.service: Job type reload is not applicable for unit wireguard-bot.service.

systemctl reload wireguard-bot.service Failed to reload wireguard-bot.service: Job type reload is not applicable for unit wireguard-bot.service. root@botgw:~/wireguard-bot# systemctl status wireguard-bot.service x wireguard-bot.service - WireGuard VPN Bot Loaded: loaded (/etc/systemd/system/wireguard-bot.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Wed 2024-02-07 18:17:23 UTC; 1h 6min ago Duration: 1ms Main PID: 8771 (code=exited, status=127) CPU: 1ms

Feb 07 18:17:23 botgw systemd[1]: Started wireguard-bot.service - WireGuard VPN Bot. Feb 07 18:17:23 botgw bash[8771]: /bin/bash: line 1: /bin/python3.10: No such file or directory Feb 07 18:17:23 botgw systemd[1]: wireguard-bot.service: Main process exited, code=exited, status=127/n/a Feb 07 18:17:23 botgw systemd[1]: wireguard-bot.service: Failed with result 'exit-code'. root@botgw:~/wireguard-bot# systemctl restart wireguard-bot.service root@botgw:~/wireguard-bot# systemctl status wireguard-bot.service

Feb 07 19:24:03 botgw systemd[1]: Started wireguard-bot.service - WireGuard VPN Bot.

Bilalline commented 7 months ago

2024-02-07 19:55:36.848 | SUCCESS | utils.vpn_cfg_work:restart_service:82 - [+] wireguard service restarted 2024-02-07 19:56:37.417 | ERROR | database.selector:all_user_configs:55 - [-] relation "vpn_config" does not exist LINE 2: SELECT config_name FROM vpn_config WHERE use... ^

2024-02-07 19:56:37.428 | ERROR | database.selector:is_subscription_end:73 - [-] relation "users" does not exist LINE 2: SELECT subscription_end_date FROM users WHER... ^

2024-02-07 19:58:38.736 | ERROR | database.selector:get_subscription_end_date:91 - [-] relation "users" does not exist LINE 2: SELECT subscription_end_date FROM users WHER... ^

2024-02-07 19:59:41.481 | ERROR | database.selector:is_subscription_end:73 - [-] relation "users" does not exist LINE 2: SELECT subscription_end_date FROM users WHER... ^

2024-02-07 20:00:42.208 | ERROR | database.selector:all_user_configs:55 - [-] relation "vpn_config" does not exist LINE 2: SELECT config_name FROM vpn_config WHERE use... ^

2024-02-07 20:00:42.218 | ERROR | database.selector:all_user_configs:55 - [-] relation "vpn_config" does not exist LINE 2: SELECT config_name FROM vpn_config WHERE use... ^

2024-02-07 20:01:42.899 | ERROR | database.selector:all_user_configs:55 - [-] relation "vpn_config" does not exist LINE 2: SELECT config_name FROM vpn_config WHERE use...

PheeZz commented 7 months ago

Sorry for the long waiting. Now I have some troubles with moving project inside docker, wireguard just don't want to work. Your last message seems like database tables not configured. Check 7 point of installation guide