Cryptocurrency signal aggregator and trade executor.
Go to file
2023-02-11 18:07:05 +00:00
app Use cachalot to invalidate caches 2023-02-11 17:22:25 +00:00
core Re-add property fields 2023-02-11 18:07:05 +00:00
docker Optimise performance with caching 2023-02-11 14:00:09 +00:00
.gitignore Add Python history to gitignore 2022-11-04 07:20:25 +00:00
.pre-commit-config.yaml Update pre-commit versions 2023-02-09 07:20:17 +00:00
docker-compose.yml Optimise performance with caching 2023-02-11 14:00:09 +00:00
Dockerfile Switch to UWSGI and improve Docker definitions 2022-10-18 07:22:22 +01:00
Makefile Begin writing live tests 2023-01-01 21:52:43 +00:00
manage.py Upload template project 2022-10-13 15:26:43 +01:00
README.md Upload template project 2022-10-13 15:26:43 +01:00
requirements.txt Use cachalot to invalidate caches 2023-02-11 17:22:25 +00:00

Fisk

Cryptocurrency signal aggregator and trade executor.

Setting up the environment

Create the virtual environment, enable it, and install the dependencies.

$ python3 -m venv env
$ source env/bin/activate
(env) $ pip install -r docker/prod/requirements.prod.txt

Local settings

You'll need to copy the app/local_settings.example.py file to app/local_settings.py. The project won't start otherwise.

$ cp app/local_settings.example.py app/local_settings.py

stack.env

The stack.env file referenced is a Portainer special. This is where Portainer would put a file containing all the environment variables set up in its UI. To run it manually, you will need to copy stack.env.example to stack.env in the project root.

Running database migrations

Now we need to run the database migrations in order to get a working database.

(env) $ python manage.py migrate

Note that these are automatically run by a step in the compose file in production. You won't need to do that manually.

Creating a superuser

In order to access Django admin, we need a superuser.

(env) $ python manage.py createsuperuser
Username: t2
Email address: t2@google.com
Password: 
Password (again): 
Superuser created successfully.

Running

The Docker Compose file is located in docker/docker-compose.prod.yml. There is a shortcut to run it: make run.

Stopping

To stop the containers, run make stop.

Setup

This setup may be different from what you've seen before.

Uvicorn

There is a Uvicorn worker in the app container listening on /var/run/socks/app.sock. This is the bit that runs the actual code.

Nginx

Nginx runs in the nginx container and proxies requests to Uvicorn thanks to a mounted and shared directory. No TCP required.

Pre-start steps

There's a few commands running before start to ensure Django works correctly.

Migration

The migration container step runs the migrations so you don't need to remember to do it.

Collectstatic

The collectstatic container step collects all static files from plugins and puts them in the core/static folder. This folder is served straight from Nginx without going through Uvicorn.