Skip to content

misc fixes & improvements #21

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

Merged
merged 1 commit into from
Oct 25, 2024
Merged
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
18 changes: 9 additions & 9 deletions .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ jobs:
env:
COMMIT_MSG: "${{ github.event.head_commit.message }}"

# - id: "auth"
# uses: "google-github-actions/auth@v2"
# with:
# credentials_json: "${{ secrets.SECRETJSON_DEV }}"
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.SECRETJSON_DEV }}"

# - name: Set up Cloud SDK
# uses: "google-github-actions/setup-gcloud@v2"
- name: Set up Cloud SDK
uses: "google-github-actions/setup-gcloud@v2"

# - name: Deploy to Google App Engine
# run: |
# gcloud app deploy --appyaml=app.yaml --quiet -v=live --no-cache
- name: Deploy to Google App Engine
run: |
gcloud app deploy --appyaml=app.yaml --quiet -v=live --no-cache

- name: Complete Xata Migration from main to dev
run: |
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ jobs:
env:
COMMIT_MSG: "${{ github.event.head_commit.message }}"

# - id: "auth"
# uses: "google-github-actions/auth@v2"
# with:
# credentials_json: "${{ secrets.SECRETJSON_PROD }}"
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.SECRETJSON_PROD }}"

# - name: Set up Cloud SDK
# uses: "google-github-actions/setup-gcloud@v2"
- name: Set up Cloud SDK
uses: "google-github-actions/setup-gcloud@v2"

# - name: Deploy to Google App Engine
# run: |
# gcloud app deploy --appyaml=app.yaml --quiet -v=live --no-cache
- name: Deploy to Google App Engine
run: |
gcloud app deploy --appyaml=app.yaml --quiet -v=live --no-cache

- name: Complete Xata Migration from dev to main
run: |
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/reload-secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Reload secrets on app engine

on:
workflow_dispatch:
inputs:
environment:
description: "Environment to reload secrets for"
required: true
default: production
type: choice
options:
- production
- dev

jobs:
reload_secrets:
runs-on: ubuntu-latest

steps:
- run: |
npx tsx ./scripts/reload-secrets ${{ github.event.inputs.environment }}
5 changes: 5 additions & 0 deletions scripts/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,8 @@ export function shortPoll(fn: () => any, interval: number) {
}
});
}

export const getBEUrl = (env: string) =>
env === "dev"
? "https://compact-flash-306512.el.r.appspot.com"
: "https://compact-flash-306512.el.r.appspot.com";
16 changes: 8 additions & 8 deletions scripts/migration-complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ function getMigrationStatus() {
const status = getMigrationStatus();
console.log("status: ", status);

if (status === "active") {
spawnSync(`xata migrate complete ${target}`, {
stdio: "inherit",
shell: true,
});
}
if (status !== "active") return;

spawnSync(`xata migrate complete ${target}`, {
stdio: "inherit",
shell: true,
});

const isCompleted = await shortPoll(() => {
const status = getMigrationStatus();
if (status === "completed") return true;
if (status === "active") return undefined; //continue polling
if (["active", "in_progress"].includes(status)) return undefined; //continue polling
return false;
}, 3000);

Expand All @@ -51,7 +51,7 @@ function getMigrationStatus() {
.trim()
.split("\n");
const newLastMigrationId = ledger.at(-1) || "";
console.log(`${base} newLastMigrationId: `, newLastMigrationId);
console.log(`${branch} newLastMigrationId: `, newLastMigrationId);

await updateSecret("_LAST_MIGRATION_ID", newLastMigrationId, branch);
}
Expand Down
19 changes: 19 additions & 0 deletions scripts/reload-secrets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { getBEUrl, importSecrets } from "./helpers";

importSecrets();

const env = process.argv[2] || "dev";

(async () => {
await fetch(
`${getBEUrl(env)}/api/reload_secrets?key=${process.env.INFISICAL_WEBHOOK_KEY}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
}
);

console.log("secrets reloaded successfully");
})();
8 changes: 4 additions & 4 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export const PORT = process.env.PORT || 3000;
export const FE_URL = !isAppEngine()
? "http://localhost:5173"
: isDevEnv()
? "https://checkout.dev.physikomatics.com"
: "https://checkout.physikomatics.com";
? "https://rayon-react-starter-dev.web.app/"
: "https://rayon-react-starter.web.app/";

export const BE_URL = !isAppEngine()
? `http://localhost:${PORT}`
: isDevEnv()
? "https://api.dev.physikomatics.com"
: "https://api.physikomatics.com";
? "https://compact-flash-306512.el.r.appspot.com"
: "https://compact-flash-306512.el.r.appspot.com";
Loading