Skip to content

Commit

Permalink
production fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maltaesousa committed Oct 7, 2020
1 parent 6df6078 commit 320b95a
Show file tree
Hide file tree
Showing 20 changed files with 311 additions and 174 deletions.
25 changes: 7 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,14 @@ Then open a browser and go to [Geoshop2](http://localhost:4200)

## Deploy

collect static files:
Create an `env.prod` file base on `env.sample`.

```powershell
python .\manage.py collectstatic
```

configure apache
### Database setup

```apache
Alias /back_enpoint/static "/path/to/folder/back/static/"
<Directory "/path/to/folder/back/static/">
Require all granted
</Directory>
Migrate database from old geoshop. This is not covered by documentation.

WSGIScriptAlias /back_enpoint /path/to/file/back/apache/app.wsgi
### Application deployment

<Directory /path/to/file/back/apache>
<Files app.wsgi>
Require all granted
</Files>
</Directory>
```
```powershell
.\scripts\4_deploy_prod.ps1
```
1 change: 1 addition & 0 deletions back/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
__pycache__.venv
Dockerfile
./files/*
.env
2 changes: 1 addition & 1 deletion back/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PGPORT=5432
PGPASSWORD=geoshop
PGSCHEMA=geoshop
PGPOSTGRESPASSWORD=postgres

PROD_HOST=prod_server
ALLOWED_HOST=localhost,127.0.0.1
GDAL_IN_VENV=True
GDAL_DATA=path\to\.venv\Lib\site-packages\osgeo\data\gdal
Expand Down
2 changes: 2 additions & 0 deletions back/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ __pycache__/
local_settings.py

.env
.env.prod
.env.prepub
db.sqlite3
.venv
static/*
Expand Down
3 changes: 3 additions & 0 deletions back/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ ENV PYTHONUNBUFFERED 1
COPY . /app/geoshop_back/
WORKDIR /app/geoshop_back/

ARG ENV_FILE
RUN mv ${ENV_FILE} .env

RUN pip3 install -r requirements.txt
RUN export $(egrep -v '^#' .env | xargs) && \
python manage.py migrate && \
Expand Down
Loading

0 comments on commit 320b95a

Please sign in to comment.