From dcb7e920edc3eb703397b8dc2dc799b430fdac94 Mon Sep 17 00:00:00 2001 From: Mustafa Yontar Date: Wed, 15 Apr 2020 15:49:20 +0300 Subject: [PATCH] readme change and service file wsgi file add --- README.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++++- example.service | 13 +++++++++++ wsgi.py | 4 ++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 example.service create mode 100644 wsgi.py diff --git a/README.md b/README.md index 7ea3e07..d64b452 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,61 @@ Albatross Backend, we called a Thoth **Requirements** * Please ensure ffmpeg installed version 4.0 and above -* Python 3.7 and above \ No newline at end of file +* Python 3.7 and above +* mongodb 4.0 and above + +**Installing For Development** + +`pip install -r requirements.txt` + +after then everything is success you can set a environ parameters for janus and mongodb + +`export JWT_SECRET_KEY=CHANGE_ME` + +`export JANUS_URL=http:/changeme` + +`export JANUS_ADMIN_KEY=CHANGE_ME` + +`export MONGODB_URL=mongodb://server/db` + +now you can run a development server. + +`python app.py` + +also you can run without global export like a : + +`JWT_SECRET_KEY=CHANGE_ME JANUS_URL=http:/changeme export JANUS_ADMIN_KEY=CHANGE_ME MONGODB_URL=mongodb://server/db python app.py +` + +**Installing For Production** + +Create a virtual env + +`cd albatrosfolder` + +`python -m venv .venv` + +activate a virtual env + +`source .venv/bin/activate` + +after then install requirements + +`pip install -r requirements.txt` + +install a gunicorn + +`pip install gunicorn` + +change example.service file for your environment + +after then, copy service file to systemd folder + +`sudo cp example.service /etc/systemd/system/albatorss.service` + + +`sudo systemctl start albatorss` + +`sudo systemctl enable albatorss` + + diff --git a/example.service b/example.service new file mode 100644 index 0000000..db08e2b --- /dev/null +++ b/example.service @@ -0,0 +1,13 @@ +[Unit] +Description=Gunicorn instance to serve Albatros/Thoth +After=network.target + +[Service] +User=sammy +Group=www-data +WorkingDirectory=/home/albatros/albatrosfolder +Environment="PATH=/home/albatros/albatrosfolder/.venv/bin;JWT_SECRET_KEY=CHANGE_ME;JANUS_URL=http:/changeme export;JANUS_ADMIN_KEY=CHANGE_ME;MONGODB_URL=mongodb://server/db" +ExecStart=/home/albatros/albatrosfolder/.venv/bin --workers 3 --bind unix:myproject.sock -m 007 wsgi:app + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/wsgi.py b/wsgi.py new file mode 100644 index 0000000..5ce9f6c --- /dev/null +++ b/wsgi.py @@ -0,0 +1,4 @@ +from .app import app + +if __name__ == "__main__": + app.run() \ No newline at end of file