From ede3a012b8d4cb4b66dba747f1089816c7453671 Mon Sep 17 00:00:00 2001 From: Andreas Wittig Date: Fri, 9 Feb 2024 11:51:26 +0100 Subject: [PATCH] Adding pull through cache for ghcr.io --- mastodon.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mastodon.yaml b/mastodon.yaml index 0c7ac7d..e7e2a89 100644 --- a/mastodon.yaml +++ b/mastodon.yaml @@ -144,6 +144,7 @@ Resources: EngineVersion: '14.5' TemplateURL: './node_modules/@cfn-modules/rds-postgres/module.yml' Cluster: + DependsOn: GitHubPullThroughCacheRule Type: 'AWS::CloudFormation::Stack' Properties: Parameters: @@ -159,7 +160,7 @@ Resources: AlertingModule: !GetAtt 'Alerting.Outputs.StackName' ClientSgModule1: !GetAtt 'ClientSg.Outputs.StackName' ManagedPolicyArns: !Ref S3Policy - AppImage: 'ghcr.io/mastodon/mastodon:v4.2.5' + AppImage: !Sub '${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/github/mastodon:v4.2.5' AppCommand: 'bash,-c,bundle exec rails db:migrate && bundle exec rails s -p 3000' AppPort: '3000' AppEnvironment1Key: 'LOCAL_DOMAIN' @@ -232,7 +233,7 @@ Resources: AlertingModule: !GetAtt 'Alerting.Outputs.StackName' ClientSgModule1: !GetAtt 'ClientSg.Outputs.StackName' ManagedPolicyArns: !Ref S3Policy - AppImage: 'ghcr.io/mastodon/mastodon:v4.2.5' + AppImage: !Sub '${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/github/mastodon:v4.2.5' AppCommand: 'bash,-c,node ./streaming' AppPort: '4000' AppEnvironment1Key: 'LOCAL_DOMAIN' @@ -304,7 +305,7 @@ Resources: AlertingModule: !GetAtt 'Alerting.Outputs.StackName' ClientSgModule1: !GetAtt 'ClientSg.Outputs.StackName' ManagedPolicyArns: !Ref S3Policy - AppImage: 'ghcr.io/mastodon/mastodon:v4.2.5' + AppImage: !Sub '${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/github/mastodon:v4.2.5' AppCommand: 'bash,-c,bundle exec sidekiq' AppEnvironment1Key: 'LOCAL_DOMAIN' AppEnvironment1Value: !Ref DomainName @@ -375,7 +376,7 @@ Resources: AlertingModule: !GetAtt 'Alerting.Outputs.StackName' ClientSgModule1: !GetAtt 'ClientSg.Outputs.StackName' ManagedPolicyArns: !Ref S3Policy - AppImage: 'ghcr.io/mastodon/mastodon:v4.2.5' + AppImage: !Sub '${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/github/mastodon:v4.2.5' AppCommand: 'bash,-c,RAILS_ENV=production bin/tootctl media remove && RAILS_ENV=production bin/tootctl preview_cards remove' AppEnvironment1Key: 'LOCAL_DOMAIN' AppEnvironment1Value: !Ref DomainName @@ -656,3 +657,8 @@ Resources: SecretAccessKey: !GetAtt 'EmailUserAccessKey.SecretAccessKey' Region: !Ref 'AWS::Region' ServiceToken: !GetAtt 'SmtpPasswordConverterLamdaFunction.Arn' + GitHubPullThroughCacheRule: + Type: AWS::ECR::PullThroughCacheRule + Properties: + EcrRepositoryPrefix: 'github' + UpstreamRegistryUrl: 'ghcr.io'