Skip to content

Commit

Permalink
Set up deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
shlevy committed Oct 24, 2023
1 parent 908e1db commit 66a11b0
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/autocommit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Auto Commit
on:
push:
branches:
- main
- production

jobs:
run:
name: Auto Commit
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: main

- name: Update publish version
id: update
run: |
VERSION=${GITHUB_SHA::8}
if [ "$GITHUB_REF" = refs/heads/production ]; then
TYPE=production
else
TYPE=staging
fi
echo ::set-output name=VERSION::${VERSION}
sed -i "s|${TYPE}Tag:.*|${TYPE}Tag: \"$VERSION\"|g" deploy/values.yaml
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
default_author: github_actions
add: '.'
message: "[ci skip] deploy from ${{ steps.update.outputs.VERSION }}"
signoff: true
branch: main
7 changes: 7 additions & 0 deletions deploy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: marlowe-payouts
version: v1.0.0
description: dApp for Marlowe Withdrawals
home: https://github.com/input-output-hk/marlowe-payouts
sources:
- https://github.com/input-output-hk/marlowe-payouts
152 changes: 152 additions & 0 deletions deploy/templates/marlowe-payouts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{{- range $index, $network := .Values.networks }}
---
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: marlowe-payouts-{{ $network }}
namespace: marlowe-production
spec:
components:
- name: marlowe-payouts-{{ $network }}
properties:
image: p3terx/darkhttpd
args:
- /client-www
- --port
- "8080"
imagePullPolicy: Always
ports:
- expose: true
port: 8080
protocol: TCP
traits:
- properties:
replicas: 1
type: scaler
- properties:
domains:
- payouts-{{ $network }}.prod.scdev.aws.iohkdev.io
rules:
- port: 8080
type: https-route
- type: init-container
properties:
name: load-payouts-client
image: ghcr.io/input-output-hk/marlowe-payouts:{{ $.Values.images.productionTag }}
args:
- -c
- |
root="$(dirname $(readlink -f /profile/index.html))"
cp -a $root/* /share/marlowe-payouts/static
cat > /share/marlowe-payouts/static/config.json <<EOF
{
"marloweWebServerUrl": "https://marlowe-runtime-{{ $network }}-web.demo.scdev.aws.iohkdev.io",
}
EOF
mountName: client-www
initMountPath: /share/marlowe-payouts/static
appMountPath: /client-www
type: webservice
policies:
- name: marlowe-payouts-staging
properties:
clusters:
- local
namespace: marlowe-staging
type: topology

- name: marlowe-payouts
properties:
clusters:
- local
namespace: marlowe-production
type: topology

- name: staging-override
type: override
properties:
components:
- name: marlowe-payouts-{{ $network }}
properties:
image: p3terx/darkhttpd
args:
- /client-www
- --port
- "8080"
imagePullPolicy: Always
ports:
- expose: true
port: 8080
protocol: TCP
traits:
- properties:
replicas: 1
type: scaler
- properties:
domains:
- payouts-{{ $network }}.scdev.aws.iohkdev.io
rules:
- port: 8080
type: https-route
- type: init-container
properties:
name: load-payouts-client
image: ghcr.io/input-output-hk/marlowe-payouts:{{ $.Values.images.stagingTag }}
args:
- -c
- |
root="$(dirname $(readlink -f /profile/index.html))"
cp -a $root/* /share/marlowe-payouts/static
cat > /share/marlowe-payouts/static/config.json <<EOF
{
"marloweWebServerUrl": "https://marlowe-runtime-{{ $network }}-web.demo.scdev.aws.iohkdev.io",
}
EOF
mountName: client-www
initMountPath: /share/marlowe-payouts/static
appMountPath: /client-www
type: webservice
workflow:
mode:
steps: DAG
steps:
- meta:
alias: Push staging image
name: push-image-staging
type: build-nix-image
properties:
image: ghcr.io/input-output-hk/marlowe-payouts:{{ $.Values.images.stagingTag }}
requests:
ephemeralStorage: 25Gi
includedFlakeURIs:
- "github:input-output-hk/marlowe-payouts?ref={{ $.Values.images.stagingTag }}#marlowe-payouts"
- meta:
alias: Push image
name: push-image
type: build-nix-image
properties:
image: ghcr.io/input-output-hk/marlowe-payouts:{{ $.Values.images.productionTag }}
requests:
ephemeralStorage: 25Gi
includedFlakeURIs:
- "github:input-output-hk/marlowe-payouts?ref={{ $.Values.images.productionTag }}#marlowe-payouts"
- type: deploy
meta:
alias: Deploy marlowe-payouts
dependsOn:
- push-image
name: marlowe-payouts
properties:
policies:
- marlowe-payouts
- type: deploy
meta:
alias: Deploy marlowe-payouts to staging
dependsOn:
- push-image-staging
name: marlowe-payouts-staging
properties:
policies:
- marlowe-payouts-staging
- staging-override
{{- end }}
8 changes: 8 additions & 0 deletions deploy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
networks:
- preprod
- preview
- mainnet
images:
stagingTag: "908e1db"
productionTag: "908e1db"

0 comments on commit 66a11b0

Please sign in to comment.