-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github action & update some settings
- Loading branch information
邱宇軒Yuh Suan Chiu
committed
Feb 10, 2024
1 parent
c1bfcf6
commit 2f942ec
Showing
35 changed files
with
165 additions
and
622 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Deploy to Google Compute Engine | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev # Replace with your branch | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Build and push Docker image | ||
uses: actions/checkout@v3 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/snap_up_thsr:latest | ||
|
||
- name: Setup Google Cloud SDK | ||
uses: google-github-actions/setup-gcloud@master | ||
with: | ||
project_id: ${{ secrets.GCP_PROJECT_ID }} | ||
service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
export_default_credentials: true | ||
|
||
- name: Deploy to GCE | ||
run: | | ||
gcloud compute ssh user@instance -- "cd snap_up_thsr && \ | ||
git pull && \ | ||
docker run --network=${{ secrets.LIVE_NETWORK }} \ | ||
-p 8080:8000 \ | ||
-e REDIS_HOST=${{ secrets.REDIS_HOST }} \ | ||
-e DB_HOST=${{ secrets.DB_HOST }} \ | ||
-e DB_USER=${{ secrets.DB_USER }} \ | ||
-e DB_PASSWORD=${{ secrets.DB_PASSWORD }} \ | ||
-e DB_NAME=${{ secrets.DB_NAME }} \ | ||
-d \ | ||
--restart=always \ | ||
--name snap_up_thsr \ | ||
${{ secrets.DOCKER_HUB_USERNAME }}/snap_up_thsr:latest |
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 |
---|---|---|
|
@@ -6,6 +6,4 @@ __pycache__/ | |
# projects | ||
requirements/dev.txt | ||
*.log | ||
recognize_img.py | ||
|
||
.github/ | ||
/src/static |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,7 @@ redis | |
phonenumbers | ||
requests | ||
beautifulsoup4 | ||
ddddocr | ||
ddddocr | ||
|
||
# live | ||
gunicorn |
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
73 changes: 0 additions & 73 deletions
73
src/booking/migrations/0002_bookingrequest_thsr_ticket_id_thsrticket_date_and_more.py
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
# Generated by Django 4.2 on 2024-02-10 17:32 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('booking', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='thsrticket', | ||
name='user', | ||
field=models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AddField( | ||
model_name='bookingrequest', | ||
name='thsr_ticket', | ||
field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='booking.thsrticket', verbose_name='THSR Ticket ID'), | ||
), | ||
migrations.AddField( | ||
model_name='bookingrequest', | ||
name='user', | ||
field=models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AddIndex( | ||
model_name='bookingrequest', | ||
index=models.Index(fields=['status', '-depart_date'], name='booking_boo_status_9e3d6f_idx'), | ||
), | ||
] |
27 changes: 0 additions & 27 deletions
27
src/booking/migrations/0003_bookingrequest_passenger_ids_bookingrequest_status_and_more.py
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
src/booking/migrations/0004_alter_bookingrequest_deleted_at_and_more.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.