Skip to content

Commit

Permalink
Merge pull request #8 from input-output-hk/PLT-7634
Browse files Browse the repository at this point in the history
PLT-7634 Docker image
  • Loading branch information
bwbush authored Sep 28, 2023
2 parents 618d5f7 + 3fbd0e7 commit bb301ad
Show file tree
Hide file tree
Showing 20 changed files with 2,416 additions and 318 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "Deploy"
env:
CACHE_NAME: marlowe-temp
ALLOWED_URIS: "https://github.com https://api.github.com"
TRUSTED_PUBLIC_KEYS: "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= marlowe-temp.cachix.org-1:1gPjVFpu4QjaAT3tRurCioX+BC23V7mjvFwpP5bV0Ec= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk="
SUBSTITUTERS: "https://cache.nixos.org/ https://cache.iog.io https://marlowe-temp.cachix.org https://cache.zw3rk.com/"
VAULT_ADDR: "https://vault.dapps.aws.iohkdev.io"
NOMAD_ADDR: "https://nomad.dapps.aws.iohkdev.io"
NOMAD_NAMESPACE: "marlowe"
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v21
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: https://releases.nixos.org/nix/nix-2.10.3/install
extra_nix_config: |
allowed-uris = ${{ env.ALLOWED_URIS }}
trusted-public-keys = ${{ env.TRUSTED_PUBLIC_KEYS }}
substituters = ${{ env.SUBSTITUTERS }}
experimental-features = nix-command flakes
- name: Build images and copy to local Docker registry
run: |
nix build .#oci-images.x86_64-linux.all.copyToDockerDaemon
./result/bin/copy-to-docker-daemon
- name: Authenticate with container registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Tag and push images
run: |
tagAndPush() {
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$2
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo IMAGE_ID=$IMAGE_ID
docker tag $2:latest $IMAGE_ID:$TAG
docker push $IMAGE_ID:$TAG
}
if [[ "${{ github.ref }}" == "refs/heads/main" ]]
export TAG=latest
echo TAG=$TAG
tagAndPush "marlowe-payouts"
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ yarn-debug.log*
yarn-error.log*

dist
.pre-commit-config.yaml
17 changes: 17 additions & 0 deletions Docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Docker Image


Use the following Nix command to build the Docker image for Marlowe Payouts.
```bash
nix build .#oci-images.x86_64-linux.marlowe-payouts
```

The image can be uploaded to Docker via the following command.
```bash
skopeo --insecure-policy copy nix:result docker://docker.io/mydocker/marlowe-payouts:latest
```

Run the container and connect to `http://localhost:8080`.
```bash
docker run -p 8080:8080 ghcr.io/input-output-hk/marlowe-payouts
```
226 changes: 226 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
version: "2.2"

services:

node:
environment:
- NETWORK=${NETWORK:?err}
healthcheck:
interval: 10s
retries: 10
test: socat -u OPEN:/dev/null UNIX-CONNECT:/ipc/node.socket
timeout: 5s
image: inputoutput/cardano-node:1.35.4
restart: unless-stopped
volumes:
- shared:/ipc
- node-db:/data

postgres:
environment:
- POSTGRES_LOGGING=true
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- TZ=UTC
healthcheck:
interval: 10s
retries: 5
test: pg_isready -U postgres
timeout: 5s
image: postgres:11.5-alpine
logging:
driver: json-file
options:
max-file: '10'
max-size: 200k
restart: unless-stopped
volumes:
- postgres:/var/lib/postgresql/data
- ./networks/${NETWORK:?err}/init.sql:/docker-entrypoint-initdb.d/init.sql
command:
- '-c'
- 'max_connections=1000'
- '-c'
- 'superuser_reserved_connections=5'
- '-c'
- 'huge_pages=try'
- '-c'
- 'max_wal_size=6GB'
- '-c'
- 'max_locks_per_transaction=256'
- '-c'
- 'max_pred_locks_per_transaction=256'
- '-c'
- 'work_mem=32MB'
- '-c'
- 'maintenance_work_mem=256MB'
ports:
- 5432:5432
chain-indexer:
environment:
- NODE_CONFIG=/node/config.json
- DB_NAME=chain_${NETWORK:?err}
- DB_USER=postgres
- DB_PASS=postgres
- DB_HOST=postgres
- CARDANO_NODE_SOCKET_PATH=/ipc/node.socket
- HTTP_PORT=3781
depends_on:
node:
condition: service_healthy
postgres:
condition: service_healthy
image: ghcr.io/input-output-hk/marlowe-chain-indexer:0.0.4
user: 0:0
restart: unless-stopped
volumes:
- shared:/ipc
- ./networks/${NETWORK:?err}/node:/node

