Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Cloudfare R2 storage #1948

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/ruby:${VARIANT} AS base
# && chmod -R $USER_UID:$USER_GID /home/vscode; \
# fi

ARG NODE_VERSION=18.14.2
ARG NODE_VERSION=20.18.2

ENV BUNDLE_PATH="/usr/local/bundle"
ENV GEM_HOME="/usr/local/bundle/gems"
Expand Down
9 changes: 8 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,11 @@ CI=true
SOLID_QUEUE_USERNAME: <some_username>
SOLID_QUEUE_PASSWORD: <some_password>
MISSION_CONTROL_ENABLED=true
POSTMARK_API_TOKEN= "<Replace with postmark API Token>"
POSTMARK_API_TOKEN= "<Replace with postmark API Token>"

#Cloudfare R2 credentials
CLOUDFLARE_R2_ACCESS_KEY_ID= "<Replace with cloudfare access key id>"
CLOUDFLARE_R2_SECRET_ACCESS_KEY= "<Replace with cloudfare R2 secret access key key>"
CLOUDFLARE_R2_BUCKET_NAME= "<Replace with R2 bucket name key id>"
CLOUDFLARE_R2_REGION= "auto"
CLOUDFLARE_R2_ENDPOINT= "<Replace with cloudfare R2 endpoint url>"
12 changes: 7 additions & 5 deletions .github/workflows/backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ jobs:
S3_BUCKET: miru-db-backup

steps:
- uses: s3-actions/s3cmd@v1.2.0
- uses: ryand56/r2-upload-action@latest
with:
provider: aws
region: us-east-1
access_key: ${{ secrets.S3_ACCESS_KEY }}
secret_key: ${{ secrets.S3_SECRET_KEY }}
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY }}
r2-secret-access-key: ${{ secrets.R2_SECRET_KEY }}
r2-bucket: ${{ secrets.R2_DB_BUCKET }}
source-dir: src
destination-dir: ./
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Set filename
run: echo "filename=db-$(date -u +"%Y-%m-%d-%H%M%S").sql" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 18.14.2
node-version: 20.18.2
- name: Find yarn cache location
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.14.2
20.18.2
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.14.2
20.18.2
2 changes: 1 addition & 1 deletion Dockerfile.local
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#syntax=docker/dockerfile:1
FROM ruby:3.2.4-slim AS base

ARG NODE_VERSION=18.14.2
ARG NODE_VERSION=20.18.2

ENV BUNDLE_PATH="/usr/local/bundle"
ENV GEM_HOME="/usr/local/bundle/gems"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#syntax=docker/dockerfile:1
FROM ruby:3.2.4-slim AS base

ARG NODE_VERSION=18.14.2
ARG NODE_VERSION=20.18.2

RUN mkdir /app
WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX

# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :amazon
config.active_storage.service = :cloudfare

# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
Expand Down
11 changes: 6 additions & 5 deletions config/storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ local:
root: <%= Rails.root.join("storage") %>

# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
amazon:
cloudfare:
service: S3
access_key_id: <%= ENV.fetch('AWS_ACCESS_KEY_ID', '') %>
secret_access_key: <%=ENV.fetch('AWS_SECRET_ACCESS_ID', '')%>
region: <%= ENV.fetch('AWS_REGION', '') %>
bucket: <%= ENV.fetch('AWS_S3_BUCKET_NAME', '') %>
access_key_id: <%= ENV.fetch('CLOUDFLARE_R2_ACCESS_KEY_ID', '') %>
secret_access_key: <%= ENV.fetch('CLOUDFLARE_R2_SECRET_ACCESS_KEY', '') %>
region: <%= ENV.fetch('CLOUDFLARE_R2_REGION', '') %>
bucket: <%= ENV.fetch('CLOUDFLARE_R2_BUCKET_NAME', '') %>
endpoint: <%= ENV.fetch('CLOUDFLARE_R2_ENDPOINT', '') %>
# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
Expand Down
2 changes: 1 addition & 1 deletion docs/.node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18.0
20.18.2
Loading