Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

KingYoSun/atproto-aws

Repository files navigation

About

Terraform for bluesky-social/atproto in aws


Requirements

  • AWS cli and SSO login
  • A domain registered
  • Moving out of the AWS SES sandbox
  • Create DID in PLC server (detailed at tips)
Name Version
aws ~> 4.0

Recommend

  • Setup AWS Organization and SSO login

Providers

Name Version
aws 4.58.0
aws.virginia 4.58.0
template 2.2.0

Modules

No modules.


Usage

  1. Fork this repo.
  2. Exec cp terraform.tfvars.example terraform.tfvars
  3. Input values of terraform.tfvars
  4. Exec terraform plan, if no problem, Exec terraform apply

Inputs

Name Description Type Default Required
admin_password 管理者パスワード string n/a yes
atproto_pds_container_repo_url PDS のコンテナの URL string "docker.io/kingyosun/atproto" no
atproto_pds_container_tag PDS のコンテナのタグ string "latest" no
available_user_domains ,区切りで複数定義できる, ユーザーが利用可能なドメイン string ".test,.dev.bsky.dev" no
aws_account_id AWS アカウント ID string n/a yes
aws_region aws region string "ap-northeast-1" no
aws_sso_role AWS の SSO Admin ロール string n/a yes
database_name DB 名 string "atproto_pds" no
database_password DB の PASSWORD string "chinpokopon" no
database_username DB の USERNAME string "admin" no
did_plc_server_url PLC サーバーの URL string "https://plc.directory" no
ecs_log_retention_in_days ECS のログ保持日数 number 90 no
host_domain PDS のドメイン string "localhost" no
invite_required 招待コードが必要な場合 true string "true" no
user_invite_interval 招待コードの発行間隔 number 604800000 no
jwt_secret n/a string n/a yes
kms_recovery_key_alias KMS の recovery_key の alias string "alias/atproto/pds/recovery_key" no
kms_signing_key_alias KMS の signing_key の alias string "alias/atproto/pds/signing_key" no
log_level pino の Log Level string "info" no
pds_version PDS コンテナの version string "0.0.0" no
repo_signing_key repository signing key(raw) string n/a yes
s3_bucket_name S3 のバケット名 string "atproto-pds" no
server_did 鯖缶 Did? 事前に plc サーバーで作成する string n/a yes
ses_smtp_key_id SMTP サーバーの Access Key string n/a yes
ses_smtp_password_v4 SMTP サーバーの Password v4 string n/a yes
ssm_parameter_store_base SSM パラメータの基準となるパス string "/atproto/pds" no
hive_api_key Key of HiveLabeler string n/a yes
labeler_did did of HiveLabeler string n/a yes
moderator_password password of moderator string n/a yes

Outputs

Name Description
aws_iam_access_key_smtp n/a
aws_iam_secret_smtp n/a
aws_iam_smtp_password_v4 n/a

Tips

create repo_signging_key

$ openssl ecparam -genkey -name secp256k1 -out repo_signing_key.pem
$ openssl ec -in repo_signing_key.pem -text -noout

Create DID in https://plc.directory

My MEMO in 日本語

_ I need more efficient method! _

  1. Fork bluesky-social/atproto
  2. Add below code below const keypair = await crypto.EcdsaKeypair.create() of /packages/dev-env/src/index.ts. Filling ADMIN_USER_NAME and DOMAIN. (need import * as cbor from '@ipld/dag-cbor' and import * as uint8arrays from 'uint8arrays')
 const keyDid = keypair.did()
 console.log(`signingKey: ${keyDid}`)
 console.log(`recoveryKey: ${keyDid}`)
 const obj = {
   type: 'create',
   signingKey: keyDid,
   recoveryKey: keyDid,
   handle: '${ADMIN_USER_NAME}.${DOMAIN}',
   service: 'https://${DOMAIN}',
   prev: null,
 }
 const data = new Uint8Array(cbor.encode(obj))
 console.log(
   `sig: ${uint8arrays.toString(await keypair.sign(data), 'base64url')}`,
 )
  1. Exec make build and make run-dev-env, you can see signingKey, recoveryKey, sig
  2. Exec curl -X POST -H "Content-Type: application/json" -d '{"type":"create","signingKey":"${signingKey}","recoveryKey":"${recoveryKey}","handle":"${handle}","service":"${domain}","prev":null,"sig":"${sig}"} https://plc.directory/did:plc:${random_string}
  3. Then, you will get message Hash of genesis operation does not match DID identifier: did:plc:${DID_HASH}
  4. Assign DID_HASH to ramdom_string of 4. , and redone.
  5. Complete creating DID of did:plc:${DID_HASH} in https://plc.directory

Resources

