PMSF
PMSF copied to clipboard
OAuth2 integration for Discord
There will need to be substantial additions to documentation. These instructions assume a nginx server on Ubuntu 16.04
You will need a discord bot user in your server. Here is a link on how to set it up: https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token
-
sudo pip3 install virtualenv
-
virtualenv env
-
source env/bin/activate
-
pip3 install -r requirements.txt
-
deactivate
- set values in oauth2/config/config.ini
- move oauth2.service to /etc/systemd/system
-
sudo systemctl enable oauth2
andsudo systemctl start oauth2
- add this to your site-enabled conf file
location /login {
include proxy_params;
proxy_pass http://unix:/var/www/html/PMSF/oauth2/oauth2.sock:/login;
}
-
sudo systemctl restart nginx
- Probably some permission settings for your PATH/TO/PMSF, idk
What is still needed:
- better templates for when access is denied (for now it either says "ACCESS DENIED" or "INSUFFICENT ROLES"
- for to have a config option to disable oauth2 in index.php
- Better instructions that above and probably for varying OS's and also for Apache
Stuck at ..
` systemctl start oauth2 [root@vpsxxxxxxx PMSF]# systemctl status oauth2 ● oauth2.service - Gunicorn instance to serve oauth2 Loaded: loaded (/etc/systemd/system/oauth2.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sun 2017-08-20 01:17:23 EDT; 4s ago Process: 15388 ExecStart=/var/www/html/PMSF/oauth2/env/bin/gunicorn --workers 3 --bind unix:oauth2.sock -m 007 wsgi:app (code=exited, status=216/GROUP) Main PID: 15388 (code=exited, status=216/GROUP)
Aug 20 01:17:23 vpsxxxxxxx.vps.ovh.ca systemd[1]: Started Gunicorn instance to serve oauth2. Aug 20 01:17:23 vpsxxxxxxx.vps.ovh.ca systemd[1]: Starting Gunicorn instance to serve oauth2... Aug 20 01:17:23 vpsxxxxxxx.vps.ovh.ca systemd[1]: oauth2.service: main process exited, code=exited, status=216/GROUP Aug 20 01:17:23 vpsxxxxxxx.vps.ovh.ca systemd[1]: Unit oauth2.service entered failed state. Aug 20 01:17:23 vpsxxxxxxx.vps.ovh.ca systemd[1]: oauth2.service failed. `
Also, this requires that PMSF is installed in /var/www/html/PMSF as per the oauth2 service env path.
Also var/www/html/PMSF/oauth2/env/ didn't get created till after running 7. pip3 install -r requirements.txt
yet the service is asked to be started in step 3.
I updated the order of the steps which hopefully is a better order. Also, I meant to replace the /var/www/html/PMSF with PATH/TO/PMSF but I never could get it to work anywhere else but that folder. Maybe someone better understanding permissions can figure out how to make it work elsewhere. Two places to look for error messages are in /var/log/nginx/error.log
and also by running the command sudo journalctl -u oauth2
. Lastly what doe the console say when you run this command:
/var/www/html/PMSF/oauth2/env/bin/gunicorn --workers 3 --bind unix:oauth2.sock -m 007 wsgi:app
https://pastebin.com/HdxiTWTY
ModuleNotFoundError: No module named 'wsgi'
Running on centos7. Already have installed mod_wsgi
@tallypokemap I haven't run the code yet but there's a circular reference in bot.py and oauth2.py.
Howdy, can't get it run tho to this error:
root:/var/www/PMSF/oauth2# python3 bot.py
Traceback (most recent call last):
File "bot.py", line 8, in
@tallypokemap Have you stop working on this?