Skip to content

Commit

Permalink
Scoutgametelegram (#4960)
Browse files Browse the repository at this point in the history
* Scoutgametelegram

* Remove twa from main package

* Add validation of initData

* Update env

* Update secret name

* Revert not found deletion

* Update model

* Update import charmClient

* Add one e2e test

* Updated how we handle the user and avatar

* Remove @root from scoutgametelegram

* Update bg image
  • Loading branch information
valentinludu authored Nov 7, 2024
1 parent fe32d5e commit eaee5d8
Show file tree
Hide file tree
Showing 91 changed files with 2,458 additions and 171 deletions.
5 changes: 5 additions & 0 deletions .cdk/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,10 @@ export const apps: { [key: string]: { stg?: Options; prd?: Options } } = {
sslCert: charmverseCert,
instanceType: 't3.medium'
}
},
scoutgametelegram: {
prd: {
sslCert: scoutgameCert
}
}
};
14 changes: 14 additions & 0 deletions .ebextensions/scoutgametelegram/00_env_vars.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Do not put any env var or secrets used by the app here. Put in .ebstalk.apps.env/scoutgame.env
# This file should only have
# - env variables referenced in docker-compose file
# - variables needed for the .platform/hooks/predeploy/01_pull_secrets.sh script to run

option_settings:
aws:elasticbeanstalk:application:environment:
COMPOSE_PROJECT_NAME: "prd"
COMPOSE_PROFILES: "prd-scoutgametelegram"
EBSTALK_ENV_FILE: "scoutgametelegram.env"
SERVICE_ENV: "prd" # this sets the value of datadog env tag
SERVICE_NAME: "scoutgametelegram"
IMGNAME: "scoutgametelegram"
IMGTAG: ""
4 changes: 4 additions & 0 deletions .ebextensions/scoutgametelegram/01_filesystem.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
option_settings:
aws:autoscaling:launchconfiguration:
RootVolumeType: gp2
RootVolumeSize: "24"
7 changes: 7 additions & 0 deletions .ebextensions/scoutgametelegram/02_autoscaling.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# this configures Beanstalk to restart the app if the app's health check fails
Resources:
AWSEBAutoScalingGroup:
Type: "AWS::AutoScaling::AutoScalingGroup"
Properties:
HealthCheckType: ELB
HealthCheckGracePeriod: 300
13 changes: 13 additions & 0 deletions .ebextensions/scoutgametelegram/03_env_health_ignore_400.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
option_settings:
aws:elasticbeanstalk:healthreporting:system:
SystemType: enhanced
ConfigDocument:
Rules:
Environment:
Application:
ApplicationRequests4xx:
Enabled: false
ELB:
ELBRequests4xx:
Enabled: false
Version: 1
21 changes: 21 additions & 0 deletions .ebextensions/scoutgametelegram/06_cloudwatch_alarm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Adding alarm for degraded state
Resources:
EnvHealthAlarm:
Type: "AWS::CloudWatch::Alarm"
Properties:
AlarmDescription: "A CloudWatch Alarm that triggers when an Elastic Beanstalk Environment is unhealthy."
Namespace: "AWS/ElasticBeanstalk"
MetricName: "EnvironmentHealth"
Dimensions:
- Name: EnvironmentName
Value: { "Ref" : "AWSEBEnvironmentName" }
Statistic: "Average"
Period: "300"
EvaluationPeriods: "2"
Threshold: "19" # a value between 15 and 20. 15 is warning, 20 is degraded
ComparisonOperator: "GreaterThanOrEqualToThreshold"
AlarmActions:
- "arn:aws:sns:us-east-1:310849459438:Production-Alerts"
OKActions:
- "arn:aws:sns:us-east-1:310849459438:Production-Alerts"
TreatMissingData: "notBreaching"
42 changes: 42 additions & 0 deletions .ebextensions/scoutgametelegram/07_http-to-https.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# source: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-httpredirect.html

###################################################################################################
#### Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
####
#### Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
#### except in compliance with the License. A copy of the License is located at
####
#### http://aws.amazon.com/apache2.0/
####
#### or in the "license" file accompanying this file. This file is distributed on an "AS IS"
#### BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#### License for the specific language governing permissions and limitations under the License.
###################################################################################################

