Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 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
38 changes: 35 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
name: Build evently

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# important for azure/login
permissions:
id-token: write
contents: read

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -34,4 +37,33 @@ jobs:
- name: Run UI Tests
run: cd src/evently.client && pnpm run test
- name: Test Docker Image
run: docker build --tag=expo-connect/latest --file=src/Evently.Server/Dockerfile .
run: docker build --tag=expo-connect/latest --file=src/Evently.Server/Dockerfile .

validate-tf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Validate Azure CLI can be used
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az account show
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform init
run: |
cd deploy/Terraform
terraform init
- name: Terraform validate
run: |
cd deploy/Terraform
terraform validate


63 changes: 63 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deploy evently

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# important for azure/login
permissions:
id-token: write
contents: read

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Validate Azure CLI can be used
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az account show
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform init
run: |
cd deploy/Terraform
terraform init
- name: Terraform validate
run: |
cd deploy/Terraform
terraform validate
- name: Terraform plan
run: |
cd deploy/Terraform
terraform plan
env:
TF_VAR_sql_admin_username: ${{ secrets.TF_VAR_SQL_ADMIN_USERNAME }}
TF_VAR_sql_admin_password: ${{ secrets.TF_VAR_SQL_ADMIN_PASSWORD }}
TF_VAR_google_client_id: ${{ secrets.TF_VAR_GOOGLE_CLIENT_ID }}
TF_VAR_google_client_secret: ${{ secrets.TF_VAR_GOOGLE_CLIENT_SECRET }}
TF_VAR_email_from: ${{ secrets.TF_VAR_EMAIL_FROM }}
TF_VAR_smtp_password: ${{ secrets.TF_VAR_SMTP_PASSWORD }}
# Apply step can be skipped for pull requests
- name: Terraform apply
run: cd deploy/Terraform && terraform apply -auto-approve
env:
TF_VAR_sql_admin_username: ${{ secrets.TF_VAR_SQL_ADMIN_USERNAME }}
TF_VAR_sql_admin_password: ${{ secrets.TF_VAR_SQL_ADMIN_PASSWORD }}
TF_VAR_google_client_id: ${{ secrets.TF_VAR_GOOGLE_CLIENT_ID }}
TF_VAR_google_client_secret: ${{ secrets.TF_VAR_GOOGLE_CLIENT_SECRET }}
TF_VAR_email_from: ${{ secrets.TF_VAR_EMAIL_FROM }}
TF_VAR_smtp_password: ${{ secrets.TF_VAR_SMTP_PASSWORD }}

2 changes: 1 addition & 1 deletion deploy/Terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ terraform {
}

locals {
environment = "staging"
environment = "staging"
}

provider "azurerm" {
Expand Down
2 changes: 1 addition & 1 deletion deploy/Terraform/sql-database.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resource "azurerm_mssql_database" "db" {
server_id = azurerm_mssql_server.sql_server.id
sku_name = "Basic" # Cheapest option: 5 DTUs
max_size_gb = 2 # Minimum size for Basic tier
auto_pause_delay_in_minutes = 60 # Auto-pause after 1 hour of inactivity
auto_pause_delay_in_minutes = 60 # Auto-pause after 1 hour of inactivity
}

resource "azurerm_mssql_firewall_rule" "allow_azure_services" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public async Task<PageResult<Gathering>> GetGatherings(
.Where((gathering) => endDateAfter == null || gathering.End >= endDateAfter)
.Where((gathering) => organiserId == null || gathering.OrganiserId == organiserId)
.Where(gathering => isCancelled == null || gathering.CancellationDateTime.HasValue == isCancelled)
.Where((gathering) => categoryIds == null || categoryIds.Count == 0 || gathering.GatheringCategoryDetails.Any(detail => categoryIds.Contains(detail.CategoryId)))
.Where((gathering) =>
categoryIds == null || categoryIds.Count == 0 || gathering.GatheringCategoryDetails.Any(detail => categoryIds.Contains(detail.CategoryId)))
.Where((gathering) =>
attendeeId == null || gathering.Bookings.Any((be) => be.AttendeeId == attendeeId))
.Include(gathering => gathering.Bookings.Where((be) => be.AttendeeId == attendeeId))
Expand Down
8 changes: 4 additions & 4 deletions src/Evently.Server/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"Authentication": {
"Google": {
"ClientId": "533425050385-fecekp0gl7cc5nt76o0ohgaik7c9l9l1.apps.googleusercontent.com",
"ClientSecret": "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"
"ClientId": "<Client ID from https://console.cloud.google.com/apis>",
"ClientSecret": "<Client Secret from https://console.cloud.google.com/apis>"
}
},
"EmailSettings": {
"ActualFrom": "hippotechcode@gmail.com",
"SmtpPassword": "snln ewqe nfyw oyfu"
"ActualFrom": "<Email Addr>",
"SmtpPassword": "<Email Password>"
}
}
Loading
Loading