Skip to content

Latest commit

 

History

History
154 lines (121 loc) · 4.28 KB

deployment.md

File metadata and controls

154 lines (121 loc) · 4.28 KB

Deployment with Docker

You can easily deploy and monitor your own instance online using Docker

Get the image

A ready-to-use docker build is available online to download at hub.docker.com.

docker pull proofofexistence/proofofexistence

Configure your wallet

For the server to start, you will need to pass your config to the Docker image by using a list of environment variables. You will find an example in .sample-env. Please report to the config doc for more info about environment variables.

cp .sample-env .env-docker

Start/stop the image

You can now start your Docker image as daemon.

docker run -d -i --rm --name proofofexistence --env-file .env-docker -p 3003:3003 proofofexistence:VERSION

You can check that the node is running using docker ps.

Stop the image

docker stop proofofexistence

Attach to the docker-node

docker exec --user node -w /home/node -ti proofofexistence bash

If you don't know how to use Amazon ECS, you can read the example first.

This is the task defination:

{
    "containerDefinitions": [
        {
            "name": "proofofexistence",
            "image": "proofofexistence/proofofexistence",
            "essential": true,
            "portMappings": [
                {
                    "hostPort": "3003",
                    "containerPort": "3003",
                    "protocol": "tcp"
                }
            ],
            "environment": [
                {
                    "name": "DB_PATH",
                    "value": "/tmp/proofx-database-test"
                },
                {
                    "name": "PORT",
                    "value": "3003"
                }
            ],
            "mountPoints": [
                {
                    "sourceVolume": "proofx-db",
                    "containerPath": "/tmp/proofx-database-test",
                    "readOnly": ""
                }
            ],
            "volumesFrom": null,
            "hostname": null,
            "user": null,
            "workingDirectory": null,
            "extraHosts": null,
            "logConfiguration": null,
            "ulimits": null,
            "dockerLabels": null,
            "healthCheck": {
                "interval": "60",
                "timeout": "20",
                "startPeriod": "20",
                "retries": "2",
                "command": [
                    "cd /tmp;ls"
                ]
            }
        }
    ],
    "volumes": [
        {
            "host": {
                "sourcePath": "/proofx/proofx-database-test"
            },
            "name": "proofx-db"
        }
    ],
    "networkMode": "bridge",
    "memory": "1024",
    "cpu": "1 vcpu",
    "placementConstraints": [],
    "family": "proofx-ecs",
    "taskRoleArn": "arn:aws:iam::611798417555:role/ecsTaskExecutionRole"
}

WARN: (MUST DO IT IF YOU CARE ABOUT YOUR DATABASE)

  • /proofx/proofx-database-test is the default volume in the instance, you can mount a large one if you need. and you must make it exists in the instance before you run the task.

Build the Docker image yourself

You can build the docker image from the Dockerfile from within the github rep by using the following command:

docker build -t proofofexistence .

Install Docker

To install docker, please refer to the official website. For OSX users, you can just install it from brew.

Systemd Service

The app can be run as a systemd service with a startup script such as:

[Unit]
Description=Proof of Existence prod
After=network.target

[Service]
WorkingDirectory=/home/ubuntu/proofofexistence/
Environment="NODE_ENV=production"
Environment="PORT=3003"
Type=simple
User=ubuntu
ExecStart=/usr/bin/node /home/ubuntu/proofofexistence/lib/server.js
Restart=on-failure

[Install]
WantedBy=multi-user.target