chain-sync:
environment:
- NODE_CONFIG=/node/config.json
- HOST=0.0.0.0
- PORT=3715
- QUERY_PORT=3716
- JOB_PORT=3720
- DB_NAME=chain_${NETWORK:?err}
- DB_USER=postgres
- DB_PASS=postgres
- DB_HOST=postgres
- CARDANO_NODE_SOCKET_PATH=/ipc/node.socket
- HTTP_PORT=3782
depends_on:
chain-indexer:
condition: service_started
postgres:
condition: service_healthy
image: ghcr.io/input-output-hk/marlowe-chain-sync:0.0.4
user: 0:0
restart: unless-stopped
volumes:
- shared:/ipc
- ./networks/${NETWORK:?err}/node:/node

indexer:
environment:
- DB_NAME=chain_${NETWORK:?err}
- DB_USER=postgres
- DB_PASS=postgres
- DB_HOST=postgres
- MARLOWE_CHAIN_SYNC_HOST=chain-sync
- MARLOWE_CHAIN_SYNC_PORT=3715
- MARLOWE_CHAIN_SYNC_QUERY_PORT=3716
- MARLOWE_CHAIN_SYNC_COMMAND_PORT=3720
- HTTP_PORT=3783
depends_on:
chain-sync:
condition: service_started
postgres:
condition: service_healthy
image: ghcr.io/input-output-hk/marlowe-indexer:0.0.4
restart: unless-stopped

sync:
environment:
- HOST=0.0.0.0
- MARLOWE_SYNC_PORT=3724
- MARLOWE_HEADER_SYNC_PORT=3725
- MARLOWE_QUERY_PORT=3726
- DB_NAME=chain_${NETWORK:?err}
- MARLOWE_CHAIN_SYNC_HOST=chain-sync
- MARLOWE_CHAIN_SYNC_QUERY_PORT=3716
- DB_USER=postgres
- DB_PASS=postgres
- DB_HOST=postgres
- HTTP_PORT=3784
depends_on:
indexer:
condition: service_started
postgres:
condition: service_healthy
image: ghcr.io/input-output-hk/marlowe-sync:0.0.4
restart: unless-stopped

tx:
environment:
- HOST=0.0.0.0
- PORT=3723
- MARLOWE_CHAIN_SYNC_HOST=chain-sync
- MARLOWE_CHAIN_SYNC_PORT=3715
- MARLOWE_CHAIN_SYNC_QUERY_PORT=3716
- MARLOWE_CHAIN_SYNC_COMMAND_PORT=3720
- CONTRACT_HOST=contract
- CONTRACT_QUERY_PORT=3728
- HTTP_PORT=3785
depends_on:
- chain-sync
- contract
image: ghcr.io/input-output-hk/marlowe-tx:0.0.4
restart: unless-stopped

contract:
environment:
- HOST=0.0.0.0
- PORT=3727
- QUERY_PORT=3728
- TRANSFER_PORT=3729
- STORE_DIR=/store
- HTTP_PORT=3787
volumes:
- marlowe-contract-store:/store
image: ghcr.io/input-output-hk/marlowe-contract:0.0.4
restart: unless-stopped

proxy:
environment:
- HOST=0.0.0.0
- PORT=3700
- TRACED_PORT=3701
- TX_HOST=tx
- TX_PORT=3723
- CONTRACT_HOST=contract
- LOAD_PORT=3727
- CONTRACT_QUERY_PORT=3728
- TRANSFER_PORT=3729
- SYNC_HOST=sync
- MARLOWE_SYNC_PORT=3724
- MARLOWE_HEADER_SYNC_PORT=3725
- MARLOWE_QUERY_PORT=3726
- HTTP_PORT=3786
depends_on:
- sync
- tx
- contract
image: ghcr.io/input-output-hk/marlowe-proxy:0.0.4
restart: unless-stopped
ports:
- 3700:3700
- 3701:3701

web-server:
environment:
- PORT=3780
- RUNTIME_HOST=proxy
- RUNTIME_PORT=3701
depends_on:
- proxy
image: ghcr.io/input-output-hk/marlowe-web-server:0.0.4
restart: unless-stopped
ports:
- 3780:3780

marlowe-payouts:
image: ghrc.io/input-output-hk/marlowe-payouts:latest
environment:
- MARLOWE_RT_WEBSERVER_URL=${MARLOWE_RT_WEBSERVER_URL:?err}
depends_on:
- web-server
ports:
- 8080:8080

volumes:
node-db: null
postgres: null
shared: null
marlowe-contract-store: null
Loading

0 comments on commit bb301ad

Please sign in to comment.