From cbd80f50cbbf9ae612176bf1da9cb13123946b45 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Mon, 30 May 2022 22:31:32 +0200 Subject: [PATCH 1/6] Add helm chart --- .gitlab-ci.yml | 11 ++---- chart/.helmignore | 23 ++++++++++++ chart/Chart.yaml | 6 ++++ chart/templates/_helpers.tpl | 62 +++++++++++++++++++++++++++++++++ chart/templates/deployment.yaml | 58 ++++++++++++++++++++++++++++++ chart/templates/ingress.yaml | 17 +++++++++ chart/templates/secret.yaml | 17 +++++++++ chart/templates/service.yaml | 14 ++++++++ chart/values.yaml | 20 +++++++++++ kubernetes/deployment.yml.erb | 28 --------------- kubernetes/rolebinding.yml | 13 ------- kubernetes/secrets.ejson | 11 ------ kubernetes/service.yml | 46 ------------------------ 13 files changed, 220 insertions(+), 106 deletions(-) create mode 100644 chart/.helmignore create mode 100644 chart/Chart.yaml create mode 100644 chart/templates/_helpers.tpl create mode 100644 chart/templates/deployment.yaml create mode 100644 chart/templates/ingress.yaml create mode 100644 chart/templates/secret.yaml create mode 100644 chart/templates/service.yaml create mode 100644 chart/values.yaml delete mode 100644 kubernetes/deployment.yml.erb delete mode 100644 kubernetes/rolebinding.yml delete mode 100644 kubernetes/secrets.ejson delete mode 100644 kubernetes/service.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e0ad253..78922b8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,14 +50,8 @@ kubernetes: variables: KUBERNETES_SERVICE_ACCOUNT_OVERWRITE: gitlab-deploy script: - - curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl - - chmod +x kubectl - - mv kubectl /usr/bin/kubectl - - kubectl config set-cluster k8s --server="https://kubernetes.default.svc" --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt - - kubectl config set-credentials sa --token="$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" - - kubectl config set-context local --cluster=k8s --user=sa --namespace=turniere-backend - - gem install krane - - krane render -f kubernetes --current-sha "$CI_COMMIT_SHA" | krane deploy turniere-backend local -f kubernetes/secrets.ejson - + - setup-kubectl + - krane render -f kubernetes --current-sha "$CI_COMMIT_SHA" | krane deploy turniere-backend-dev local -f kubernetes/secrets.ejson - deploy_watchtower: stage: deploy @@ -74,3 +68,4 @@ deploy_watchtower: - docker pull $CI_REGISTRY_IMAGE/production/commits:$CI_COMMIT_SHA - docker tag $CI_REGISTRY_IMAGE/production/commits:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE/production:deploy - docker push $CI_REGISTRY_IMAGE/production:deploy + diff --git a/chart/.helmignore b/chart/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/chart/Chart.yaml b/chart/Chart.yaml new file mode 100644 index 0000000..510e52f --- /dev/null +++ b/chart/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: turniere-backend +description: turnie.re backend +type: application +version: 0.1.0 +appVersion: "latest" diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl new file mode 100644 index 0000000..7ba5edc --- /dev/null +++ b/chart/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "chart.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "chart.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "chart.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "chart.labels" -}} +helm.sh/chart: {{ include "chart.chart" . }} +{{ include "chart.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "chart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "chart.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "chart.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "chart.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml new file mode 100644 index 0000000..cd225cf --- /dev/null +++ b/chart/templates/deployment.yaml @@ -0,0 +1,58 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "chart.fullname" . }} + labels: + {{- include "chart.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "chart.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "chart.selectorLabels" . | nindent 8 }} + spec: + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 3000 + protocol: TCP + env: + - name: RAILS_MASTER_KEY + valueFrom: + secretKeyRef: + name: rails-master-key + key: master.key + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/chart/templates/ingress.yaml b/chart/templates/ingress.yaml new file mode 100644 index 0000000..266058d --- /dev/null +++ b/chart/templates/ingress.yaml @@ -0,0 +1,17 @@ +{{- $fullName := include "chart.fullname" . -}} +--- +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: {{ $fullName }} +spec: + entryPoints: + - websecure + routes: + - match: Host(`{{ .Values.ingress.host }}`) + kind: Rule + services: + - name: {{ $fullName }} + port: {{ .Values.service.port }} + tls: + certResolver: leresolver diff --git a/chart/templates/secret.yaml b/chart/templates/secret.yaml new file mode 100644 index 0000000..31ae6a5 --- /dev/null +++ b/chart/templates/secret.yaml @@ -0,0 +1,17 @@ +apiVersion: bitnami.com/v1alpha1 +kind: SealedSecret +metadata: + annotations: + sealedsecrets.bitnami.com/cluster-wide: "true" + creationTimestamp: null + name: rails-master-key +spec: + encryptedData: + master.key: AgBzhjABvgqp0gRdbY6JS2I5s0ir/p9xp8/KSGRZY6Gcl+saGjF6ZIFP9Tm84WwkDOujn6qW8h2Me5vxA943b8lOHXwrPXCjuM7FRt5pGlXjS08zLB08fD1mZ6btrs50AUih0YeB92pDJ7yup3eE7jJA+n1vTnNTNh62iCzLOdqHpr3IgJKvJueWcgQLjB5Lwden649QKCdpwd82el+xYLRuuS/teUANKCbLxypzp4A+Wmgcw1KmO9F29/XjiYCOJ0b1oFyI9oMhF+dyh0c3XUqNOA4TtD6a2nFtfDlVN57DmrcwAnzuXAWVDZ/RDEm5c2LVGCxAe463XDA4a+ruNYoAlbpUz2Zaqi+nISN98y2nTpWQOYICN+etps0k/o8qx8xTfPQMUG6T1D207LvzNl0Df/S2mOIWDvlEmAUZTr0PY+5e4n3cLvsemDo0/ea1+edK4eW+qbHDUTb9QswsYxysQuvHHhVv0G45887YGR/zEZLQ0yRHPyk6LwOXQ7MQc7YU/ZF3bms+93E7bgDVJVS/WneM3EEa0iTAIWre14VvOS3F4nMS5+2fcz5Nh+l1XER4F4+NllJRpINGF0wdBQDEDoyw25/6sPS/R7zheGNH32kpJx/7eEMh5LJzjA/ZseYo4t2TpD1U/OpGnfyzrQ+D/dM6p5C+WG7GD4P2M8Oqarl2YxbBf3rM0YDn0aMGc/PWN+M/TvsR5WAabQV9VRspEfoHcKEvHLqtbeeIflVd7w== + template: + data: null + metadata: + annotations: + sealedsecrets.bitnami.com/cluster-wide: "true" + creationTimestamp: null + name: rails-master-key diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml new file mode 100644 index 0000000..76d3b37 --- /dev/null +++ b/chart/templates/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "chart.fullname" . }} + labels: + {{- include "chart.labels" . | nindent 4 }} +spec: + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "chart.selectorLabels" . | nindent 4 }} diff --git a/chart/values.yaml b/chart/values.yaml new file mode 100644 index 0000000..6b51d18 --- /dev/null +++ b/chart/values.yaml @@ -0,0 +1,20 @@ +replicaCount: 1 + +image: + repository: registry.gitlab.com/turniere/turniere-backend/production/commits + pullPolicy: IfNotPresent + tag: "" + +podAnnotations: {} + +securityContext: {} +# runAsNonRoot: true +# runAsUser: 1000 + +service: + port: 8080 + +ingress: + host: "" + +resources: {} diff --git a/kubernetes/deployment.yml.erb b/kubernetes/deployment.yml.erb deleted file mode 100644 index 2e30c60..0000000 --- a/kubernetes/deployment.yml.erb +++ /dev/null @@ -1,28 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: backend-deployment - namespace: turniere-backend - labels: - app: turniere-backend -spec: - replicas: 1 - selector: - matchLabels: - app: turniere-backend - template: - metadata: - labels: - app: turniere-backend - spec: - containers: - - name: backend-container - image: registry.gitlab.com/turniere/turniere-backend/production/commits:<%= current_sha %> - ports: - - containerPort: 3000 - env: - - name: RAILS_MASTER_KEY - valueFrom: - secretKeyRef: - name: turniere-secret - key: master.key diff --git a/kubernetes/rolebinding.yml b/kubernetes/rolebinding.yml deleted file mode 100644 index 40c9b72..0000000 --- a/kubernetes/rolebinding.yml +++ /dev/null @@ -1,13 +0,0 @@ -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: gitlab-deploy-rb - namespace: turniere-backend -subjects: - - kind: ServiceAccount - name: gitlab-deploy - namespace: gitlab -roleRef: - kind: ClusterRole - name: gitlab-deploy-role - apiGroup: rbac.authorization.k8s.io diff --git a/kubernetes/secrets.ejson b/kubernetes/secrets.ejson deleted file mode 100644 index d8aff96..0000000 --- a/kubernetes/secrets.ejson +++ /dev/null @@ -1,11 +0,0 @@ -{ - "_public_key": "c837fba31b5cd2adb6809c23818e9ee1bc7a85f585f8bf9bca767f6e6e71db39", - "kubernetes_secrets": { - "turniere-secret": { - "_type": "Opaque", - "data": { - "master.key": "EJ[1:QEauT9a+p+4WLCIpVRIVafEN6KemhM544B3bx67Gyg4=:/2xjJ3RseqBy6JORX9vkaFv3pnhWYELB:KQvFX2W4aLBquluKJikYeO/sp2TOUROxGU8qj941EMk0vxapeGEh9CdQ9Rit1B+e]" - } - } - } -} diff --git a/kubernetes/service.yml b/kubernetes/service.yml deleted file mode 100644 index 1a45bed..0000000 --- a/kubernetes/service.yml +++ /dev/null @@ -1,46 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: backend-service - namespace: turniere-backend -spec: - selector: - app: turniere-backend - ports: - - name: http - port: 3000 - targetPort: 3000 ---- -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: backend-ingress-http - namespace: turniere-backend -spec: - entryPoints: - - http - routes: - - match: Host(`api01.turnie.re`) - kind: Rule - services: - - name: backend-service - port: 3000 - middlewares: - - name: redirect ---- -apiVersion: traefik.containo.us/v1alpha1 -kind: IngressRoute -metadata: - name: backend-ingress-https - namespace: turniere-backend -spec: - entryPoints: - - https - routes: - - match: Host(`api01.turnie.re`) - kind: Rule - services: - - name: backend-service - port: 3000 - tls: - certResolver: default From 96abf0536a1a5e1ec77986325aa8d666cbeaddf1 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Wed, 8 Jun 2022 18:50:54 +0200 Subject: [PATCH 2/6] Add simple health check --- app/controllers/health_controller.rb | 18 ++++++++++++++++++ chart/templates/deployment.yaml | 6 +----- config/routes.rb | 2 ++ 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 app/controllers/health_controller.rb diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb new file mode 100644 index 0000000..d72fc9a --- /dev/null +++ b/app/controllers/health_controller.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class HealthController < ApplicationController + def index + errors = [] + errors << 'database not conneected' unless database_connected? + status = errors.empty? ? :ok : :internal_server_error + render json: { errors: }, status: + end + + private + + def database_connected? + ApplicationRecord.connection.select_value('SELECT 1') == 1 + rescue StandardError + false + end +end diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index cd225cf..2ad7e96 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -34,13 +34,9 @@ spec: secretKeyRef: name: rails-master-key key: master.key - livenessProbe: - httpGet: - path: / - port: http readinessProbe: httpGet: - path: / + path: /healthz port: http resources: {{- toYaml .Values.resources | nindent 12 }} diff --git a/config/routes.rb b/config/routes.rb index 143d90c..101e869 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,4 +17,6 @@ Rails.application.routes.draw do end resources :match_scores, only: %i[show update] resources :groups, only: %i[show] + + get 'healthz', to: 'health#index' end From a9b43a5293bb714e04bfd7bb543e8714101d1a4a Mon Sep 17 00:00:00 2001 From: Thor77 Date: Wed, 8 Jun 2022 19:12:32 +0200 Subject: [PATCH 3/6] Use ci template --- .gitlab-ci.yml | 68 ++++++++------------------------------------------ 1 file changed, 10 insertions(+), 58 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 78922b8..357a41f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,69 +3,21 @@ stages: - test - deploy -kaniko: - stage: build - image: - name: gcr.io/kaniko-project/executor:debug - entrypoint: [""] - script: - - mkdir -p /kaniko/.docker - - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json - - | - for env in production development test; do - /kaniko/executor --context "${CI_PROJECT_DIR}" \ - --dockerfile "${CI_PROJECT_DIR}/docker/${env}/Dockerfile" \ - --destination "${CI_REGISTRY_IMAGE}/${env}:latest" \ - --destination "${CI_REGISTRY_IMAGE}/${env}/commits:${CI_COMMIT_SHA}" \ - --destination "${CI_REGISTRY_IMAGE}/${env}/refs:${CI_COMMIT_REF_SLUG}" \ - --build-arg base_commit="$CI_COMMIT_SHA" - done +include: + - project: 'turniere/turniere-infra' + file: '/ci/pipeline.yaml' rails spec: stage: test image: $CI_REGISTRY_IMAGE/test/commits:$CI_COMMIT_SHA - only: - changes: - - '**/*.rb' - - 'Gemfile' - - 'Gemfile.lock' - except: - variables: - - $SKIP_TEST + rules: + - changes: + - '**/*.rb' + - 'Gemfile' + - 'Gemfile.lock' + - if: $SKIP_TEST + when: never script: - cd /app - bundle exec rails db:migrate - bundle exec rails spec - -kubernetes: - tags: - - turniere-deploy - stage: deploy - only: - refs: - - master - variables: - - $FORCE_DEPLOY - image: ruby - variables: - KUBERNETES_SERVICE_ACCOUNT_OVERWRITE: gitlab-deploy - script: - - setup-kubectl - - krane render -f kubernetes --current-sha "$CI_COMMIT_SHA" | krane deploy turniere-backend-dev local -f kubernetes/secrets.ejson - - -deploy_watchtower: - stage: deploy - only: - refs: - - master - variables: - - $FORCE_DEPLOY - image: docker - services: - - docker:dind - script: - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - docker pull $CI_REGISTRY_IMAGE/production/commits:$CI_COMMIT_SHA - - docker tag $CI_REGISTRY_IMAGE/production/commits:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE/production:deploy - - docker push $CI_REGISTRY_IMAGE/production:deploy - From 934a4eaff37677431e5d379ebd3cd87623996af9 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Fri, 10 Jun 2022 19:20:57 +0200 Subject: [PATCH 4/6] Switch to a different postgres database --- config/credentials.yml.enc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc index fa3ee08..17f40e8 100644 --- a/config/credentials.yml.enc +++ b/config/credentials.yml.enc @@ -1 +1 @@ -ruZJ+91rINdvygAZmPntRDVcB5VHuv95KXN+XVt4V0xJZ73WeVqVvhFVBJDQtjona/2swLqI+dLwIgyYJHY8beW50yY/wFzcCHsBE6OYodB+d7X0aeqaz4lSkgu6n/rCq9ls7fCKYzUHp7CJie/U3K47opI37qgWaRt5rwggHefzmYEyUUBCVGlOFk0dEPqVaOwng4vcnD6UetJMeTBNH3lOE699qwMlNinAlUgSXGrZYmVat2aK9sO8QGVgOKR6qnMoKh0ZAluzseridO5SSrK7iaKyVI+72Gr8nOQ1ZYjYtolIe3xUMglbvdoB80hSIWsTZEP0sxz3ON/NYwFG2Nt2kuBTqn+RiG1AobgviaY/5YUb1umt7RGQEDQXblszouaI5w2MNqNMli5hN5dqs1aly/On+zzf/2Alveaq9DCIonVy9W6r/8aKt5hqmWrxT8ef5zJiwIr2flg0JXRruHXRTC2lcv9HKEs5N3B/Q62ra+KwcQyXE1tLoYqhjcGUXuN+NSet+SaGZdjn/Sbo1QfJ3IQipUiHPCDTZzf5IvDm+2zknPEDpgxjtXpwYRmVXrSMqpKDVyt80bgvto9tf/AbcjpnA1D18b+QHT8Dxg3wOuJ7l6mWPWFntQ33hnCKUxirpnMEGhRlhoEgX3hKnhJewoKN3UIb6mi+1iTaQCNNaYAK196uK7nPNsAGmcZOkgY3--lCxqjZEbmSLMKbsO--a59RgKSQDvXiB1pySy2jug== \ No newline at end of file +85AWF9g6oFzqO4ytbENY4TbLPPPoBO/nyY2APTzpxl2AKW2I/zkl5lupHQfN+hiHtpmcwcfnoEkTOlQEqDghc3bxh4dEt2m+T3Mk55EeNHfJFuOHdJFAC9fXyijXtXL3rkMh+tNRoikaAq5Hd1SA1gJonfQWUwnsCwbEc68INkkVjC5on1GxDT3xQHVhP5upRS9NGNPQoznswbkHym9PzEiQtlwU2UbXd/q/lG+2JHJIXlLC3HsjnfN1W2PH6QhK1Fd7KaUgEoCb0t97sW2yOoku7z2TA/wunTVvSB1480A2R8jehWjz5udz2mbzDfxuhdVXqFOfumvJFwUit4H7vAXvn82n6iFpJTsmLX48qqd+PyBO2Zqh9A9p1I8CcdL/2jyk2ISjXhbGocNRAFRNSOVfMU6EM3mChWweIIOdi/CCJHcWU+dWwpBYUTUdQYAou4hH+2dfgrkPoM+k7wVkFqYVpixave6k0KluONn47Oo9/75eZbGlW2PuzaGsOB2PgVVm1jle3cIQnkjjMr0omHXmYhYxrOdn/S/tzzUX+dvT3lExnt4PegjGOS817KklWK/HBGrGjcDkLiEvFyFzzR0SzRm9ViPG1oROL1Uw8IyB5NrfwctuSbhIhNL+J81gvm67EpwPPv+dN8gOV4d7YBrYAJm1xHSAi1i9KHGzNwV7OEB0tEZJunmKf4o6lokIxA==--ll7GLVG10R3rDecn--WOtP8uI0voEjTbs2DKhAKA== \ No newline at end of file From 2055f120ca4d1fbd967ca979db105cfe3ee4e00b Mon Sep 17 00:00:00 2001 From: Thor77 Date: Fri, 10 Jun 2022 19:21:12 +0200 Subject: [PATCH 5/6] Switch to new backend/frontend URLs --- config/environments/production.rb | 2 +- config/initializers/devise_token_auth.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 9940700..2347ed1 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -79,7 +79,7 @@ Rails.application.configure do # Mail config.action_mailer.raise_delivery_errors = true - config.action_mailer.default_url_options = { host: 'api01.turnie.re' } + config.action_mailer.default_url_options = { host: 'backend.turnie.re' } config.action_mailer.delivery_method = :mailgun config.action_mailer.mailgun_settings = { api_key: Rails.application.credentials.dig(:mailgun, :api_key), diff --git a/config/initializers/devise_token_auth.rb b/config/initializers/devise_token_auth.rb index 4d3e626..bb64943 100644 --- a/config/initializers/devise_token_auth.rb +++ b/config/initializers/devise_token_auth.rb @@ -48,5 +48,5 @@ DeviseTokenAuth.setup do |config| # do so by enabling this flag. NOTE: This feature is highly experimental! # config.enable_standard_devise_support = false - config.default_confirm_success_url = 'https://frontend01.turnie.re' + config.default_confirm_success_url = 'https://turnie.re' end From 7285558c62b3f38477efc5cde9ce8d32099a56e1 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Fri, 10 Jun 2022 19:32:41 +0200 Subject: [PATCH 6/6] Ensure spec only runs on branches and tags --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 357a41f..69c7276 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,12 +11,14 @@ rails spec: stage: test image: $CI_REGISTRY_IMAGE/test/commits:$CI_COMMIT_SHA rules: + - if: $SKIP_TEST + when: never + - if: $CI_PIPELINE_SOURCE != "push" + when: never - changes: - '**/*.rb' - 'Gemfile' - 'Gemfile.lock' - - if: $SKIP_TEST - when: never script: - cd /app - bundle exec rails db:migrate