Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature more make commands, and doc converted to markdown #43

Merged
merged 6 commits into from
Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 0 additions & 175 deletions DOCKER_INSTALL.rst

This file was deleted.

26 changes: 22 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

.PHONY: version vars init-venv build build-travis init-db reset \
up down logs restart restart-web \
collectstatic deploy dump restore release \
superadmin collectstatic migrations migrate \
dump restore release push-prod deploy \
test coverage

VERSION = $(shell python update_release.py -v)
Expand Down Expand Up @@ -80,13 +81,14 @@ init-db:
docker-compose -f docker-compose-dev.yml exec postgres \
psql ${DB_NAME} -c "ALTER ROLE ${DATABASE_USER} WITH CREATEDB;" -U postgres
# initialize DBs executing migration scripts
docker-compose -f docker-compose-dev.yml exec web \
python infoscience_exports/manage.py makemigrations
docker-compose -f docker-compose-dev.yml exec web \
python infoscience_exports/manage.py migrate
docker-compose -f docker-compose-dev.yml exec web \
python infoscience_exports/manage.py migrate --database=mock
# create super admin in app
docker-compose -f docker-compose-dev.yml exec web \
python infoscience_exports/manage.py createsuperuser --username=${SUPER_ADMIN_USERNAME} --email=${SUPER_ADMIN_EMAIL} --noinput
make superadmin
@echo " -> All set up! You can connect with your tequila acount or the admin (${SUPER_ADMIN_EMAIL})"

reset: build up
Expand All @@ -95,6 +97,7 @@ reset: build up
@echo ''
sleep 3
make init-db
make collectstatic

up:
docker-compose -f docker-compose-dev.yml up -d
Expand All @@ -115,10 +118,25 @@ restart-web:
docker-compose -f docker-compose-dev.yml stop web
docker-compose -f docker-compose-dev.yml start web

collectstatic:
superadmin: up
docker-compose -f docker-compose-dev.yml exec web \
python infoscience_exports/manage.py shell -c "from django.contrib.auth import get_user_model; \
User = get_user_model(); \
User.objects.filter(email='${SUPER_ADMIN_EMAIL}').delete(); \
User.objects.create_superuser('${SUPER_ADMIN_USERNAME}', '${SUPER_ADMIN_EMAIL}', '${SUPER_ADMIN_PASSWORD}');"

collectstatic: up
docker-compose -f docker-compose-dev.yml exec web \
python infoscience_exports/manage.py collectstatic --noinput

migrations: up
docker-compose -f docker-compose-dev.yml exec web \
python infoscience_exports/manage.py makemigrations

migrate: up
docker-compose -f docker-compose-dev.yml exec web \
python infoscience_exports/manage.py migrate

dump:
@echo dumping DB on last commit `git rev-parse --verify HEAD`
docker-compose -f docker-compose-dev.yml run --rm \
Expand Down
6 changes: 0 additions & 6 deletions Procfile

This file was deleted.

8 changes: 0 additions & 8 deletions circle.yml

This file was deleted.

File renamed without changes.
File renamed without changes.
72 changes: 30 additions & 42 deletions INSTALL.rst → doc/DEV_INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,101 +1,89 @@
======================
Getting up and running
======================
# Getting up and running

First, choose if you want to run your application with Docker. If this is the case, go to DOCKER_INSTALL.rst. Otherwise, continue here.
First, choose if you want to run your application with Docker. If this is the case, go to INSTALL.rst. Otherwise, continue here.


Prerequistes
------------
## Prerequistes

The steps below will get you up and running with a local development environment. We assume you have the following installed:

* pip
* virtualenv / virtualwrapper
* PostgreSQL

Requirements
------------
## Requirements

In your virtualenv (activate), run::

$ pip install -r ./requirements.txt

pip install -r ./requirements.txt

Postgres install
----------------
## Postgres install

Install PostgreSQL and some libraries::

$ sudo apt-get install postgresql postgresql-client postgresql-server-dev-all libjpeg-dev
sudo apt-get install postgresql postgresql-client postgresql-server-dev-all libjpeg-dev

Postgres config
---------------
## Postgres config

Move to su::
$ su
su

Be the postgres user::

$ su - postgres
su - postgres

Create the user django, with django as password::

$ createuser -SR -P django
createuser -SR -P django

$ psql -c 'ALTER ROLE django WITH CREATEDB' -U postgres
psql -c 'ALTER ROLE django WITH CREATEDB' -U postgres

create the db::

$ createdb -O django infoscience_exports
createdb -O django infoscience_exports

$ createdb -O django mock_infoscience_exports
createdb -O django mock_infoscience_exports


Django config
-------------
## Django config

Do the first migration::

$ fab migrate
$ fab migrate_mock
fab migrate
fab migrate_mock

It may be the good timing to set your environment variable::

$ export DATABASE_PASSWORD='django'
export DATABASE_PASSWORD='django'

Load mock data::

$ python ./infoscience_exports/manage.py loaddata --app exports --database mock initial_data
python ./infoscience_exports/manage.py loaddata --app exports --database mock initial_data

Create your user::

$ python ./infoscience_exports/manage.py createsuperuser
python ./infoscience_exports/manage.py createsuperuser

Verify with the tests::

$ fab test
fab test

See by yourself live::

$ fab serve
fab serve

And go to `http://127.0.0.1:${DEV_PORT}/exports <http://127.0.0.1:8000/exports/>`_.

====================================
How to start the development process
====================================
## How to start the development process

Here is the standard config to have a nice synchronisation with the different repositories. Let's suppose you have not any existing repository.

Don't forget to set tequila_user_name to the right value::

$ git clone [email protected]:epfl-idevelop/infoscience-exports.git
$ git remote add github [email protected]:epfl-idevelop/infoscience-exports.git
$ git remote add gitlab [email protected]:infoscience/infoscience-exports.git
$ git remote add epfl https://[email protected]/repo/infoscience-exports.git
$ git remote set-url --add origin [email protected]:infoscience/infoscience-exports.git
$ git remote set-url --add origin https://[email protected]/repo/infoscience-exports.git
git clone [email protected]:epfl-idevelop/infoscience-exports.git
git remote add github [email protected]:epfl-idevelop/infoscience-exports.git
git remote add gitlab [email protected]:infoscience/infoscience-exports.git
git remote add epfl https://[email protected]/repo/infoscience-exports.git
git remote set-url --add origin [email protected]:infoscience/infoscience-exports.git
git remote set-url --add origin https://[email protected]/repo/infoscience-exports.git

This will work flawlessly with git push.

Expand Down
Loading