forked from vjt/r13-hermes
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
643 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# yamllint disable rule:comments | ||
--- | ||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
name: Release Hermes | ||
|
||
'on': | ||
push: | ||
branches: | ||
- master | ||
- feat/k8s | ||
|
||
env: | ||
SERVICE_NAME: hermes | ||
|
||
jobs: | ||
build: | ||
runs-on: arc-runner-set-prod | ||
|
||
steps: | ||
- name: Install prerequisites | ||
run: >- | ||
sudo apt-get update && | ||
sudo apt-get install --yes --no-install-recommends curl git && | ||
sudo apt-get clean && | ||
sudo rm -rf /var/lib/apt/lists/* | ||
- name: Generate Token | ||
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | ||
id: generate-token | ||
with: | ||
app_id: "${{ secrets.RENOVATEBOT_APP_ID }}" | ||
private_key: "${{ secrets.RENOVATEBOT_APP_PRIVATE_KEY }}" | ||
|
||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
token: "${{ steps.generate-token.outputs.token }}" | ||
|
||
- name: Get build tag | ||
id: vars | ||
run: |- | ||
echo "${{ secrets.IFAD_BOT_SSH_KEY }}" > /tmp/ssh_key | ||
chmod 600 /tmp/ssh_key | ||
echo "docker_image_tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
echo "service_name=${SERVICE_NAME}" >> $GITHUB_OUTPUT | ||
- name: Login to IFAD Registry | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: ${{ secrets.HARBOR_URL }} | ||
username: ${{ secrets.HARBOR_USER }} | ||
password: ${{ secrets.HARBOR_PASS }} | ||
|
||
- name: Build and push image | ||
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ secrets.HARBOR_URL }}/services/${{ steps.vars.outputs.service_name }}:${{ steps.vars.outputs.docker_image_tag }} | ||
secret-files: "ssh_private_key=/tmp/ssh_key" | ||
|
||
- name: Install ArgoCD | ||
run: | | ||
curl -sSL -o argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 | ||
chmod +x argocd | ||
export USER=argocd | ||
# The master branch is linked to ArgoCD production, all other branches are linked to ArgoCD staging | ||
if [ "${{ github.ref }}" = "refs/heads/master" ]; then | ||
./argocd login ${{ secrets.PROD_ARGOCD_URL }} --username ${{ secrets.PROD_ARGOCD_USER }} --password ${{ secrets.PROD_ARGOCD_PASS }} --insecure --skip-test-tls --grpc-web | ||
else | ||
./argocd login ${{ secrets.ARGOCD_URL }} --username ${{ secrets.ARGOCD_USER }} --password ${{ secrets.ARGOCD_PASS }} --insecure --skip-test-tls --grpc-web | ||
fi | ||
- name: Configure and Update ArgoCD | ||
run: | | ||
./argocd app set $SERVICE_NAME --plugin-env DEPLOY_TAG="${{ steps.vars.outputs.docker_image_tag }}" | ||
./argocd app get $SERVICE_NAME --hard-refresh | ||
sleep 10 | ||
./argocd app sync $SERVICE_NAME | ||
# yamllint enable rule:comments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,4 @@ | |
/log | ||
/tmp | ||
|
||
/config/database.yml | ||
/config/email.yml | ||
/config/initializers/secret_token.rb | ||
|
||
/public/assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM registry.ifad.org/library/ruby:2.3.8 | ||
|
||
COPY --chown=1000:1000 . /app | ||
|
||
USER root | ||
|
||
ENV GIT_SSH_COMMAND='ssh -i /run/secrets/ssh_private_key -o IdentitiesOnly=yes' | ||
ENV HOME=/app | ||
ENV RAILS_ENV=staging | ||
|
||
RUN --mount=type=secret,uid=1000,gid=1000,id=ssh_private_key \ | ||
apt-get update \ | ||
&& apt-get install --yes --no-install-recommends build-essential libmagickwand-dev libpq-dev libyaml-dev \ | ||
&& su ruby -m -c "script/build-docker.sh" \ | ||
&& apt-get remove --purge --yes build-essential \ | ||
&& apt-get autoremove --yes --purge \ | ||
&& apt-get clean --yes \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
USER 1000:1000 | ||
EXPOSE 3000 | ||
|
||
CMD ["bundle", "exec", "rails", "s", "-b", "0.0.0.0", "-p", "3000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class HealthCheckController < ActionController::Base # rubocop:disable Rails/ApplicationController | ||
def index | ||
db_alive = ActiveRecord::Base.connection.active? | ||
|
||
render json: { database: db_alive ? 'OK' : 'DOWN' }, | ||
status: db_alive ? :ok : :service_unavailable | ||
rescue StandardError | ||
render json: { database: 'DOWN' }, status: :service_unavailable | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
default: &default | ||
adapter: postgresql | ||
encoding: utf8 | ||
timeout: 5000 | ||
database: "<%= ENV.fetch('DB_DATABASE', 'hermes') %>" | ||
username: "<%= ENV.fetch('DB_USERNAME', 'hermes') %>" | ||
password: "<%= ENV.fetch('DB_PASSWORD', '') %>" | ||
host: "<%= ENV.fetch('DB_HOST', 'localhost') %>" | ||
|
||
development: *default | ||
test: *default | ||
staging: *default | ||
production: *default |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
default: &default | ||
delivery_method: :smtp | ||
|
||
smtp_settings: | ||
address: "<%= ENV.fetch('EMAIL_SMTP_SETTINGS_ADDRESS', 'localhost') %>" | ||
port: <%= ENV.fetch('EMAIL_SMTP_SETTINGS_PORT', 1025) %> | ||
|
||
default_url_options: | ||
protocol: "<%= ENV.fetch('EMAIL_DEFAULT_URL_OPTIONS_PROTOCOL', 'http') %>" | ||
host: "<%= ENV.fetch('EMAIL_DEFAULT_URL_OPTIONS_HOST', 'localhost') %>" | ||
|
||
development: *default | ||
test: *default | ||
staging: *default | ||
production: *default |
Oops, something went wrong.