* Pyenv
* If Python 3.6 is already available on your favorite distro, you can skip this step
* Python 3.6.2
* Pip
* Latest version
* GNU Make
* Docker 17.05
* Docker Compose
Install pyenv-virtualenvwrapper:
git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper
Launch pyenv virtualenvwrapper:
pyenv virtualenvwrapper
Builds containers, sets up a venv, brings a compose environment, migrates the database and imports test data. This will take a while, so be patient
make all
Install requirements in your virtual machine
pip install -r requirements.txt
make env
Run this every time the container is built
. ./scripts/local_env.sh
This will populate the environment variables to your local env (aka the docker host)
Errors such as log level not found
are often due to forgetting this step
Tests have been separated into unit and functional tests. Currently, the default test environment only triggers the unit tests, as functional tests are very heavy weight and require containers to run. Unit tests can be triggered with:
tox
Additionally, you can pass the name of the tox unit environment directly with -e:
tox -e unit
Similarly, to run functional tets:
tox -e functional
A docker-compose configuration has been provided, which starts web service and database containers for easier testing.
make
- See what other options are availablemake run
- Start all containers and restore databasemake database
- Drop the current database and restore it from the most recent prod backupmake web_cli
- Go to the web container CLImake db_cli
- Enter the database container CLI, jumping directly into MySQLmake reset_web
- Reset the lifeloopweb_web_1 container. You MUST do this anytime you change an environment variablemake stop
- Teardown compose containers (You will need to delete the containers for a thorough cleanup)make webpack
- Runs a webpack watcher
By adding these aliases to your .bash_profile, you can use the dka command to quickly and methodically delete everything associated with your running docker containers.
Outside of your env:
alias dka='dkc;dki;dkv'
alias dkc='docker ps -aq | xargs docker rm -f'
alias dki='docker images -aq | xargs docker rmi -f'
alias dkv='docker volume ls -qf dangling=true | xargs docker volume rm'
make shell
Then:
In [1]: from lifeloopweb import *
Create a template file and update the head reference:
lifeloop_db_manage revision -m "Revision File Name"
Run the completed migration:
lifeloop_db_manage upgrade head
Cleaning up after yourself:
lifeloop_db_manage drop_tables
Don't forget to rebuild your containers:
make reset_web