###################################################################################################
#### This configuration file modifies the default port 80 listener attached to an Application Load Balancer
#### to automatically redirect incoming connections on HTTP to HTTPS.
#### This will not work with an environment using the load balancer type Classic or Network.
#### A prerequisite is that the 443 listener has already been created.
#### Please use the below link for more information about creating an Application Load Balancer on
#### the Elastic Beanstalk console.
#### https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-alb.html#environments-cfg-alb-console
###################################################################################################

Resources:
AWSEBV2LoadBalancerListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
LoadBalancerArn:
Ref: AWSEBV2LoadBalancer
Port: 80
Protocol: HTTP
DefaultActions:
- Type: redirect
RedirectConfig:
Host: "#{host}"
Path: "/#{path}"
Port: "443"
Protocol: "HTTPS"
Query: "#{query}"
StatusCode: "HTTP_301"
33 changes: 33 additions & 0 deletions .ebstalk.apps.env/scoutgametelegram.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Format of this file is <env_var>=<value> key/value pair
DOMAIN="https://telegram.scoutgame.xyz"
REACT_APP_APP_ENV="production"
DATABASE_URL="{{pull:secretsmanager:/io.cv.app/prd/db:SecretString:database_url}}"
AUTH_COOKIE="sg-session"
AUTH_SECRET="{{pull:secretsmanager:/io.cv.app/prd/auth_secret:SecretString:auth_secret}}"
ALCHEMY_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/alchemy:SecretString:scout_game_private_key}}"
REACT_APP_ALCHEMY_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/alchemy:SecretString:scout_game_public_key}}"
NEYNAR_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/neynar:SecretString:neynar_api_key}}"
DD_API_KEY="{{pull:secretsmanager:/io.cv.app/shared/datadog:SecretString:dd_api_key}}"
DD_AGENT_HOST="datadog-agent"
DD_RUNTIME_METRICS_ENABLED=true
REACT_APP_DD_CLIENT_TOKEN="{{pull:secretsmanager:/io.cv.app/shared/datadog:SecretString:dd_client_token}}"
REACT_APP_WALLETCONNECT_PROJECTID="{{pull:secretsmanager:/io.cv.app/prd/wallet-connect:SecretString:wallet_connect_project_id}}"
S3_UPLOAD_BUCKET="{{pull:secretsmanager:/io.cv.app/prd/aws/s3:SecretString:bucket}}"
S3_UPLOAD_REGION="{{pull:secretsmanager:/io.cv.app/prd/aws/s3:SecretString:region}}"
S3_UPLOAD_SECRET="{{pull:secretsmanager:/io.cv.app/prd/aws/s3:SecretString:access_key_secret}}"
S3_UPLOAD_KEY="{{pull:secretsmanager:/io.cv.app/prd/aws/s3:SecretString:access_key}}"
MIXPANEL_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/mixpanel:SecretString:scoutgame_api_key}}"
REACT_APP_IFRAMELY_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/public_iframely_hashed_api_key:SecretString:public_iframely_hashed_api_key}}"
REACT_APP_DECENT_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/decent:SecretString:decent_api_key}}"
REACT_APP_GITHUB_CLIENT_ID="{{pull:secretsmanager:/io.cv.app/prd/github:SecretString:scoutgame_oauth_client_id}}"
GITHUB_CLIENT_SECRET="{{pull:secretsmanager:/io.cv.app/prd/github:SecretString:waitlist_oauth_client_secret}}"
GITHUB_ACCESS_TOKEN="{{pull:secretsmanager:/io.cv.app/prd/github:SecretString:scoutgame_github_access_token}}"
BUILDER_SMART_CONTRACT_MINTER_PRIVKEY="{{pull:secretsmanager:/io.cv.app/prd/buildernft:SecretString:builder_smart_contract_minter_privkey}}"

NEYNAR_SIGNER_ID="{{pull:secretsmanager:/io.cv.app/prd/neynar:SecretString:neynar_signer_id}}"
NEYNAR_SIGNER_PUBLIC_KEY="{{pull:secretsmanager:/io.cv.app/prd/neynar:SecretString:neynar_signer_public_key}}"

SCOUTGAME_S3_BUCKET="scoutgame.public"
NFT_ARTWORK_S3_PATH="prd"
REACT_APP_BUILDER_NFT_CONTRACT_ADDRESS="{{pull:secretsmanager:/io.cv.app/prd/buildernft:SecretString:builder_smart_contract_address}}"
TELEGRAM_BOT_TOKEN="{{pull:secretsmanager:/io.cv.app/prd/sgtelegram:SecretString:telegram_bot_token}}"
Loading

0 comments on commit eaee5d8

Please sign in to comment.