Compare commits
8 Commits
755c429d04
...
126-all-lo
| Author | SHA1 | Date | |
|---|---|---|---|
| 075508413e | |||
| 56b07d64a9 | |||
| 928a4dae43 | |||
| e345898341 | |||
| a6af3c2229 | |||
| b8f708fd6d | |||
| 1c46f58afc | |||
| fa7a39e48a |
@@ -1,44 +0,0 @@
|
|||||||
name: Deploy
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
app_name:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
environment_name:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
version_number:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
environment: ${{ inputs.environment_name }}
|
|
||||||
steps:
|
|
||||||
- name: Get Secrets from Infisical
|
|
||||||
uses: Infisical/secrets-action@v1.0.16
|
|
||||||
with:
|
|
||||||
domain: ${{ secrets.INFISICAL_DOMAIN }}
|
|
||||||
client-id: ${{ secrets.INFISICAL_CLIENT_ID }}
|
|
||||||
client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
|
||||||
project-slug: ${{ secrets.INFISICAL_PROJECT_SLUG }}
|
|
||||||
env-slug: ${{ inputs.environment_name }}
|
|
||||||
secret-path: /flying
|
|
||||||
|
|
||||||
- name: Install Azure CLI
|
|
||||||
run: |
|
|
||||||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
|
||||||
|
|
||||||
- name: Log in to Azure
|
|
||||||
run: |
|
|
||||||
az login --service-principal --username ${{ env.AZURE_CLIENT_ID }} --password ${{ env.AZURE_CLIENT_SECRET }} --tenant ${{ env.AZURE_TENANT_ID }}
|
|
||||||
|
|
||||||
- name: Update Container App
|
|
||||||
run: |
|
|
||||||
az containerapp update --name ${{ inputs.app_name }}-${{ inputs.environment_name }} --container-name ${{ inputs.app_name }} --resource-group ${{ env.RESOURCE_GROUP }} --image docker.io/noahspan/${{ inputs.app_name }}:${{ inputs.version_number }}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
name: 'Infrastructure'
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
environment_name:
|
|
||||||
type: string
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
infrastructure:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
environment:
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
sparse-checkout: |
|
|
||||||
infrastructure
|
|
||||||
|
|
||||||
- name: Get Secrets from Infisical
|
|
||||||
uses: Infisical/secrets-action@v1.0.16
|
|
||||||
with:
|
|
||||||
domain: ${{ secrets.INFISICAL_DOMAIN }}
|
|
||||||
client-id: ${{ secrets.INFISICAL_CLIENT_ID }}
|
|
||||||
client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
|
||||||
project-slug: ${{ secrets.INFISICAL_PROJECT_SLUG }}
|
|
||||||
env-slug: ${{ inputs.environment_name }}
|
|
||||||
secret-path: /flying/terraform
|
|
||||||
|
|
||||||
- name: Setup Terraform
|
|
||||||
uses: hashicorp/setup-terraform@v4
|
|
||||||
|
|
||||||
- name: Terraform init
|
|
||||||
run: |
|
|
||||||
terraform init -input=false
|
|
||||||
|
|
||||||
- name: Terraform plan
|
|
||||||
run: |
|
|
||||||
terraform plan -no-color -input=false
|
|
||||||
|
|
||||||
- name: Terraform apply
|
|
||||||
run: |
|
|
||||||
terraform apply -no-color -
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
name: Pull Request
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
changes:
|
|
||||||
uses: ./.gitea/workflows/changes.yaml
|
|
||||||
|
|
||||||
build:
|
|
||||||
if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.client == 'true'}}
|
|
||||||
name: build-and-test
|
|
||||||
needs:
|
|
||||||
- changes
|
|
||||||
uses: ./.gitea/workflows/build_and_test.yaml
|
|
||||||
with:
|
|
||||||
environment_name: test
|
|
||||||
version_number: ${{ github.run_id }}
|
|
||||||
secrets: inherit
|
|
||||||
@@ -15,22 +15,12 @@ jobs:
|
|||||||
environment: ${{ inputs.environment_name }}
|
environment: ${{ inputs.environment_name }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
sparse-checkout: |
|
sparse-checkout: |
|
||||||
api
|
api
|
||||||
client
|
client
|
||||||
|
|
||||||
- name: Get Secrets from Infisical
|
|
||||||
uses: Infisical/secrets-action@v1.0.16
|
|
||||||
with:
|
|
||||||
domain: ${{ secrets.INFISICAL_DOMAIN }}
|
|
||||||
client-id: ${{ secrets.INFISICAL_CLIENT_ID }}
|
|
||||||
client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
|
||||||
project-slug: ${{ secrets.INFISICAL_PROJECT_SLUG }}
|
|
||||||
env-slug: ${{ inputs.environment_name }}
|
|
||||||
secret-path: /flying
|
|
||||||
|
|
||||||
- name: Install Nest CLI
|
- name: Install Nest CLI
|
||||||
run: |
|
run: |
|
||||||
npm install -g @nestjs/cli
|
npm install -g @nestjs/cli
|
||||||
@@ -38,7 +28,7 @@ jobs:
|
|||||||
- name: 'Setup Node'
|
- name: 'Setup Node'
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: ${{ vars.NODE_VERSION }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -54,20 +44,21 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Client
|
- name: Build Client
|
||||||
env:
|
env:
|
||||||
VITE_API_URL: ${{ env.VITE_API_URL }}
|
VITE_API_URL: ${{ vars.VITE_API_URL }}
|
||||||
VITE_BASE_URL: ${{ env.VITE_BASE_URL }}
|
VITE_BASE_URL: ${{ vars.VITE_BASE_URL }}
|
||||||
VITE_CLIENT_ID: ${{ env.VITE_CLIENT_ID }}
|
VITE_CLIENT_ID: ${{ vars.VITE_CLIENT_ID }}
|
||||||
VITE_ISSUER_URI: ${{ env.VITE_ISSUER_URI }}
|
VITE_ISSUER_URI: ${{ vars.VITE_ISSUER_URI }}
|
||||||
VITE_TENANT_ID: ${{ env.VITE_TENANT_ID }}
|
VITE_TENANT_ID: ${{ vars.VITE_TENANT_ID }}
|
||||||
run: |
|
run: |
|
||||||
|
printenv
|
||||||
npm run build -w client
|
npm run build -w client
|
||||||
|
|
||||||
- name: Log into Docker Hub
|
- name: Log into Docker Hub
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ env.DOCKERHUB_USERNAME }}
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ env.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
@@ -7,9 +7,6 @@ on:
|
|||||||
client:
|
client:
|
||||||
value: ${{ jobs.changes.outputs.client }}
|
value: ${{ jobs.changes.outputs.client }}
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changes:
|
changes:
|
||||||
name: filter
|
name: filter
|
||||||
@@ -18,13 +15,7 @@ jobs:
|
|||||||
api: ${{ steps.filter.outputs.api }}
|
api: ${{ steps.filter.outputs.api }}
|
||||||
client: ${{ steps.filter.outputs.client }}
|
client: ${{ steps.filter.outputs.client }}
|
||||||
steps:
|
steps:
|
||||||
- name: 'Setup Node'
|
- uses: actions/checkout@v3
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: '22.x'
|
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: dorny/paths-filter@v3
|
- uses: dorny/paths-filter@v3
|
||||||
id: filter
|
id: filter
|
||||||
35
.github/workflows/deploy.yaml
vendored
Normal file
35
.github/workflows/deploy.yaml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Deploy
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
app_name:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
environment_name:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
version_number:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: ${{ inputs.environment_name }}
|
||||||
|
steps:
|
||||||
|
- name: Log in to Azure
|
||||||
|
uses: azure/login@v2
|
||||||
|
with:
|
||||||
|
client-id: ${{ vars.AZURE_CLIENT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
tenant-id: ${{ vars.AZURE_TENANT_ID }}
|
||||||
|
|
||||||
|
- name: Azure CLI script
|
||||||
|
uses: azure/cli@v2
|
||||||
|
with:
|
||||||
|
azcliversion: latest
|
||||||
|
inlineScript: |
|
||||||
|
az containerapp update --name ${{ inputs.app_name }}-${{ inputs.environment_name }} --container-name ${{ inputs.app_name }} --resource-group noahspan --image docker.io/noahspan/${{ inputs.app_name }}:${{ inputs.version_number }}
|
||||||
@@ -6,14 +6,14 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changes:
|
changes:
|
||||||
uses: ./.gitea/workflows/changes.yaml
|
uses: ./.github/workflows/changes.yaml
|
||||||
|
|
||||||
build-and-test:
|
build:
|
||||||
if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.client == 'true' }}
|
if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.client == 'true' }}
|
||||||
name: build-and-test
|
name: build
|
||||||
needs:
|
needs:
|
||||||
- changes
|
- changes
|
||||||
uses: ./.gitea/workflows/build_and_test.yaml
|
uses: ./.github/workflows/build_and_test.yaml
|
||||||
with:
|
with:
|
||||||
environment_name: test
|
environment_name: test
|
||||||
version_number: ${{ github.run_id }}
|
version_number: ${{ github.run_id }}
|
||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- changes
|
- changes
|
||||||
- build
|
- build
|
||||||
uses: ./.gitea/workflows/deploy.yaml
|
uses: ./.github/workflows/deploy.yaml
|
||||||
with:
|
with:
|
||||||
app_name: flying
|
app_name: flying
|
||||||
environment_name: test
|
environment_name: test
|
||||||
19
.github/workflows/pull_request.yaml
vendored
Normal file
19
.github/workflows/pull_request.yaml
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
name: Pull Request
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
changes:
|
||||||
|
uses: ./.github/workflows/changes.yaml
|
||||||
|
|
||||||
|
build:
|
||||||
|
if: ${{ needs.changes.outputs.app == 'true' || needs.changes.outputs.client == 'true'}}
|
||||||
|
name: build
|
||||||
|
needs:
|
||||||
|
- changes
|
||||||
|
uses: ./.github/workflows/build_and_test.yaml
|
||||||
|
with:
|
||||||
|
environment_name: pull_request
|
||||||
|
version_number: ${{ github.run_id }}
|
||||||
|
secrets: inherit
|
||||||
@@ -7,7 +7,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: build
|
name: build
|
||||||
uses: ./.gitea/workflows/build_and_test.yaml
|
uses: ./.github/workflows/build_and_test.yaml
|
||||||
with:
|
with:
|
||||||
environment_name: prod
|
environment_name: prod
|
||||||
version_number: ${{ github.ref_name }}
|
version_number: ${{ github.ref_name }}
|
||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
name: deploy
|
name: deploy
|
||||||
needs:
|
needs:
|
||||||
- build
|
- build
|
||||||
uses: ./.gitea/workflows/deploy.yaml
|
uses: ./.github/workflows/deploy.yaml
|
||||||
with:
|
with:
|
||||||
app_name: flying
|
app_name: flying
|
||||||
environment_name: prod
|
environment_name: prod
|
||||||
24
README.md
24
README.md
@@ -1,23 +1,3 @@
|
|||||||
# Flying
|
# Flying (React and NestJS)
|
||||||
|
|
||||||
A web app for tracking pilot flight hours and sharing flight tracks.
|
A pilot logbook app
|
||||||
|
|
||||||
## Built With
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
## Roadmap
|
|
||||||
|
|
||||||
- [ ] Expense tracking for plane rental, instructor fees, and fuel rates
|
|
||||||
- [ ] Export logbook to CSV
|
|
||||||
- [ ]
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
## Contact
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# Flying API
|
# Flying API
|
||||||
|
|
||||||
An API for the Flying app.
|
An API for the Flying app.
|
||||||
...
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "api",
|
"name": "api",
|
||||||
"version": "2.1.5",
|
"version": "2.1.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "",
|
"author": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export class LogInterceptor implements NestInterceptor {
|
|||||||
|
|
||||||
if (jwtPayload[rolesKeyName].includes('Flying.Read')) {
|
if (jwtPayload[rolesKeyName].includes('Flying.Read')) {
|
||||||
if (data.entities) {
|
if (data.entities) {
|
||||||
const logs = data.entities.map((entity) => limitData(entity));
|
const logs = data.entities.map((entity) => limitData(data.entities));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
entities: logs,
|
entities: logs,
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
...
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "client",
|
"name": "client",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "2.1.5",
|
"version": "2.1.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -561,7 +561,7 @@ const Logbook: React.FC<unknown> = () => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!state.isLoading && state.entries.length > 0 && screenSize !== ScreenSize.SM && screenSize !== ScreenSize.MD && (
|
{!state.isLoading && state.entries.length > 0 && screenSize !== ScreenSize.SM && screenSize !== ScreenSize.MD && (
|
||||||
<div className='col-span-12 pr-5 pb-5 pl-5 bg-base-100 border border-base-100 rounded-lg'>
|
<div className='col-span-12 pr-5 pb-5 pl-5 bg-base-100 border border-base-100 rounded-lg '>
|
||||||
<div className='overflow-x-auto mb-5'>
|
<div className='overflow-x-auto mb-5'>
|
||||||
<div className='col-span-12 justify-self-end self-center mt-1 mr-1 mb-2'>
|
<div className='col-span-12 justify-self-end self-center mt-1 mr-1 mb-2'>
|
||||||
<label className='select select-sm select-ghost'>
|
<label className='select select-sm select-ghost'>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ export default defineConfig({
|
|||||||
strictPort: true
|
strictPort: true
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
host: true,
|
|
||||||
port: 8080,
|
port: 8080,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
|
|||||||
@@ -3,30 +3,15 @@ version: '3.8'
|
|||||||
services:
|
services:
|
||||||
azurite:
|
azurite:
|
||||||
container_name: azurite-flying
|
container_name: azurite-flying
|
||||||
image: mcr.microsoft.com/azure-storage/azurite
|
image: mcr.microsoft.com/azure-storage/azurite
|
||||||
ports:
|
ports:
|
||||||
- '10000:10000'
|
- '10000:10000'
|
||||||
- '10001:10001'
|
- '10001:10001'
|
||||||
- '10002:10002'
|
- '10002:10002'
|
||||||
command: 'azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 --loose --skipApiVersionCheck'
|
command: 'azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 --loose --skipApiVersionCheck'
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "nc", "-z", "127.0.0.1", "10000"]
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./azurite-data:/data
|
- ./azurite-data:/data
|
||||||
|
|
||||||
seed:
|
|
||||||
image: mcr.microsoft.com/azure-cli
|
|
||||||
depends_on:
|
|
||||||
azurite:
|
|
||||||
condition: service_healthy
|
|
||||||
volumes:
|
|
||||||
- ./seed-data:/data
|
|
||||||
entrypoint: >
|
|
||||||
sh -c "
|
|
||||||
az storage container create --name mycontainer --connection-string 'DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;' &&
|
|
||||||
az storage blob upload-batch --destination mycontainer --source /data --connection-string 'DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;'
|
|
||||||
"
|
|
||||||
|
|
||||||
restore:
|
restore:
|
||||||
container_name: restore
|
container_name: restore
|
||||||
image: litestream/litestream:0.3.13
|
image: litestream/litestream:0.3.13
|
||||||
@@ -66,7 +51,6 @@ services:
|
|||||||
condition: service_started
|
condition: service_started
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
azurite-data:
|
# azurite-data:
|
||||||
backup:
|
backup:
|
||||||
data:
|
data:
|
||||||
seed-data:
|
|
||||||
3
infrastructure/.gitignore
vendored
3
infrastructure/.gitignore
vendored
@@ -1,5 +1,4 @@
|
|||||||
# Terraform
|
# Terraform
|
||||||
.terraform/*
|
.terraform/*
|
||||||
*.tfstate
|
*.tfstate
|
||||||
*.tfstate.*
|
*.tfstate.*
|
||||||
.DS_Store
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@noahspan/flying",
|
"name": "@noahspan/flying",
|
||||||
"version": "2.1.5",
|
"version": "2.1.3",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node api/dist/main",
|
"start": "node api/dist/main",
|
||||||
"format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"",
|
"format": "prettier --write \"**/src/**/*.ts\" \"**/test/**/*.ts\"",
|
||||||
|
|||||||
Reference in New Issue
Block a user