Skip to content

Commit

Permalink
try to deploy from ga action
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienpoly committed Jun 24, 2023
1 parent 087ed27 commit a89300d
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MEILI_MASTER_KEY=your local meili master key but in therory meilisearch can run without master key in development mode
YOUTUBE_API_KEY=useful for scraping youtube videos but the app can run without it
GITHUB_TOKEN=useful for the profile enhancement feature but the app can run without it
RUBYVIDEO_GITHUB_TOKEN=useful for the profile enhancement feature but the app can run without it

46 changes: 46 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: deploy to production

on:
push:
branches:
- ga-mrsk

jobs:
build:
runs-on: ubuntu-latest
env:
MRSK_REGISTRY_PASSWORD: ${{ secrets.MRSK_REGISTRY_PASSWORD }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.0
bundler-cache: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Install dependencies
run: gem install mrsk

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.MRSK_REGISTRY_PASSWORD }}

- name: MRSK deploy
env:
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
MEILI_MASTER_KEY: ${{ secrets.MEILI_MASTER_KEY }}
RUBYVIDEO_GITHUB_TOKEN: ${{ secrets.RUBYVIDEO_GITHUB_TOKEN }}
APPSIGNAL_PUSH_API_KEY: ${{ secrets.APPSIGNAL_PUSH_API_KEY }}
run: mrsk deploy
2 changes: 1 addition & 1 deletion app/clients/github/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Client < ApplicationClient
private

def token
ENV["GITHUB_TOKEN"]
ENV["RUBYVIDEO_GITHUB_TOKEN"]
end

def content_type
Expand Down
64 changes: 10 additions & 54 deletions config/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,27 @@
# Name of your application. Used to uniquely configure containers.
service: rubyvideo

# Name of the container image.
image: adrienpoly/rubyvideo

# Deploy to these servers.
servers:
- 91.107.208.207

# Credentials for your image host.
registry:
# Specify the registry server, if you're not using Docker Hub
# server: registry.digitalocean.com / ghcr.io / ...
username: adrienpoly

# Always use an access token rather than real password when possible.
password:
- MRSK_REGISTRY_PASSWORD

# Inject ENV variables into containers (secrets come from .env).
env:
clear:
RAILS_ENV: production
secret:
- RAILS_MASTER_KEY
- APPSIGNAL_PUSH_API_KEY
- MEILI_MASTER_KEY
- GITHUB_TOKEN
# Use a different ssh user than root
- RUBYVIDEO_GITHUB_TOKEN
ssh:
user: root
# Configure builder setup.
# builder:
# args:
# RUBY_VERSION: 3.2.0
# secrets:
# - GITHUB_TOKEN
# remote:
# arch: amd64
# host: ssh://[email protected]
volumes:
- "storage:/rails/storage"
# Use accessory services (secrets come from .env).
accessories:
search:
image: getmeili/meilisearch:v1.1
Expand All @@ -58,37 +40,11 @@ accessories:
- MEILI_MASTER_KEY
volumes:
- "storage:/rails/storage"
# files:
# - config/mysql/production.cnf:/etc/mysql/my.cnf
# - db/production.sql.erb:/docker-entrypoint-initdb.d/setup.sql
# directories:
# - data:/var/lib/mysql
# redis:
# image: redis:7.0
# host: 192.168.0.2
# port: 6379
# directories:
# - data:/data

# Configure custom arguments for Traefik
# traefik:
# args:
# accesslog: true
# accesslog.format: json
# labels:
# traefik.tcp.routers.other.rule: "HostSNI(`*`)"
# traefik.tcp.routers.other.entrypoints: search
# traefik.tcp.services.other.loadbalancer.server.port: 7700
# traefik:
# options:
# publish:
# - 80:80
# - "7700:7700"
# args:
# entrypoints.web.address: ":80"
# entrypoints.otherentrypoint.address: ":7700"
# Configure a custom healthcheck (default is /up on port 3000)
# healthcheck:
# path: /healthz
# port: 4000

builder:
args:
RUBY_VERSION: 3.2.0
RAILS_ENV: production
NODE_VERSION: 19.12.0
YARN_VERSION: 1.22.19
multiarch: false

0 comments on commit a89300d

Please sign in to comment.