Skip to content

Commit

Permalink
Merge pull request #13 from wireapp/staging
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
dkovacevic authored Aug 14, 2021
2 parents 8e5b3de + 9b317bc commit 991a1e9
Show file tree
Hide file tree
Showing 57 changed files with 347 additions and 1,610 deletions.
52 changes: 51 additions & 1 deletion .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release Pipeline

on:
release:
types: published
types: [ published ]

env:
DOCKER_IMAGE: wire-bot/poll
Expand Down Expand Up @@ -129,3 +129,53 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_RELEASE }}
# Notify every release
if: always()

quay_publish:
name: Quay Publish Pipeline
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set Release Version
# use latest tag as release version
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV

# extract metadata for labels https://github.com/crazy-max/ghaction-docker-meta
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: quay.io/wire/poll-bot

# setup docker actions https://github.com/docker/build-push-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# login to GCR repo
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
push: true
build-args: |
release_version=${{ env.RELEASE_VERSION }}
# Send webhook to Wire using Slack Bot
- name: Webhook to Wire
uses: 8398a7/action-slack@v2
with:
status: ${{ job.status }}
author_name: ${{ env.SERVICE_NAME }} Quay Production Publish
env:
SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_RELEASE }}
# Send message only if previous step failed
if: always()
55 changes: 55 additions & 0 deletions .github/workflows/quay.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Quay Deployment

on:
# manual dispatch
workflow_dispatch:
inputs:
tag:
description: 'Docker image tag.'
required: true
jobs:
publish:
name: Deploy to staging
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

# extract metadata for labels https://github.com/crazy-max/ghaction-docker-meta
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: quay.io/wire/poll-bot

# setup docker actions https://github.com/docker/build-push-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# login to GCR repo
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
tags: quay.io/wire/poll-bot:${{ github.event.inputs.tag }}
labels: ${{ steps.docker_meta.outputs.labels }}
push: true
build-args: |
release_version=${{ github.event.inputs.tag }}
# Send webhook to Wire using Slack Bot
- name: Webhook to Wire
uses: 8398a7/action-slack@v2
with:
status: ${{ job.status }}
author_name: Poll Bot Quay Custom Tag Pipeline
env:
SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_CI }}
# Send message only if previous step failed
if: always()
8 changes: 4 additions & 4 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
DOCKER_IMAGE: wire-bot/poll
SERVICE_NAME: poll
SERVICE_NAME: polls

jobs:
publish:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
# Get the GKE credentials so we can deploy to the cluster
- name: Obtain k8s credentials
env:
GKE_CLUSTER: anayotto
GKE_CLUSTER: dagobah
GKE_ZONE: europe-west1-c
run: |
gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE"
Expand All @@ -77,8 +77,8 @@ jobs:
env:
SERVICE: ${{ env.SERVICE_NAME }}
run: |
kubectl delete pod -l name=$SERVICE -n staging
kubectl describe pod -l name=$SERVICE -n staging
kubectl delete pod -l app=$SERVICE -n staging
kubectl describe pod -l app=$SERVICE -n staging
# Send webhook to Wire using Slack Bot
- name: Webhook to Wire
Expand Down
32 changes: 17 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.4.10"
kotlin("jvm") version "1.5.0"
application
distribution
id("net.nemerosa.versioning") version "2.14.0"
Expand All @@ -15,56 +15,58 @@ application {
}

repositories {
jcenter()
mavenCentral()
}

dependencies {
// stdlib
implementation(kotlin("stdlib-jdk8"))
// extension functions
implementation("pw.forst.tools", "katlib", "1.1.2")

implementation("pw.forst", "katlib", "2.0.1")

// Ktor server dependencies
val ktorVersion = "1.4.1"
val ktorVersion = "1.5.4"
implementation("io.ktor", "ktor-server-core", ktorVersion)
implementation("io.ktor", "ktor-server-netty", ktorVersion)
implementation("io.ktor", "ktor-jackson", ktorVersion)
implementation("io.ktor", "ktor-websockets", ktorVersion)

// explicitly set the reflect library to same version as the kotlin
implementation("org.jetbrains.kotlin", "kotlin-reflect", "1.5.0")
// Ktor client dependencies
implementation("io.ktor", "ktor-client-json", ktorVersion)
implementation("io.ktor", "ktor-client-jackson", ktorVersion)
implementation("io.ktor", "ktor-client-jackson", ktorVersion) {
exclude("org.jetbrains.kotlin", "kotlin-reflect")
}
implementation("io.ktor", "ktor-client-apache", ktorVersion)
implementation("io.ktor", "ktor-client-logging-jvm", ktorVersion)

// Prometheus metrics
implementation("io.ktor", "ktor-metrics-micrometer", ktorVersion)
implementation("io.micrometer", "micrometer-registry-prometheus", "1.5.5")
implementation("io.micrometer", "micrometer-registry-prometheus", "1.6.6")

// logging
implementation("io.github.microutils", "kotlin-logging", "2.0.3")
implementation("io.github.microutils", "kotlin-logging", "2.0.6")
// if-else in logback.xml
implementation("org.codehaus.janino", "janino", "3.1.2")
implementation("ch.qos.logback", "logback-classic", "1.2.3")

// DI
val kodeinVersion = "6.5.5"
implementation("org.kodein.di", "kodein-di-generic-jvm", kodeinVersion)
val kodeinVersion = "7.5.0"
implementation("org.kodein.di", "kodein-di-jvm", kodeinVersion)
implementation("org.kodein.di", "kodein-di-framework-ktor-server-jvm", kodeinVersion)

// database
implementation("org.postgresql", "postgresql", "42.2.2")
implementation("org.postgresql", "postgresql", "42.2.20")

val exposedVersion = "0.27.1"
val exposedVersion = "0.31.1"
implementation("org.jetbrains.exposed", "exposed-core", exposedVersion)
implementation("org.jetbrains.exposed", "exposed-dao", exposedVersion)
implementation("org.jetbrains.exposed", "exposed-jdbc", exposedVersion)
implementation("org.jetbrains.exposed", "exposed-java-time", exposedVersion)
implementation("pw.forst", "exposed-upsert", "1.0")
implementation("pw.forst", "exposed-upsert", "1.1.0")

// database migrations from the code
implementation("org.flywaydb", "flyway-core", "7.0.0")
implementation("org.flywaydb", "flyway-core", "7.8.2")
}

tasks {
Expand Down
13 changes: 2 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.7'
version: '3.8'
services:
bot:
build:
Expand All @@ -11,26 +11,17 @@ services:
env_file: .env
ports:
- 8080:8080
networks:
- poll-bot-net
depends_on:
- db

db:
image: postgres:12.2
image: postgres:13.1
container_name: poll-bot-db
env_file: .env
ports:
- 5432:5432
networks:
- poll-bot-net
volumes:
- poll-bot-db:/var/lib/postgresql/data/


networks:
poll-bot-net:
driver: bridge

volumes:
poll-bot-db:
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 991a1e9

Please sign in to comment.