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

Test actions #138

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions .github/workflows/trunk-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ jobs:
run: |
export WEB_IMAGE=web:${GH_IMAGE_COMMIT_TAG}
export WORKER_IMAGE=worker:${GH_IMAGE_COMMIT_TAG}
docker tag ${WEB_IMAGE} ghcr.io/jonodrew/mentor-match/${WEB_IMAGE}
docker tag ${WEB_IMAGE} ghcr.io/jonodrew/mentor-match/web:latest
docker tag ${WORKER_IMAGE} ghcr.io/jonodrew/mentor-match/${WORKER_IMAGE}
docker tag ${WORKER_IMAGE} ghcr.io/jonodrew/mentor-match/worker:latest
docker tag ${WEB_IMAGE} ghcr.io/${{ github.repository }}/${WEB_IMAGE}
docker tag ${WEB_IMAGE} ghcr.io/${{ github.repository }}/web:latest
docker tag ${WORKER_IMAGE} ghcr.io/${{ github.repository }}/${WORKER_IMAGE}
docker tag ${WORKER_IMAGE} ghcr.io/${{ github.repository }}/worker:latest

- name: log in to registries
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Push images
run: |
docker image push --all-tags ghcr.io/jonodrew/mentor-match/web
docker image push --all-tags ghcr.io/jonodrew/mentor-match/worker
docker image push --all-tags ghcr.io/${{ github.repository }}/web
docker image push --all-tags ghcr.io/${{ github.repository }}/worker
22 changes: 22 additions & 0 deletions mentor-match-infra/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3
import aws_cdk as cdk

from mentor_match_infra.mentor_match_infra_stack import MentorMatchStack

app = cdk.App()
MentorMatchStack(
app,
"MentorMatchStack",
# If you don't specify 'env', this stack will be environment-agnostic.
# Account/Region-dependent features and context lookups will not work,
# but a single synthesized template can be deployed anywhere.
# Uncomment the next line to specialize this stack for the AWS Account
# and Region that are implied by the current CLI configuration.
# env=cdk.Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')),
# Uncomment the next line if you know exactly what Account and Region you
# want to deploy the stack to. */
# env=cdk.Environment(account='123456789012', region='us-east-1'),
# For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
)

app.synth()
44 changes: 44 additions & 0 deletions mentor-match-infra/cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"app": "python3 app.py",
"watch": {
"include": [
"**"
],
"exclude": [
"README.md",
"cdk*.json",
"requirements*.txt",
"source.bat",
"**/__init__.py",
"python/__pycache__",
"tests"
]
},
"context": {
"@aws-cdk/aws-lambda:recognizeLayerVersion": true,
"@aws-cdk/core:checkSecretUsage": true,
"@aws-cdk/core:target-partitions": [
"aws",
"aws-cn"
],
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
"@aws-cdk/aws-iam:minimizePolicies": true,
"@aws-cdk/core:validateSnapshotRemovalPolicy": true,
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true,
"@aws-cdk/core:enablePartitionLiterals": true,
"@aws-cdk/aws-events:eventsTargetQueueSameAccount": true,
"@aws-cdk/aws-iam:standardizedServicePrincipals": true,
"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true,
"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true,
"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true,
"@aws-cdk/aws-route53-patters:useCertificate": true,
"@aws-cdk/customresources:installLatestAwsSdkDefault": false,
"@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true,
"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true
}
}
Empty file.
30 changes: 30 additions & 0 deletions mentor-match-infra/mentor_match_infra/mentor_match_infra_stack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import aws_cdk as cdk
import aws_cdk.aws_ecs as ecs
import aws_cdk.aws_ecs_patterns as ecsp
from constructs import Construct


class MentorMatchStack(cdk.Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)

ecsp.ApplicationLoadBalancedFargateService(
self,
"MentorMatchWeb",
task_image_options=ecsp.ApplicationLoadBalancedTaskImageOptions(
image=ecs.ContainerImage.from_registry(
"ghcr.io/mentor-matching-online/mentor-match/web"
)
),
public_load_balancer=True,
)
ecsp.ApplicationLoadBalancedFargateService(
self,
"MentorMatchWorker",
task_image_options=ecsp.ApplicationLoadBalancedTaskImageOptions(
image=ecs.ContainerImage.from_registry(
"ghcr.io/mentor-matching-online/mentor-match/worker"
)
),
public_load_balancer=True,
)