GithubHelp home page GithubHelp logo

isabella232 / safe-infrastructure Goto Github PK

View Code? Open in Web Editor NEW

This project forked from safe-global/safe-infrastructure

0.0 0.0 0.0 33 KB

One `docker-compose.yml` file to rule them all

License: MIT License

Shell 100.00%

safe-infrastructure's Introduction

Safe Services Main Docker

This repository contains the minimum viable local setup for our backend services. The setup presented here, assumes that only L2 safes will be used. Additionally, we have tested this setup with the following versions:

  • CFG_VERSION=v2.12.0
  • CGW_VERSION=v3.19.1
  • TXS_VERSION=v4.2.8

You can change them to the version you are interested available in docker-hub but be aware that not all versions of our services are compatible with each other, so do so at your own risk.

Step 0: docker crash course (optional)

Building and running the whole setup can be done with the following commands:

docker compose build --force-rm
docker compose up
  • Accessing bash in your web containers can be achieved by:
docker exec -it safe-infrastructure_cfg-web_1 bash
docker exec -it safe-infrastructure_txs-web_1 bash

Ctrl+d will end interactive mode.

  • Accessing redis-cli in either redis can be achieved like so"
docker exec -it safe-infrastructure_cgw-redis_1 redis-cli
docker exec -it safe-infrastructure_txs-redis_1 redis-cli
  • Accessing postgres. The Safe Config and Safe transaction services share the same instance
docker exec -it safe-infrastructure_db_1 psql -U postgres

Step 1: setup your .env

We recommend using what is available in the .env.sample file as it contains versions of our services guaranteed to be compatible with each other:

cp .env.sample .env

Simply, edit your .env and set RPC_NODE_URL to the chain you want the services running against. Important Note: Only L2 safes are supported in the setup provided. Change this at your own risk.

Step 2: Setup djando superusers

You will need to identify the ID or name of the containers using docker ps. To create the default super user for the Safe Config Service, we run the following command:

docker exec safe-infrastructure_cfg-web_1 python src/manage.py createsuperuser --noinput

You can now access http://localhost:8000/cfg/admin/ and login using the credentials root/admin.

To achieve the same for the Safe Transaction service:

docker exec safe-infrastructure_txs-web_1 python manage.py createsuperuser --noinput

Note 1: note that the path to manage.py is different. In case you need to run other commands.

Note 2: remember to replace your container ID or name.

Step 3: Add your ChainInfo

We need to be able to define a ChainInfo object in the Safe Config service so that the Client Gateway knows the URL of the Safe Transaction service instance it needs to request against for a given safe.

You can do this in the admin interface of the Safe Config service: http://localhost:8000/cfg/admin/chains/chain/add/

You can verify that your ChainInfo was successfully added by going to http://localhost:8000/cfg/api/v1/chains.

Step 4: Add your webhooks

Our services invalidate the caches of the client gateway using webhooks. Both the Config and Transaction service need to be configured. For the Config service, unless you've changed the values in cgw.env and cfg.env then you don't need to do anything, otherwise:

# Inside the file "container_env_files/cfg.env"
#...
CGW_URL=http://nginx:8000/cgw
CGW_FLUSH_TOKEN=some_random_token

# Inside the file "container_env_files/cgw.env"
WEBHOOK_TOKEN=some_random_token

WEBHOOK_TOKEN and CGW_FLUSH_TOKEN must be the same.

For the Transactions service open a terminal in the container:

docker exec -it safe-infrastructure_txs-web_1 bash

Then use manage.py and the custom command for adding a webhook like so:

python manage.py add_webhook --url=http://nginx:8000/cgw/v1/hook/update/some_random_token
  1. Access the UI You can then access to the Gnosis Safe Web UI at http://localhost:8080. Port can be configured on .env

safe-infrastructure's People

Contributors

jpalvarezl avatar uxio0 avatar fmrsabino avatar rmeissner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.