diff --git a/bin/run-celery.sh b/bin/run-celery.sh deleted file mode 100755 index e26d6d6..0000000 --- a/bin/run-celery.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -celery -A db worker -B -l INFO diff --git a/bin/run-web.sh b/bin/run-web.sh deleted file mode 100755 index fc36c49..0000000 --- a/bin/run-web.sh +++ /dev/null @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index b14195f..f878951 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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' diff --git a/docker/dev b/docker/dev deleted file mode 100644 index 4a772d4..0000000 --- a/docker/dev +++ /dev/null @@ -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"] diff --git a/docs/installation-docker.rst b/docs/installation-docker.rst index 5eeda2b..94380c3 100644 --- a/docs/installation-docker.rst +++ b/docs/installation-docker.rst @@ -6,34 +6,29 @@ Docker Installation You will need `docker `_ and `docker-compose `_. -#. **Build the containers** +#. **Get the source code** Clone source code from the `repository `_:: $ 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! diff --git a/docs/installation-virtualenv.rst b/docs/installation-virtualenv.rst index f9d21f7..3b3e04c 100644 --- a/docs/installation-virtualenv.rst +++ b/docs/installation-virtualenv.rst @@ -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 `_:: $ 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!