Git Product home page Git Product logo

deployments's Introduction

district-deployments

This project contains docker images and docker-compose scripts for deploying districts to different environments.

Requirements

You need Docker installed.

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
  sudo apt-key add -

export LSB_ETC_LSB_RELEASE=/etc/upstream-release/lsb-release

V=$(lsb_release -cs)

sudo add-apt-repository \
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu ${V} stable"

sudo apt-get update -y

sudo apt-get install -y docker-ce

Add your user to the docker group. Added user can run docker command without sudo command:

sudo gpasswd -a "${USER}" docker

Test the installation:

docker run hello-world

You also need docker-compose:

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod a+x /usr/local/bin/docker-compose

Usage

Base images for district0x development. Contains all services needed for running and building districts locally. Consult the docker-compose file for details of what's availiable.

Start just the base services:

cd dev/
docker-compose -f docker-compose.yml up --build

If you want to start the memefactory services as well:

cd dev/
export MEMEFACTORY_DIR=</path/to/memefactory>
docker-compose -f docker-compose.yml \
               -f memefactory/docker-compose.yml up --build

This service provides the personal Ethereum blockchain. By default it exposes the API on port 8549. To connect your web3 instance put this in your config:

:web3 {:url "http://localhost:8549"}

This service provides the ipfs network daemon. The api is exposed on local port 5001 and gateway on 8080.

To connect your ipfs instance put this in your config:

:ipfs {:endpoint "/api/v0"
       :host "http://localhost:5001"
       :gateway "http://localhost:8080/ipfs"}

This container config provides services for the development of memefactory district.

This container will serve static content compiled by figwheel on port 3001, allowing you to test and devlop things like pushroutes or prerendering. You need to set an environment variable pointint to the root directory of the project before using it:

export MEMEFACTORY_DIR=</path/to/memefactory>

Start the services in the QA environment:

cd qa/
docker-compose -f docker-compose.yml up -d --build

This service provides a geth node of the rinkeby testnet. It doesn't forward any ports to the host, but the nginx proxy exposes its http API as a rinkeby.district0x.io virtual host.

See mainnet for setials on how to tets the connection.

This service provides a geth node of the ropsten testnet. It's exposed as a ropsten.district0x.io virtual host

ipfs network daemon service. See ipfs daemon for details.

Proxy companion to the the ipfs daemon service.

Epxosed as ipfs.qa.district0x.io virtual host.

To connect your ipfs instance specify these connection details in your config:

:ipfs {:endpoint "/api/v0"
       :host "https://ipfs.qa.district0x.io/api"
       :gateway "https://ipfs.qa.district0x.io/gateway/ipfs"}

See ipfs server for details.

Automated nginx reverse proxy service. See nignx for details.

Automated SSL ceritficate service. See letsencrypt for details.

Service for automatically updating running containers. See watchtower for details.

Memefactory backend container service. See memefactory-server for details.

Webserver for serving static memefactory UI content. See memefactory-ui for details.

TODO

TODO

Start all the production services:

cd prod/
docker-compose -f docker-compose.yml up -d --build

This service provides a parity instance of the ethereum mainnet. It doesn't forward any ports to the host, but the nginx proxy exposes its http API as a virtual host on the standard SSL port.

You can test the connection locally:

curl --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}' -H "Host: mainnet.district0x.io" -H "Content-Type: application/json" -X POST https://localhost:443 -k

or from the outside using the DNS's (managed with route 53):

curl --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST https://mainnet.district0x.io

This service provides the ipfs network daemon. It provides access to the both the http API and a read-only gateway, but doesn't expose them to the host network. This is done by the accompanying ipfs server.

Docker image repository and documentation: district0x/ipfs-docker.

This service is an nginx proxy companion to the ipfs daemon service. It maps daemon ports to endpoints allowing the use of a single virtual host for all things ipfs:

  • the ipfs http API is accesible on the /api endpoint
  • the read-only gateway is accessible as /gateway endpoint

Docker image repository and documentation: district0x/ipfs-docker.

This service doesn't forward any ports to the host, rather the nginx proxy exposes it as a ipfs.district0x.io virtual host. You can test the gateway endpoint connection like this:

curl https://ipfs.district0x.io/gateway/ipfs/QmTeW79w7QQ6Npa3b1d5tANreCDxF2iDaAPsDvW6KtLmfB/

Test the http API endpoint connection:

curl https://ipfs.qa.district0x.io/api/api/v0/version

To connect your ipfs instance put this in your config:

:ipfs {:endpoint "/api/v0"
       :host "https://ipfs.district0x.io/api"
       :gateway "https://ipfs.district0x.io/gateway/ipfs"}

This service provides an automated nginx reverse proxies to other docker containers running in this envirnment.


NOTE As a general rule all the other containers are not directly exposed to the host, rather this service routes the traffic to them based on the VIRTUAL_HOST environment variable passed to the container config. Host specific configs are mounted in the home/$USER/nginx-docker/vhost.d directory on the hosts filesystem.


For documentation and details: https://github.com/jwilder/nginx-proxy

This is a companion service to the nginx proxy. It automates the handling, creation and renewal of Let's Encrypt SSL certificates.

For documentation and details: https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion

This service is responsible for automatically updating running containers. Containers opt-in by using a com.centurylinklabs.watchtower.enable docker label.

Watchtower will periodicaly check Docker Hub for any newer versions of the image with a given tag. You update containerized districts simply by pushing a new image to the docker repository.


NOTE

By convention images built on a master (QA) branch are tagged as latest, and on the production branch as release.


For documentation and details: https://github.com/containrrr/watchtower

This service serves static content and is accessible under contribution.district0x.io virtual host.

This service serves static content and is accessible under vote.district0x.io virtual host.

This service serves static content and is accessible under district0x.io virtual host. Unlike other production services for convenience of the ops-team it is built on the master branch of the repository

This service serves static content and is accessible under namebazaar.io virtual host.

This service is a webserver serving the ethlance UI and is accessible under ethlance.com virtual host.

Repository: https://github.com/district0x/ethlance

This service is the backend infrastructure of ethlance.

Repository: https://github.com/district0x/ethlance-emailer

This service is the backend infrastructure of memefactory. It mainly provides graphql enpdoints over a cache of database built from the ethereum event logs.

It's exposed as api.memefactory.district0x.io. The connectivity to graphql endpoints can be quickly checked by sending an event query:

curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ events { event_contractKey event_eventName event_count event_lastLogIndex event_lastBlockNumber}}" }' https://api.memefactory.io/graphql

This container service shares volumes with the host:

  • db/ - for the database file.
  • logs/ - for the server logs. All server logs are shipped to cloudwatch using a cloudwatch agent, all logging events as or more sever than warning are shipped to sentry with a slack notifcations.
  • configs/ - for the config

Docker will keep trying to restart this service on failure.

Repository: https://github.com/district0x/memefactory

This service is a webserver serving the memefactory browser UI and is accessible as the memefactory.io virtual host. It is built by extending the prerender webserver image to provide server-side rendering for bots and web crawlers.

Repository: https://github.com/district0x/memefactory

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.