Skip to content

Commit 837b034

Browse files
committed
Fix PostgreSQL commands to use Managed Postgres (mpg) with org flag
- Use 'flyctl mpg' commands for Managed Postgres instead of 'flyctl postgres' - Add '--org perl-irc' flag to avoid interactive prompts in CI - Use 'flyctl mpg list' to check for existing clusters - Use 'flyctl mpg create' to create managed clusters - Use 'flyctl mpg attach' to attach to apps Note: 'fly postgres' is for unmanaged Postgres which is not recommended. Managed Postgres (mpg) is the supported solution. 🤖 Generated with [Claude Code](https://claude.ai/code)
1 parent de22472 commit 837b034

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

.github/workflows/fly.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ jobs:
2323

2424
- name: Create PostgreSQL Database
2525
run: |
26-
# Check if magnet-postgres already exists
27-
if ! flyctl apps list | grep -q "magnet-postgres"; then
28-
echo "Creating PostgreSQL database..."
29-
flyctl postgres create --name magnet-postgres --region ord --initial-cluster-size 1
26+
# Check if managed postgres cluster already exists
27+
if ! flyctl mpg list --org perl-irc | grep -q "magnet-postgres"; then
28+
echo "Creating Managed PostgreSQL cluster..."
29+
flyctl mpg create --name magnet-postgres --region ord --org perl-irc
3030
else
31-
echo "PostgreSQL database already exists"
31+
echo "Managed PostgreSQL cluster already exists"
3232
fi
3333
3434
- name: Create Volumes
@@ -60,13 +60,10 @@ jobs:
6060
- name: Attach PostgreSQL to magnet-atheme
6161
if: matrix.app == 'magnet-atheme'
6262
run: |
63-
# Check if already attached
64-
if ! flyctl postgres attach --app magnet-atheme magnet-postgres --dry-run 2>/dev/null; then
65-
echo "Attaching PostgreSQL to magnet-atheme..."
66-
flyctl postgres attach --app magnet-atheme magnet-postgres
67-
else
68-
echo "PostgreSQL already attached to magnet-atheme"
69-
fi
63+
# Attach managed postgres to atheme app
64+
# This creates DATABASE_URL secret automatically
65+
echo "Attaching Managed PostgreSQL to magnet-atheme..."
66+
flyctl mpg attach magnet-postgres --app magnet-atheme || echo "Database may already be attached"
7067
7168
- name: Set Tailscale Auth Key Secret
7269
run: |

0 commit comments

Comments
 (0)