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

added preview for PRs #313

Merged
merged 43 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
316e6dd
added preview for PRs
ravi-sawlani-yral Aug 12, 2024
02ff5d8
update version for fly preview action
ravi-sawlani-yral Aug 12, 2024
60ff151
remove personal org from fly preview
ravi-sawlani-yral Aug 12, 2024
946c843
fly preview org
ravi-sawlani-yral Aug 12, 2024
d59696e
set github secrets as env variables for fly preview
ravi-sawlani-yral Aug 12, 2024
845d3f8
rename fly toml file
ravi-sawlani-yral Aug 12, 2024
94c22c4
added fly-preview toml
ravi-sawlani-yral Aug 12, 2024
01e2f03
fix path argument
ravi-sawlani-yral Aug 12, 2024
3089574
rename fly-preview to fly
ravi-sawlani-yral Aug 12, 2024
f1d857e
build musl
ravi-sawlani-yral Aug 12, 2024
8b93884
add execution permission
ravi-sawlani-yral Aug 12, 2024
1011491
needs build check
ravi-sawlani-yral Aug 12, 2024
d8a51db
fix lint issue
ravi-sawlani-yral Aug 12, 2024
0798227
fix lint issues
ravi-sawlani-yral Aug 12, 2024
08a7130
set redis url directly from secrets
ravi-sawlani-yral Aug 13, 2024
e3a08ee
update fly secrets
ravi-sawlani-yral Aug 13, 2024
253a7f1
Merge branch 'main' into feat/added-workflow-for-PR-fly-preview
ravi-sawlani-yral Aug 13, 2024
be24f90
update fly secrets
ravi-sawlani-yral Aug 13, 2024
7c9cd72
Revert "update fly secrets"
ravi-sawlani-yral Aug 13, 2024
171f0dc
Revert "update fly secrets"
ravi-sawlani-yral Aug 13, 2024
e570549
update fly secrets
ravi-sawlani-yral Aug 13, 2024
402e462
remove build check run on pull request
ravi-sawlani-yral Aug 13, 2024
da5e520
update redis url in deploy preview github action
ravi-sawlani-yral Aug 13, 2024
2979ade
add top level envs
ravi-sawlani-yral Aug 13, 2024
e2c1f75
remove lint check for testing
ravi-sawlani-yral Aug 13, 2024
295e204
Revert "add top level envs"
ravi-sawlani-yral Aug 13, 2024
abde4d7
add explicit quotes
ravi-sawlani-yral Aug 13, 2024
05d4885
update github action to use ravi fly.io github action
ravi-sawlani-yral Aug 13, 2024
0a40018
update github action
ravi-sawlani-yral Aug 13, 2024
e3c47ef
update fly preview action version
ravi-sawlani-yral Aug 13, 2024
50d0cb4
update github action preview
ravi-sawlani-yral Aug 13, 2024
0030931
update github action preview
ravi-sawlani-yral Aug 13, 2024
688d6aa
print redis url
ravi-sawlani-yral Aug 13, 2024
0ffd9c8
update fly secrets
ravi-sawlani-yral Aug 13, 2024
ab07631
update fly secrets
ravi-sawlani-yral Aug 13, 2024
0125ecc
added fly secrets using flyctl
ravi-sawlani-yral Aug 13, 2024
fa011a1
update flyctl
ravi-sawlani-yral Aug 13, 2024
1c49ea5
update github preview workflow
ravi-sawlani-yral Aug 13, 2024
abbbab4
Revert "print redis url"
ravi-sawlani-yral Aug 13, 2024
4686e62
stage secrets and deploy again
ravi-sawlani-yral Aug 14, 2024
1692ab5
Merge branch 'main' into feat/added-workflow-for-PR-fly-preview
ravi-sawlani-yral Aug 14, 2024
275557d
enable lint check in build workflow
ravi-sawlani-yral Aug 16, 2024
e094e37
added step name
ravi-sawlani-yral Aug 16, 2024
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
3 changes: 0 additions & 3 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
required: false
type: boolean
workflow_dispatch:
pull_request:
branches:
- main

jobs:
build_check:
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: deploy preview
on:
pull_request:
types: [opened, reopened, synchronize, closed]

env:
FLY_API_TOKEN: ${{ secrets.HOT_OR_NOT_WEB_LEPTOS_SSR_FLY_IO_GITHUB_ACTION }}
FLY_ORG: gobazzinga-inc-584

jobs:
build_check:
uses: ./.github/workflows/build-check.yml
with:
publish-artifact: true

preview:
needs: build_check
runs-on: ubuntu-latest

# Only run one deployment at a time per PR.
concurrency:
group: pr-${{ github.event.number }}

# Create a GitHub deployment environment per staging app so it shows up
# in the pull request UI.
environment:
name: pr-${{ github.event.number }}
url: ${{ steps.deploy.outputs.url }}

steps:
- uses: actions/checkout@v3
- name: Download build
uses: actions/download-artifact@v3
with:
name: build-musl
- run: chmod +x target/x86_64-unknown-linux-musl/release/hot-or-not-web-leptos-ssr

