___ _ _ _____ __ __ ___ ____ ____ ___ ____
|_ _|| \ | || ___| | \/ ||_ _|| _ \ | _ \ / _ \ | _ \
| | | \| || |_ _____ | |\/| | | | | |_) || |_) || | | || |_) |
| | | |\ || _| |_____|| | | | | | | _ < | _ < | |_| || _ <
|___||_| \_||_| |_| |_||___||_| \_\|_| \_\ \___/ |_| \_\
Setup development environment with Docker
Install Docker:
General installation instructions are on the Docker site
Start a mongodb instance:
docker volume create mongo_data
docker run -d --restart=on-failure:3 -p 27017:27017 -v mongo_data:/data/db \
--name mongo \
-e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=secret mongo:4-bionic
https://hub.docker.com/_/mongo
Optional compass:
https://www.mongodb.com/products/compass
Start a postgres instance:
docker volume create postgres_data
docker run -d --restart=on-failure:3 -p 5432:5432 -v postgres_data:/var/lib/postgresql/data \
--name postgres -e POSTGRES_PASSWORD=secret postgres:12-alpine
https://hub.docker.com/_/postgres/
Optional pgAdmin:
docker run -d --restart=on-failure:3 -p 5480:80 --name pgadmin4 \
-e PGADMIN_DEFAULT_EMAIL=postgres@polixir.ai -e PGADMIN_DEFAULT_PASSWORD=secret dpage/pgadmin4
https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html
Start a redis instance:
docker run -d --restart=on-failure:3 -p 6379:6379 --name universe_redis redis:5-alpine \
--appendonly yes --requirepass secret
https://hub.docker.com/_/redis/
Created a new local CA:
mkcert -install
Created a new local CA at "/Users/filippo/Library/Application Support/mkcert" 💥
The local CA is now installed in the system trust store! ⚡️
The local CA is now installed in the Firefox trust store (requires browser restart)! 🦊
https://github.com/FiloSottile/mkcert
Start a NATS instance:
docker run -d --restart=on-failure:3 -p 4222:4222 -p 4443:4443 -p 8222:8222 --name universe_nats nats-websocket:alpine
https://hub.docker.com/_/nats/
Start a RabbitMQ instance:
docker run -d --restart=on-failure:3 -p 5672:5672 -p 1883:1883 -p 15675:15675 -p 15672:15672 --name universe_rabbitmq \
-e RABBITMQ_DEFAULT_USER=rabbitadmin -e RABBITMQ_DEFAULT_PASS=secret rabbitmq:3-management-alpine
https://hub.docker.com/_/rabbitmq/
Start a flower: Real-time Celery web-monitor instance:
docker run -d --restart=on-failure:3 -p 5555:5555 --name universe_flower \
-e CELERY_BROKER_URL=amqp://rabbitadmin:secret@172.17.0.1:5672 mher/flower
https://hub.docker.com/r/mher/flower
Setup python development environment
Install pre-commit hooks:
https://pre-commit.com/#install
Creating an environment from an environment.yml file:
Use the terminal or an Anaconda Prompt for the following steps:
- Create the environment from the
environment.yml
file:
conda env create -f environment.yml
- Activate the new environment:
conda activate universe_backend
python -m grpc_tools.protoc --proto_path=./infmir/protocols --python_out=./infmir/protocols --python_grpc_out=./infmir/protocols runtime.proto