diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml index ddc71a6..81aa23f 100644 --- a/.github/workflows/prod.yml +++ b/.github/workflows/prod.yml @@ -79,7 +79,7 @@ jobs: # Setup gcloud CLI - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@master + uses: google-github-actions/setup-gcloud@v0 with: service_account_email: kubernetes-deployment-agent@wire-bot.iam.gserviceaccount.com service_account_key: ${{ secrets.GKE_SA_KEY }} diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 31854c2..ea32876 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -6,7 +6,9 @@ on: - staging env: + # set docker image for the service - i.e. "wire-bot/poll" DOCKER_IMAGE: wire-bot/don-bot + # name of the service in the Dagobah - the value for label name, i.e. "polls" SERVICE_NAME: don jobs: @@ -52,7 +54,7 @@ jobs: # Setup gcloud CLI - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@master + uses: google-github-actions/setup-gcloud@v0 with: service_account_email: kubernetes-deployment-agent@wire-bot.iam.gserviceaccount.com service_account_key: ${{ secrets.GKE_SA_KEY }} @@ -67,7 +69,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" @@ -77,8 +79,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 diff --git a/Dockerfile b/Dockerfile index 31b967d..5eafd68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ COPY src ./src RUN mvn package -DskipTests=true # runtime stage -FROM dejankovacevic/bots.runtime:2.10.3 +FROM wirebot/runtime WORKDIR /opt/don @@ -29,4 +29,4 @@ ENV RELEASE_FILE_PATH=/etc/don/release.txt RUN echo $release_version > $RELEASE_FILE_PATH EXPOSE 8080 8081 8082 -ENTRYPOINT ["java", "-jar", "don.jar", "server", "/etc/don/don.yaml"] +ENTRYPOINT ["java","-javaagent:/opt/wire/lib/prometheus-agent.jar=8082:/opt/wire/lib/metrics.yaml", "-jar", "don.jar", "server", "/etc/don/don.yaml"] diff --git a/src/main/java/com/wire/bots/don/DonService.java b/src/main/java/com/wire/bots/don/DonService.java index 00dec8b..9992904 100644 --- a/src/main/java/com/wire/bots/don/DonService.java +++ b/src/main/java/com/wire/bots/don/DonService.java @@ -2,6 +2,10 @@ import com.wire.lithium.Server; import com.wire.xenon.MessageHandlerBase; +import io.dropwizard.bundles.redirect.PathRedirect; +import io.dropwizard.bundles.redirect.RedirectBundle; +import io.dropwizard.configuration.EnvironmentVariableSubstitutor; +import io.dropwizard.configuration.SubstitutingSourceProvider; import io.dropwizard.setup.Bootstrap; import io.dropwizard.setup.Environment; @@ -14,7 +18,9 @@ public static void main(String[] args) throws Exception { @Override public void initialize(Bootstrap bootstrap) { - super.initialize(bootstrap); + bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false))); + bootstrap.addBundle(new RedirectBundle(new PathRedirect("/", "/status"), new PathRedirect("/bots/status", "/status"))); + instance = (DonService) bootstrap.getApplication(); }