- name: Deploy
id: deploy
uses: superfly/[email protected]

- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Set secret tokens
run: |
APP_NAME="pr-${{github.event.number}}-go-bazzinga-hot-or-not-web-leptos-ssr"
flyctl secrets set CF_TOKEN="$CF_TOKEN" --app "$APP_NAME" --stage
flyctl secrets set BACKEND_ADMIN_IDENTITY="$BACKEND_ADMIN_IDENTITY" --app "$APP_NAME" --stage
flyctl secrets set COOKIE_KEY="$COOKIE_KEY" --app "$APP_NAME" --stage
flyctl secrets set REDIS_URL="$REDIS_URL" --app "$APP_NAME" --stage
flyctl secrets set GOOGLE_CLIENT_SECRET=$GOOGLE_CLIENT_SECRET --app "$APP_NAME" --stage
flyctl secrets set GRPC_AUTH_TOKEN="$GRPC_AUTH_TOKEN" --app "$APP_NAME" --stage
env:
CF_TOKEN: ${{ secrets.CLOUDFLARE_STREAM_IMAGES_ANALYTICS_READ_WRITE_SECRET }}
BACKEND_ADMIN_IDENTITY: ${{ secrets.YRAL_WHITELISTED_BACKEND_GLOBAL_ADMIN_SECRET_KEY }}
COOKIE_KEY: ${{ secrets.AUTH_SESSION_COOKIE_SIGNING_SECRET_KEY }}
REDIS_URL: ${{ secrets.AUTH_FLY_IO_UPSTASH_REDIS_DATABASE_CONNECTION_STRING }}
GOOGLE_CLIENT_SECRET: ${{ secrets.STAGING_TEMPORARY_GOOGLE_CLIENT_SECRET }}
FLY_API_TOKEN: ${{ secrets.HOT_OR_NOT_WEB_LEPTOS_SSR_FLY_IO_GITHUB_ACTION }}
GRPC_AUTH_TOKEN: ${{ secrets.OFF_CHAIN_AGENT_GRPC_AUTH_TOKEN }}

- name: Deploy Secrets
run: |
APP_NAME="pr-${{github.event.number}}-go-bazzinga-hot-or-not-web-leptos-ssr"
flyctl deploy --app $APP_NAME
env:
FLY_API_TOKEN: ${{ secrets.HOT_OR_NOT_WEB_LEPTOS_SSR_FLY_IO_GITHUB_ACTION }}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
FLY_API_TOKEN: ${{ secrets.HOT_OR_NOT_WEB_LEPTOS_SSR_FLY_IO_GITHUB_ACTION }}
GRPC_AUTH_TOKEN: ${{ secrets.OFF_CHAIN_AGENT_GRPC_AUTH_TOKEN }}
- name: Deploy a docker container to Fly.io
run: flyctl deploy --remote-only
run: flyctl deploy --remote-only -c fly-prod.toml
env:
FLY_API_TOKEN: ${{ secrets.HOT_OR_NOT_WEB_LEPTOS_SSR_FLY_IO_GITHUB_ACTION }}

Expand Down
26 changes: 26 additions & 0 deletions fly-prod.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# fly.toml app configuration file generated for hot-or-not-web-leptos-ssr on 2023-11-13T11:04:42+05:30
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "hot-or-not-web-leptos-ssr"
primary_region = "sin"

[build]

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]

[[vm]]
size = "shared-cpu-2x"
memory = "1gb"

[env]
CF_ACCOUNT_ID = "a209c523d2d9646cc56227dbe6ce3ede"
GOOGLE_REDIRECT_URL = "https://yral.com/auth/google_redirect"
GOOGLE_CLIENT_ID = "804814798298-gckvp3hv9sskee5c646b7794k8qolsd7.apps.googleusercontent.com"
5 changes: 2 additions & 3 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "hot-or-not-web-leptos-ssr"
primary_region = "sin"

[build]
Expand All @@ -22,5 +21,5 @@ memory = "1gb"

[env]
CF_ACCOUNT_ID = "a209c523d2d9646cc56227dbe6ce3ede"
GOOGLE_REDIRECT_URL = "https://yral.com/auth/google_redirect"
GOOGLE_CLIENT_ID = "804814798298-gckvp3hv9sskee5c646b7794k8qolsd7.apps.googleusercontent.com"
GOOGLE_REDIRECT_URL = "https://hot-or-not-web-leptos-ssr-staging.fly.dev/auth/google_redirect"
GOOGLE_CLIENT_ID = "1000386990382-3012bbnodvsl8jblr0h8b52d9213c7cn.apps.googleusercontent.com"
2 changes: 1 addition & 1 deletion ssr/src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub async fn file_and_error_handler(
res.into_response()
} else {
let handler =
leptos_axum::render_app_to_stream(options.to_owned(), move || view! { <App /> });
leptos_axum::render_app_to_stream(options.to_owned(), move || view! { <App/> });
handler(req).await.into_response()
}
}
Expand Down
Loading