1
0
Fork 0

Use 'djangoctl.sh' or production image to run application

Signed-off-by: Vasilis Tsiligiannis <acinonyx@openwrt.gr>
environments/stage/deployments/60
Vasilis Tsiligiannis 2018-11-09 22:20:09 +02:00
parent 8bce163657
commit d76c399d24
6 changed files with 47 additions and 84 deletions

View File

@ -1,3 +0,0 @@
#!/bin/bash
celery -A db worker -B -l INFO

View File

@ -1,7 +0,0 @@
#!/bin/bash
find ./staticfiles -mindepth 1 -not -name '.gitkeep'| xargs rm -rf
./manage.py collectstatic --noinput
./manage.py compress --force
./manage.py migrate --noinput
./manage.py runserver 0.0.0.0:8000

View File

@ -1,41 +1,35 @@
version: '3.1'
version: '3.2'
services:
db:
image: mariadb:10.3
image: 'mariadb:10.3'
environment:
- MYSQL_DATABASE=satnogsdb
- MYSQL_USER=satnogsdb
- MYSQL_PASSWORD=satnogsdb
- MYSQL_ROOT_PASSWORD=toor
MYSQL_DATABASE: 'satnogsdb'
MYSQL_USER: 'satnogsdb'
MYSQL_PASSWORD: 'satnogsdb'
MYSQL_ROOT_PASSWORD: 'toor'
redis:
image: redis:3.2.8
image: 'redis:3.2.8'
celery:
build:
context: .
dockerfile: docker/dev
volumes:
- .:/app
context: '.'
links:
- db
- redis
- 'db'
- 'redis'
environment:
- DATABASE_URL=mysql://satnogsdb:satnogsdb@db/satnogsdb
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
command:
./bin/run-celery.sh
DATABASE_URL: 'mysql://satnogsdb:satnogsdb@db/satnogsdb'
CELERY_BROKER_URL: 'redis://redis:6379/0'
CELERY_RESULT_BACKEND: 'redis://redis:6379/0'
command: ["celery", "-A", "db", "worker", "-B", "-l", "INFO"]
web:
build:
context: .
dockerfile: docker/dev
context: '.'
ports:
- "8000:8000"
volumes:
- .:/app
- '8000:8000'
links:
- db
- redis
- 'db'
- 'redis'
environment:
- DATABASE_URL=mysql://satnogsdb:satnogsdb@db/satnogsdb
command:
./bin/run-web.sh
DATABASE_URL: 'mysql://satnogsdb:satnogsdb@db/satnogsdb'
command: ["djangoctl.sh", "develop", "/usr/local/src/satnogs-db"]
volumes:
- '.:/usr/local/src/satnogs-db'

View File

@ -1,15 +0,0 @@
FROM centos:7
RUN yum makecache
RUN yum -y install epel-release
RUN yum -y install python python-pip python-devel git gcc libjpeg-turbo-devel \
libxml2-devel libxslt-devel mysql-devel mysql
RUN yum -y clean all
RUN pip install --upgrade pip
COPY ./requirements.txt /tmp/requirements.txt
COPY ./requirements-dev.txt /tmp/requirements-dev.txt
RUN pip install --no-cache-dir --no-deps --ignore-installed -r /tmp/requirements-dev.txt
WORKDIR /app
EXPOSE 80
CMD ["./bin/run-docker.sh"]

View File

@ -6,34 +6,29 @@ Docker Installation
You will need `docker <https://docs.docker.com/installation/#installation>`_ and `docker-compose <https://docs.docker.com/compose/install/>`_.
#. **Build the containers**
#. **Get the source code**
Clone source code from the `repository <https://gitlab.com/librespacefoundation/satnogs/satnogs-db>`_::
$ git clone https://gitlab.com/librespacefoundation/satnogs/satnogs-db.git
$ cd satnogs-db
#. **Configure settings**
Set your environmental variables::
$ cp env-dist .env
Start database containers::
$ docker-compose up -d db
Build satnogs-db container::
$ docker-compose build web
Run the initialize script to populate the database with scheme and demo data::
$ docker-compose run web python manage.py initialize
#. **Run it!**
Run satnogs-db::
$ docker-compose up
$ docker-compose up -d --build
#. **Populate database**
Create, setup and populate the database with demo data::
$ docker-compose exec web djangoctl.sh initialize
Your satnogs-db development instance is available in localhost:8000. Go hack!

View File

@ -1,44 +1,43 @@
VirtualEnv Installation
=======================
Requirements: You will need python, python-virtualenvwrapper, pip and git
#. **Requirements**
You will need python, python-virtualenvwrapper, pip and git
#. **Build the environment**
#. **Get the source code**
Clone source code from the `repository <https://gitlab.com/librespacefoundation/satnogs/satnogs-db>`_::
$ git clone https://gitlab.com/librespacefoundation/satnogs/satnogs-db.git
$ cd satnogs-db
#. **Build the environment**
Set up the virtual environment. On first run you should create it and link it to your project path.::
$ cd satnogs-db
$ mkvirtualenv satnogs-db -a .
#. **Configure settings**
Set your environmental variables::
$ cp env-dist .env
#. **Run it!**
Activate your python virtual environment::
$ workon satnogs-db
Install local development requirements::
Just run it::
$ (satnogs-db)$ pip install -r requirements-dev.txt
(satnogs-db)$ ./bin/djangoctl.sh develop .
#. **Database**
#. **Populate database**
Create, setup and populate the database with demo data::
(satnogs-db)$ ./manage.py initialize
(satnogs-db)$ ./bin/djangoctl.sh initialize
#. **Run it!**
Just run it::
(satnogs-db)$ ./manage.py runserver
Your satnogs-db development instance is available in localhost:8000. Go hack!
Your satnogs-db development instance is available in localhost:8000. Go hack!