From a117ba8beaba85093e01b5805d0e64525717b702 Mon Sep 17 00:00:00 2001 From: FUNNYDMAN Date: Wed, 31 Oct 2018 23:15:12 +0300 Subject: [PATCH] add simple nginx config --- README.md | 53 ++++++++++++++++++++++++++++++++++--------- deployment/.keep | 0 deployment/eshop.conf | 11 +++++++++ 3 files changed, 53 insertions(+), 11 deletions(-) delete mode 100644 deployment/.keep create mode 100644 deployment/eshop.conf diff --git a/README.md b/README.md index b1f8fb2..8a59d5c 100644 --- a/README.md +++ b/README.md @@ -8,27 +8,58 @@ --- ### Server configuration -1. Use systemd file with name gunicorn-eshop.service to initialize gunicorn server with DJANGO_SETTINGS_MODULE environment var -2. Use systemd file with name celery-eshop.service to initialize celery following with these [instructions](http://docs.celeryproject.org/en/latest/userguide/daemonizing.html#usage-systemd "Celery | Daemonization") -2. Install virtualenv inside the project directory in run server -3. Install dependencies from inside the activated virtualenv -4. Create empty logs dir in project directory -5. Install nodejs with npm(nvm preferably) -6. install all packages +1. Install necessary packages: +```bash +sudo apt-get install -y libpq-dev postgresql nginx virtualenv +curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - +sudo apt-get install -y nodejs +``` + +2. Create database: +```bash +CREATE DATABASE eshop_db; +CREATE USER eshop_admin WITH password '12345678'; +GRANT ALL ON DATABASE eshop_db TO eshop_admin; + +# Allow user to create db for running django tests + +ALTER USER eshop_admin CREATEDB; +``` + +3. Install virtualenv inside the project directory and activate it: +```bash +virtualenv --python3=$(which python3) venv +source venv/bin/activate +``` + +4. Use systemd file with name gunicorn-eshop.service to initialize gunicorn server with DJANGO_SETTINGS_MODULE environment var +5. Use systemd file with name celery-eshop.service to initialize celery following with these [instructions](http://docs.celeryproject.org/en/latest/userguide/daemonizing.html#usage-systemd "Celery | Daemonization") +6. Install dependencies from inside the activated virtualenv: +```bash +pip install -r requirements.txt +``` + +7. Install all packages from package.json and collect static files +```bash +npm i +./node_modules/gulp/bin/gulp.js default +``` + +8. Create empty logs dir in project directory + ###Development -1. Activate eshop environment using virtualenvwrapper(workon) +1. Activate eshop environment using virtualenv 2. Make .env file with the structure described in .env.sample file 3. Make migrations for modules: auth, accounts_ext, etc. 4. Start celery queue for tasks with the command: `celery -A eshop_project worker -l info --pool=eventlet` -5. Make alias for gulp with alias command and path gulp executable file -6. Run `gulp default` + ###Deployment -1. Activate eshop environment using virtualenvwrapper(workon) +1. Activate eshop environment using virtualenv 2. Make pull request from bitbucket repo by ssh using passphrase 3. Make .env file with the structure described in .env.sample file 4. Make migrations for modules diff --git a/deployment/.keep b/deployment/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/deployment/eshop.conf b/deployment/eshop.conf new file mode 100644 index 0000000..400ede6 --- /dev/null +++ b/deployment/eshop.conf @@ -0,0 +1,11 @@ + server { + server_name name_or_ip; + listen 80; + location / { + proxy_pass http://localhost:8000; + } + + location /static/ { + root path_to_static_files; + } + }