ingang/.gitlab-ci.yml

73 lines
3.1 KiB
YAML

# This file is a template, and might need editing before it works on your project.
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/ruby/tags/
image: "ruby:alpine3.14"
# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
services:
# - mysql:latest
# - redis:latest
# - postgres:latest
# variables:
# POSTGRES_DB: database_name
# Cache gems in between builds
cache:
paths:
- vendor/ruby
# # This is a basic example for a gem or script which doesn't use
# # services such as redis or postgres
# before_script:
# - apk update && apk upgrade
# - apk add git # install git so we can install bigbluebutton-api-ruby
# - apk add build-base # needed for error `You have to install development tools first` on installing gem racc
# - apk add make g++ sqlite-dev # needed for gem sqlite3
# - ruby -v # Print out ruby version for debugging
# # Uncomment next line if your rails app needs a JS runtime:
# # - apk add yarn nodejs npm
# - gem install bundler --no-document # Bundler is not installed with the image
# - bundle config set --local path 'vendor' # Use ./vendor/ruby
# - bundle update # update gems to fix error cannot find gem mimemagic 0.3.5
# - bundle install -j $(nproc) # Install dependencies
# - bundle binstubs --all
# # - bundle exec rails app:update:bin # yields: your binstub at ./bin/rails was generated by Bundler instead of Rails
# - bin/rails app:update:bin
# # - bundle exec rails webpacker:install
rails:
# variables:
# DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB"
script:
# - alias rails=./vendor/ruby/3.0.0/bin/rails
- bundle exec rails db:migrate
- bundle exec rails db:seed
- bundle exec rails test
- bundle exec rake test
deploy:
stage: deploy
environment:
name: production
url: https://vergadering.bij1.org/ingang/
variables:
HOST: vergadering.bij1.org
KNOWN_HOSTS: |
vergadering.bij1.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKyTKq8naPEc57VVc2VzSeA5TWqBbDbMW/z0kST0mi+C
vergadering.bij1.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCswwYpRWy4I344CjrhgDt9FG5b78zkpvhihPfqMGNzYFI9ve1K2pKac6iGnm+LguKN4nkKrn3ZTmf5BfPwU9uW2oc5cklzJHddOj48lHgd7uiQYHgcqpkZzmeur0d22QY3jBlseH0PdV1avhJXlG9cS21+aQSOoz71/wYa9nCIAoMR4/onSjyDJdS8pUOxE1vZ2mGug3Oy3LuArlebkrU40XPLXE1xscE2YMB9LRfGAm/zx/c009MkiDiH4g0oItkUTOEkKHI6+Uw+Lq+AjfovjhhysSpzWaiye2khuQiO3klEGJaFYmu8ECYW6wOh8DWcc0KAq3LaQjFCFtjVMWiX
vergadering.bij1.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNY1WuwGwS+f2GeKLMlRdRE9gknad8yT1VT+XByX6st3E2Vo1oaktvroVtfL6/PZH5dRzQjCR4pB9tzKTb9CwTo=
script:
- apk add openssh
- apk add openrc
# - service sshd start
- mkdir -p ~/.ssh/
- echo "$SSH_KEY" | base64 -d > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo "$KNOWN_HOSTS" >> ~/.ssh/known_hosts
- ssh kiara@vergadering.bij1.org "cd ~/ingang; git pull; sudo systemctl restart ingang"
only:
- main