Skip to content

Commit

Permalink
create 2.3 release
Browse files Browse the repository at this point in the history
split services into seperate compose files

add docker build action

update volume names

add release workflow
  • Loading branch information
gregnuj committed May 9, 2023
1 parent fc5f83f commit 0b5c4c9
Show file tree
Hide file tree
Showing 20 changed files with 360 additions and 745 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME=localterra
TERRA_VERSION=2.3.1
73 changes: 73 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: docker-build

on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3

# https://docs.docker.com/build/ci/github-actions/multi-platform/
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- name: Log in to the github container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}


# https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:

github-token: ${{ secrets.GITHUB_TOKEN }}
images: |
ghcr.io/${{ github.repository }}
terraformlabs/localterra
tags: |
type=sha
type=edge,branch=test
type=semver,pattern={{tag}}
type=semver,pattern={{version}}
type=raw,value=latest,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=classic,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'classic') }}
- name: Build docker image
uses: docker/build-push-action@v3
with:
push: ${{ github.event_name != 'pull_request' }}
file: Dockerfile
platforms: linux/amd64
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }}
labels: ${{ env.DOCKER_METADATA_OUTPUT_LABELS }}


35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # Push events to matching v*, i.e. v1.0, v20.15.10
- 'v[0-9]+.[0-9]+.[0-9]+-rc*' # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5

jobs:
artifacts:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set version tag
run: echo "VERSION=$(echo ${{github.ref_name}} | sed 's/^v//')" >> $GITHUB_ENV

- name: Create build directory
run: mkdir -p build/release

- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
tag_name: ${{github.ref_name}}
body: ${{steps.github_release.outputs.changelog}}
files: |
build/release/*
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,3 @@ dependency-graph.png
node_modules/

logs/
data/
config/addrbook.json
config/write-file-atomic*
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ARG TERRA_VERSION=2.3.1

FROM ghcr.io/terra-money/core:${TERRA_VERSION}

COPY ./terra/genesis.json \
./terra/priv_validator_key.json \
/app/config/

RUN mkdir -p /app/data && \
echo '{"height": "0","round": 0,"step": 0}' > /app/data/priv_validator_state.json

CMD terrad start \
--api.enable true \
--api.enabled-unsafe-cors true \
--api.swagger true \
--home /app \
--minimum-gas-prices 0.015uluna \
--moniker localterra \
--p2p.upnp true \
--rpc.laddr tcp://0.0.0.0:26657
25 changes: 25 additions & 0 deletions compose-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
x-api-env: &api-env
- API_DB_HOST=postgres
- API_DB_PORT=5432
- API_DB_USERNAME=terra
- API_DB_PASSWORD=abc123
- API_DB_DATABASE=api
- API_DB_SYNCHRONIZE=true
- FCD_DB_HOST=postgres
- FCD_DB_PORT=5432
- FCD_DB_USERNAME=terra
- FCD_DB_PASSWORD=abc123
- FCD_DB_DATABASE=fcd
- LCD_COLLECTOR_ENDPOINTS=http://terrad:1317
- RPC_COLLECTOR_ENDPOINTS=http://terrad:26657
- WS_ENDPOINTS=ws://terrad:26657/websocket
- MANTLE_ENDPOINTS=
- FCD_URL=http://fcd-api:3060
- CIRCULATING_SUPPLY_COLLECT_WINDOW_BLOCKS=10

volumes:
localterra:
pgdata:

networks:
localterra:
69 changes: 69 additions & 0 deletions compose-fcd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
version: "3.8"

x-fcd-env: &fcd-env
- CHAIN_ID=localterra
- LCD_URI=http://terrad:1317
- RPC_URI=http://terrad:26657
- USE_LOG_FILE=true
- TYPEORM_CONNECTION=postgres
- TYPEORM_HOST=postgres
- TYPEORM_USERNAME=terra
- TYPEORM_PASSWORD=abc123
- TYPEORM_DATABASE=fcd
- TYPEORM_SYNCHRONIZE=true
- TYPEORM_LOGGING=false
- TYPEORM_ENTITIES=src/orm/*Entity.ts
- LEGACY_NETWORK=false

services:
terrad:
extends:
file: compose-rpc.yml
service: terrad

postgres:
image: postgres:14-alpine
container_name: localterra-postgres
hostname: postgres
environment:
POSTGRES_USER: terra
POSTGRES_PASSWORD: abc123
volumes:
- ./initdb.d:/docker-entrypoint-initdb.d
- pgdata:/var/lib/postgresql/data
networks:
- localterra
ports:
- 5433:5432

fcd-collector:
image: ghcr.io/terra-money/fcd:${TERRA_VERSION}
container_name: localterra-fcd-collector
hostname: fcd-collector
command: collector
restart: unless-stopped
environment: *fcd-env
volumes:
- ./logs:/app/logs
networks:
- localterra

fcd-api:
image: ghcr.io/terra-money/fcd:${TERRA_VERSION}
container_name: localterra-fcd-api
hostname: fcd-api
command: start
environment: *fcd-env
volumes:
- ./logs:/app/logs
networks:
- localterra
ports:
- 3060:3060

volumes:
localterra:
pgdata:

networks:
localterra:
28 changes: 28 additions & 0 deletions compose-rpc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3.8"

services:
terrad:
build:
context: .
dockerfile: Dockerfile
args:
TERRA_VERSION: ${TERRA_VERSION}
image: ghcr.io/terra-money/localterra:${TERRA_VERSION}
container_name: localterra-terrad
hostname: terrad
pull_policy: always
volumes:
- localterra:/app
networks:
- localterra
ports:
- "1317:1317"
- "9090:9090"
- "9091:9091"
- "26657:26657"

volumes:
localterra:

networks:
localterra:

0 comments on commit 0b5c4c9

Please sign in to comment.