-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update deploy to fly.io section in docs * Update cookiecutter generated files
- Loading branch information
1 parent
5643b0c
commit 35e708b
Showing
67 changed files
with
868 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...tting_started/basic_auth/fastapi/my_fastagency_app/.github/workflows/deploy_to_fly_io.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
name: Fly Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
|
||
- name: Check if the app name is registered in fly.io and deploy | ||
run: ./scripts/deploy_to_fly_io.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...g_started/basic_auth/fastapi/my_fastagency_app/scripts/check-registered-app-pre-commit.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
# taken from: https://jaredkhan.com/blog/mypy-pre-commit | ||
|
||
# A script for running mypy, | ||
# with all its dependencies installed. | ||
|
||
set -o errexit | ||
|
||
# Change directory to the project root directory. | ||
cd "$(dirname "$0")"/.. | ||
|
||
./scripts/check-registered-app.sh |
8 changes: 8 additions & 0 deletions
8
..._src/getting_started/basic_auth/fastapi/my_fastagency_app/scripts/check-registered-app.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# Check file registered_app_domain.txt exists. If it does not exists, echo and exit. | ||
if [ ! -f registered_app_domain.txt ]; then | ||
echo -e "\033[0;33mWarning: App name is not registered.\033[0m" | ||
echo -e "\033[0;33mGithub Actions may fail if you push without registering.\033[0m" | ||
echo -e "\033[0;33mRegister your app name by running the script 'scripts/register_to_fly_io.sh'.\033[0m" | ||
fi |
21 changes: 17 additions & 4 deletions
21
...docs_src/getting_started/basic_auth/fastapi/my_fastagency_app/scripts/deploy_to_fly_io.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
#!/bin/bash | ||
|
||
echo -e "\033[0;32mLogging into fly.io\033[0m" | ||
fly auth login | ||
# Check file registered_app_domain.txt exists. If it does not exists, echo and exit. | ||
if [ ! -f registered_app_domain.txt ]; then | ||
echo -e "\033[0;31mError: App name is not registered.\033[0m" | ||
echo -e "\033[0;31mRegister your app name by running the script 'scripts/register_to_fly_io.sh'.\033[0m" | ||
echo -e "\033[0;31mExiting.\033[0m" | ||
exit 1 | ||
fi | ||
|
||
echo -e "\033[0;32mChecking if already logged into fly.io\033[0m" | ||
if ! flyctl auth whoami > /dev/null 2>&1; then | ||
echo -e "\033[0;32mLogging into fly.io\033[0m" | ||
flyctl auth login | ||
else | ||
echo -e "\033[0;32mAlready logged into fly.io\033[0m" | ||
fi | ||
|
||
echo -e "\033[0;32mDeploying to fly.io\033[0m" | ||
fly launch --config fly.toml --copy-config --yes | ||
flyctl deploy --config fly.toml --yes | ||
|
||
echo -e "\033[0;32mSetting secrets\033[0m" | ||
fly secrets set OPENAI_API_KEY=$OPENAI_API_KEY | ||
flyctl secrets set OPENAI_API_KEY=$OPENAI_API_KEY |
32 changes: 32 additions & 0 deletions
32
...cs_src/getting_started/basic_auth/fastapi/my_fastagency_app/scripts/register_to_fly_io.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
|
||
# Check file registered_app_domain.txt exists. If it does, echo and exit. | ||
if [ -f registered_app_domain.txt ]; then | ||
echo -e "\033[1;33mWarning: App name is already registered.\033[0m" | ||
echo -e "\033[0;32mRegistered app name is:\033[0m" | ||
cat registered_app_domain.txt | ||
exit 1 | ||
fi | ||
|
||
echo -e "\033[0;32mChecking if already logged into fly.io\033[0m" | ||
if ! flyctl auth whoami > /dev/null 2>&1; then | ||
echo -e "\033[0;32mLogging into fly.io\033[0m" | ||
flyctl auth login | ||
else | ||
echo -e "\033[0;32mAlready logged into fly.io\033[0m" | ||
fi | ||
|
||
export FLY_APP_NAME=my-fastagency-app | ||
|
||
echo -e "\033[0;32mRegistering app name in fly.io\033[0m" | ||
if flyctl apps create $FLY_APP_NAME; then | ||
echo "$FLY_APP_NAME.fly.dev" > registered_app_domain.txt | ||
echo -e "\033[0;32mApp name registered successfully\033[0m" | ||
echo -e "\033[0;32mRegistered app name is:\033[0m" | ||
cat registered_app_domain.txt | ||
else | ||
echo -e "\033[1;31mError: App name is not available.\033[0m" | ||
echo -e "\033[1;31mPlease change the app name in fly.toml and scripts/register_to_fly_io.sh and run this script again.\033[0m" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...getting_started/basic_auth/mesop/my_fastagency_app/.github/workflows/deploy_to_fly_io.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
name: Fly Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
|
||
- name: Check if the app name is registered in fly.io and deploy | ||
run: ./scripts/deploy_to_fly_io.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.