- Docker
- Ubuntu: follow this guide: https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
- MacOs: https://download.docker.com/mac/edge/Docker.dmg
- Other dist: you should know what your doing
- wercker-cli
- Ubuntu:
curl -L https://s3.amazonaws.com/downloads.wercker.com/cli/stable/linux_amd64/wercker -o /usr/local/bin/wercker && chmod u+x /usr/local/bin/wercker
- MacOS (home-brew required):
brew install wercker-cli && brew tap wercker/wercker
Docs: https://www.wercker.com/wercker-cli https://www.wercker.com/cli/install/osx (OSX) https://www.wercker.com/cli/install/linux (Linux)
-
Optionally change POSTGRES_USER, POSTGRES_PASSWORD and POSTGRES_DB in the services section of wercker.yml file
-
Optionally change values for other variables in the ENVIRONMENT file
-
run
$ wercker dev --expose-ports
to start container -
Access http://localhost:8000
-
Disable Renos coin in case you are not running a local RPC node: http://localhost:8000/en/admin/core/currency/33/change/ (tick disabled and save) You will have to repeat this action for every time you start the
wercker-dev
pipeline until we implement a more permament solution.
Tests always run when you commit, but you may want to run them mannualy sometimes. Therefore:
- To manually run tests you can use django-pytest module. i.e.
pytest nexchange/tests/test_ethash.py -k test_release
. Default configuration: pytest.ini. - To manually run backend tests:
./run-tests.sh
- To manually run backend tests and send coverage report to coveralls.io:
./run-tests.sh -c 1
- To manually run Selenium UI tests
./run-selenium-tests.sh
. Screenshots of the tests can be found innexchange/core/tests/test_ui/Screenshots
- To manually run API tests:
./run-api-tests.sh
. More info here.
Every time you do git commit
the script.pre-commit.sh will run.
It will trigger, in order:
- static validation of the code, running flake8
- backend tests (django unit tests)
If any of this steps fail, file won't be commited.
(After you run the tests, you can see a coverage report of the backend tests at http://localhost:8000/cover/index.html)
You can read more about these tests in the readme_werker.md on this directory.
- All features or anything which is not a one liner goes into a branch which results in a PR to
staging
. Which then must be reviewed, and propgated into a pull request. - One liners and small patches can go to
staging
, with a PR to release. - No commits, nor rebases on release
If you want to use pycharm debugger, you are going to have to run the app with docker-compose.
-
make a docker image of a running app. run
wercker dev --expose-ports
and thendocker commit <running app container id> onitsoft/runningapp
-
You need to set up the remote interpreter. Go to project interpreter, choose add remote, choose docker compose, set configuration file to
docker-compose-dev.yml
, serviceapp
, python path:python
. If you set environment variables here to, it is possible, that the step 3 is not necessary, but I haven't tested it:
POSTGRES_USER=nexchange
POSTGRES_PASSWORD=nexchange
POSTGRES_DB=nexchange
POSTGIS_ENV_POSTGRES_DB=nexchange
POSTGIS_ENV_POSTGRES_USER=nexchange
POSTGIS_ENV_POSTGRES_PASSWORD=nexchange
- In docker settings set /tmp folder to be mountable. Or remap folders in the
docker-compose-dev.yml
file to some mountable location. - Run it with
docker-compose -f docker-compose-dev.yml up
in the project directory. If there is no errors, you are lucky. If there are complaints, that database nexchange does not exist, or the role nexchange does not exist, or that user nexchange needs to be a super user, connect to the running db containerdocker exec -it ce0fb4a6e4fd bash
from your host machine, and run
su postgres
createdb nexchange
createuser -s nexchange
-
Again go to pycharm project interpreter settings. Set path mappings local path to local project folder on the host machine and remote path to
/pipeline/source
-
In pycharm, set project build run script to
/pipeline/source/manage.py
, parameters torunserver --settings=nexchange.settings_dev 0.0.0.0:8000
Interpreter should be set correctly to the remote interpreter by default.
Thats it, now you should be able to run the project and use the inbuilt debugger.
Set up autopep8 and isort. Use it on the files you edit. Set autopep8 --max-line-length 79