You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.0 KiB
70 lines
2.0 KiB
|
|
**Online software storefront**
|
|
---
|
|
**Python version: 3.5.2**
|
|
|
|
**Django 2.0**
|
|
|
|
---
|
|
|
|
### Server configuration
|
|
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 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`
|
|
|
|
|
|
###Deployment
|
|
|
|
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
|
|
5. Collect static
|
|
6. Restart gunicorn-eshop and celery-eshop daemons in systemd
|
|
7. Load fixture core fixture sites to configure site domain (before the FIRST http request)
|
|
|
|
|
|
|