Name Type
aws_acm_certificate.atproto_pds resource
aws_acm_certificate.atproto_pds_cloudfront resource
aws_acm_certificate_validation.atproto_pds resource
aws_acm_certificate_validation.atproto_pds_a resource
aws_cloudfront_distribution.atproto_pds resource
aws_cloudwatch_log_group.atproto_pds resource
aws_db_subnet_group.atproto_pds resource
aws_ecs_cluster.atproto_pds resource
aws_ecs_cluster_capacity_providers.atproto_pds resource
aws_ecs_service.atproto_pds resource
aws_ecs_task_definition.atproto_pds resource
aws_iam_access_key.atproto_pds_ses_smtp_key resource
aws_iam_role.atproto_pds_fargate-task resource
aws_iam_role.atproto_pds_fargate-task-execution resource
aws_iam_role_policy.atproto_pds_fargate-task resource
aws_iam_role_policy.atproto_pds_fargate-task-execution resource
aws_iam_role_policy_attachment.atproto_pds_AmazonECSTaskExecutionRolePolicy resource
aws_iam_role_policy_attachment.atproto_pds_AmazonSSMReadOnlyAccess resource
aws_iam_user.atproto_pds_ses_smtp resource
aws_iam_user_policy.atproto_pds_ses_smtp_user resource
aws_internet_gateway.atproto_pds resource
aws_kms_alias.atproto_pds_recovery_key resource
aws_kms_alias.atproto_pds_signing_key resource
aws_kms_key.atproto_pds_recovery_key resource
aws_kms_key.atproto_pds_signing_key resource
aws_lb.atproto_pds resource
aws_lb_listener.atproto_pds_http resource
aws_lb_listener.atproto_pds_https resource
aws_lb_listener_rule.atproto_pds resource
aws_lb_target_group.atproto_pds resource
aws_rds_cluster.atproto_pds resource
aws_rds_cluster_instance.atproto_pds resource
aws_rds_cluster_parameter_group.atproto_pds resource
aws_route53_record.atproto_pds_a resource
aws_route53_record.atproto_pds_cert_validation resource
aws_route53_record.atproto_pds_cloudfront_cert_validation resource
aws_route53_record.atproto_pds_cname_dkim resource
aws_route53_record.atproto_pds_mx_mail resource
aws_route53_record.atproto_pds_txt resource
aws_route53_record.atproto_pds_txt_dmarc resource
aws_route53_record.atproto_pds_txt_mail resource
aws_route53_zone.atproto_pds resource
aws_route_table.atproto_pds_public resource
aws_route_table_association.atproto_pds_public_a resource
aws_route_table_association.atproto_pds_public_c resource
aws_route_table_association.atproto_pds_public_d resource
aws_s3_bucket.atproto_pds resource
aws_s3_bucket.atproto_pds_alb_log resource
aws_s3_bucket_acl.atproto_pds resource
aws_s3_bucket_lifecycle_configuration.atproto_pds_alb_log resource
aws_s3_bucket_policy.atproto_pds_alb_log resource
aws_s3_bucket_public_access_block.atproto_pds resource
aws_s3_bucket_versioning.static resource
aws_security_group.atproto_pds_alb resource
aws_security_group.atproto_pds_app resource
aws_security_group.atproto_pds_db resource
aws_security_group_rule.atproto_pds_app_from_alb resource
aws_security_group_rule.atproto_pds_app_from_any resource
aws_security_group_rule.atproto_pds_app_from_self resource
aws_security_group_rule.atproto_pds_db_from_app resource
aws_ses_domain_dkim.atproto_pds resource
aws_ses_domain_identity.atproto_pds resource
aws_ses_domain_mail_from.atproto_pds resource
aws_ssm_parameter.atproto_pds_admin_password resource
aws_ssm_parameter.atproto_pds_database_name resource
aws_ssm_parameter.atproto_pds_database_password resource
aws_ssm_parameter.atproto_pds_database_url resource
aws_ssm_parameter.atproto_pds_database_username resource
aws_ssm_parameter.atproto_pds_jwt_secret resource
aws_subnet.atproto_pds_private_a resource
aws_subnet.atproto_pds_private_c resource
aws_subnet.atproto_pds_private_d resource
aws_subnet.atproto_pds_public_a resource
aws_subnet.atproto_pds_public_c resource
aws_subnet.atproto_pds_public_d resource
aws_vpc.atproto_pds resource
aws_iam_policy_document.atproto_pds_alb_log data source
template_file.atproto_pds_container_definitions data source
template_file.atproto_pds_fargate-task data source
template_file.atproto_pds_fargate-task-execution data source
template_file.atproto_pds_kms_key_policy data source

About

terraform for atproto in aws

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages