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 alembic migration to CI #69

Merged
merged 4 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,21 @@ You can do it with the following commands:
```bash
vercel login
```
### Database Creation (Required)

1. **Choosing a Database**
- You can use your own database hosted on a different service or opt for the [Neon](https://neon.tech/docs/introduction) database, which integrates seamlessly with Vercel.

2. **Setting Up a Neon Database via Vercel**
- In the **Projects dashboard** page on Vercel, navigate to the **Storage** section.
- Select the option to **Create a Database** to provision a Neon database.

3. **Configuring the Database URL**
- After creating the database, retrieve the **Database URL** provided by Neon.
- Include this URL in your **Environment Variables** under `DATABASE_URL`.

4. **Migrating the Database**
- The database migration will happen automatically during the deployment GitHub action, setting up the necessary tables and schema.
### Frontend Setup

1. Link the nextjs-frontend Project
Expand Down Expand Up @@ -436,23 +451,6 @@ You can do it with the following commands:

- For detailed instructions on how to set these secret keys, refer to the section on [Setting up Environment Variables](#setting-up-environment-variables).

### Database Connection

1. **Choosing a Database**
- You can use your own database hosted on a different service or opt for the [Neon](https://neon.tech/docs/introduction) database, which integrates seamlessly with Vercel.

2. **Setting Up a Neon Database via Vercel**
- In the **Backend** project page on Vercel, navigate to the **Storage** section.
- Select the option to **Create a Database** to provision a Neon database.

3. **Configuring the Database URL**
- After creating the database, retrieve the **Database URL** provided by Neon.
- Include this URL in your **Environment Variables** under `DATABASE_URL`.

4. **Migrating the Database**
- The database migration will happen automatically during the deployment GitHub action, setting up the necessary tables and schema.


## Makefile

This project includes a `Makefile` that provides a set of commands to simplify common tasks such as starting the backend and frontend servers, running tests, building Docker containers, and more.
Expand Down
7 changes: 7 additions & 0 deletions nextjs-frontend/vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"git": {
"deploymentEnabled": {
"main": false
}
}
}
23 changes: 22 additions & 1 deletion prod-backend-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,31 @@ jobs:
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --local-config=vercel.prod.json --token=${{ secrets.VERCEL_TOKEN }}

# Pull Vercel environment variables
- name: Pull Vercel Environment Information
run: vercel env pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}

# Install Alembic and other required dependencies
- name: Install Alembic and dependencies
run: pip install -r requirements.txt

# Run alembic migration
- name: Run alembic migration
run: |
set -o allexport
source .env.local
set +o allexport
alembic upgrade head

# Build project artifacts
- name: Build Project Artifacts
run: vercel build --prod --local-config=vercel.prod.json --token=${{ secrets.VERCEL_TOKEN }}

# Deploy project artifacts to Vercel
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --archive=split-tgz --local-config=vercel.prod.json --token=${{ secrets.VERCEL_TOKEN }}
run: vercel deploy --prebuilt --prod --archive=split-tgz --local-config=vercel.prod.json --token=${{ secrets.VERCEL_TOKEN }}




andersonresende marked this conversation as resolved.
Show resolved Hide resolved

Loading