Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

local fusionauth (#1436)

Will Hutchinson1a92056ba0dc
diff --git a/.env-local.enc b/.env-local.enc
index d0176ec7e5..3e99643618 100644
--- a/.env-local.enc
+++ b/.env-local.enc
@@ -1,10 +1,9 @@
ANTHROPIC_API_KEY=ENC[AES256_GCM,data:dUkWfVSG3j8WWd3q2qcpVZPPbUXh/xz2Fs7amGLUEpIXmhcAMslgguODSao/aRELcbqCK4FDQeXz0MSMvZJ716JNe3sJoDB/ll3pPBEAfkVoSUF8tZsiX2NU/CNthL1UNw3qlLMm6VJ4jVtS4UQ=,iv:AXD6HqskNdthco4xI57TwJmVj/pxlTmGbhD7Py1JWYs=,tag:+ivW/pSMG0S5xIilR+1nmg==,type:str]
APPLE_BUNDLE_ID=ENC[AES256_GCM,data:Er+vj5c5kr0pKG9FP1fRAdFkNh8=,iv:K5qF4pdHVlhsV+9oYTLMBjH29tSIKh6HLtsrNs3mhpU=,tag:ZXbUCNSuZ7eSga/KbI7KKw==,type:str]
ATTACHMENT_BUCKET=ENC[AES256_GCM,data:wxJ2a31CpoKfhybQkD0kgJFzuzXtLhoPmQ==,iv:5lLkCkFdAyU5QoUMoOlH7cGPxsktOeCJwl42gIhSyFs=,tag:RLGD048ajeRvO9UL9Jisfw==,type:str]
-AUDIENCE=ENC[AES256_GCM,data:kO97hKTAD/Ou7z5P3vb9ZdywsDA/9EJUhQ2IDlMrvTt0NKeiPNY=,iv:h7bGLGOyIg8RGuepXxORgJp1XAweSSJukpPou6PlZDk=,tag:J5pT4ti/5WeOsnPhmC8Kew==,type:str]
AUTHENTICATION_SERVICE_INTERNAL_API_SECRET_KEY=ENC[AES256_GCM,data:vsMb/ks9TQ==,iv:UBfSPDDu+1kaXIruQleGqD9KETykb+BeGn0EeT4g4hA=,tag:LhoN2TUtYug52lD6BaiRVg==,type:str]
AUTHENTICATION_SERVICE_SECRET_KEY=ENC[AES256_GCM,data:bb++eaEjCg==,iv:2ujBXPCAGJpUGmlgJ42C3U6UWoTUeMSqcWGmt1nW424=,tag:0x9Lvz28L81GE3XTV0QR9w==,type:str]
-AUTHENTICATION_SERVICE_URL=ENC[AES256_GCM,data:JC2BZf04f+BF7cFIZr+lOND/xMOlxFeT4wSj6OBAPV/JAzwC,iv:sCDmE2uf4hqSvb75UYtbWsy4CExV5C7XsbKzLD0wdkY=,tag:yfD4CVR9xkfsimsid3IU4g==,type:str]
+AUTHENTICATION_SERVICE_URL=ENC[AES256_GCM,data:PLWRfwB60RbYqe+AiYqDEYhjP7LsR9uYsE5E3glXvzFEE5qn,iv:QwviJyuaQxxKRdzNLMezmdeliLXCM6WrOJmVQQ+o9VE=,tag:+4OG2QHASomt7zcTvz7f9A==,type:str]
AWS_REGION=ENC[AES256_GCM,data:7K4FOEw5BLMxNME=,iv:aEuCeQVbcglDmWtq+CqPs/GrdjCR4S2sk9AwbO8GXVE=,tag:KsJxLV0vzuqUgvT0AsGxbA==,type:str]
BACKFILL_QUEUE=ENC[AES256_GCM,data:hssRWMdB1kH5Vus/H0nkzoTVFD9qhg1FLz7qf/tbIbWaPfWtv/pz6+b9y1ha6ew3wslcXF0GF04=,iv:GcttH86mJtYk3TtBBa3BvV0rg0Sb5li69Ft173Jgyp4=,tag:5L9C+prymP+un6o27T8hoQ==,type:str]
BACKFILL_QUEUE_MAX_MESSAGES=ENC[AES256_GCM,data:AUZs,iv:ST7hFsgaTX7UywBwkXSXy9lGMPHTBSsGMoInKReYFEs=,tag:x18jTFD5ccO8f7XQU2SPsg==,type:str]
@@ -44,12 +43,9 @@ EMAIL_SERVICE_PRESIGNED_URL_TTL_SECS=ENC[AES256_GCM,data:FvHk8Q9G,iv:X3WJTpsRftY
EMAIL_SERVICE_URL=ENC[AES256_GCM,data:2ADOWI62isGR71gIo4zK87xHLN9c2HsN8cIY,iv:5NltZGgTUF2EPATC+hp2SY1jNF+KSGbrUsxHdNbDHLo=,tag:nAOSppUKAxfCR0WiefbgVw==,type:str]
ENVIRONMENT=ENC[AES256_GCM,data:1GRQrKXqNQ==,iv:IyBIc5FUjKYnkIjJXz39XipBeRghoIIw8qyCV+SLbMM=,tag:fQOaW6VVtC+gGRE0yEfIPQ==,type:str]
FRECENCY_TABLE_NAME=ENC[AES256_GCM,data:n/kRIa9cy+osBoN0wmw=,iv:EyNSFazxBpWtld+ED0sTVGptSBLZ85rJm3Vkho4ll7A=,tag:g97s65T1NUS/1hOXEbmaGg==,type:str]
-FUSIONAUTH_API_KEY_SECRET_KEY=ENC[AES256_GCM,data:GEaOAKsPGAKx5V27h+z5/mQuxJTPnvpd3mhReJAs6vuSBA9L5MMDBlLc0VYjktqP4rdvZWJehBjevQ==,iv:RAnXBIiGFNF1TFRPO5Sda8/B02KZwQZtFHc75Qo0AeQ=,tag:E2A63Kq+07UhoDgz8ZZU1Q==,type:str]
-FUSIONAUTH_APPLICATION_ID=ENC[AES256_GCM,data:BMfDDo0VIzl+8juqICGdS+k61PYQDB/napKDwoPULwcv/YSBV8o=,iv:YXDheK8jNfaypOJ14c2Ax+3Qfo/Onci+aKkPnaCehe4=,tag:a17hf4CorpPBrKu09xlKDQ==,type:str]
-FUSIONAUTH_BASE_URL=ENC[AES256_GCM,data:msxAepFJgTfPEH0yt2uwo1ICXP2GRt1Wjkb7u12hNuwJgA==,iv:v/UALwtlA6rdczsN9tylehNhN3ZGBpXVmOfMUqVsA64=,tag:dztz2LXdjJ40ac0KW7PzlQ==,type:str]
-FUSIONAUTH_CLIENT_ID=ENC[AES256_GCM,data:Dgk6USac9avUstWe1AL0AXzicL/nesEAuM5uUCPYyzvYvlC2Ti8=,iv:oyoea6PD5o72RjjIQqpTi6F2/gcRnQgOlB7i/5wjGyQ=,tag:5hoa8sMfkg/uZm6/K5VN2Q==,type:str]
-FUSIONAUTH_CLIENT_SECRET_KEY=ENC[AES256_GCM,data:lTJqnJGr7ogL4MEIc9IfZKV2td5/thuaIFiD+OF7,iv:t+p/aWZwfK6P9E2hdn4u9i/lr217kvAbwZzDSGkgvpg=,tag:HSwjbSt/NhFGaGgJQr+uyQ==,type:str]
-FUSIONAUTH_OAUTH_REDIRECT_URI=ENC[AES256_GCM,data:d/4y1pWa7C3OfVrwaxhie1dH14z0zTAW6A2OoQ1MOTJfujMXj+ekG++7rHxlGenTf13k,iv:G2+SoOobpsgXGQTBGXnuf575VGmg7b4upRudbUOfSi0=,tag:Wjv1E84KhUPHki4AYJJDQw==,type:str]
+FUSIONAUTH_BASE_URL=ENC[AES256_GCM,data:HfOKqok2y/VfTln1zJ7Bi2xR1RK1aNoi,iv:zjO702Ae3x2PjdP30eP/WDtj4g8KNUqEGnM1x6jLTZU=,tag:qMpWrx5ODRHpvXF7Akjk6Q==,type:str]
+FUSIONAUTH_API_KEY_SECRET_KEY=ENC[AES256_GCM,data:SRhm4SufF6K8e9P9fEpNYapU0I3acyivmGFkmimK5bLY8w/0gFM=,iv:Tz44tpCwPFK5xuSnDvQ/5NH3I2SANp2qCDVUcOqH5as=,tag:bkzNRy+PnB8pkbvoB7HNbg==,type:str]
+FUSIONAUTH_OAUTH_REDIRECT_URI=ENC[AES256_GCM,data:4fmNWQFlOLWOB9Lw0UbeMcx+m6H3XzB7E7w0X/2LfgYhu/AYW7s=,iv:QtOebOg4R1A2b2DTMSgGuBUtzhfwfZjDOW1JAIBY+s4=,tag:oipmncqa0kxsoRQ+XFb6LA==,type:str]
GITHUB_PACKAGES_TOKEN=ENC[AES256_GCM,data:aZ+cpfLXqe1DSX4TBSySOAM6GgRLaN1331VNBaC9EX5ZxvMMjXOhrchE,iv:Mk1AoDLIyIlYBjzBHwpFV4OB4ZGISl1oa7OLFn1fyxQ=,tag:TVsraf2gBhDGijyQbrjNdw==,type:str]
GCP_SERVICE_ACCOUNT=ENC[AES256_GCM,data:KRaNAvgpKxbMuI0JGz1360rBUSy9c/7j48wXUd6TAmMmPB/CyLt88Rhev43QmrphiboGbx6aNegQHIYiqG8lkPSFuMUN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FNVbID5pQ,iv:8qaKnRINU5oHYtt0DqETi01EZ/HBOExEjU2UXHPTOnM=,tag:fzslhxJ34TXtFzwKNveQ0g==,type:str]
@@ -59,8 +55,8 @@ GOOGLE_CLIENT_ID=ENC[AES256_GCM,data:BbAmZ3JGmNRLMc4dTX/nl5pqllFW2GuAHOCZMGtapzd
GOOGLE_CLIENT_SECRET_KEY=ENC[AES256_GCM,data:6Cwt7/KkHUHK59JEQhT6YMY7/k6Si8SaokE=,iv:DdZsJ+9vOWpcShFFcwBPHglaB2XVc0VDmsoBoy4Ey6E=,tag:HgyLl6je2Cx2hy8yK9nr+g==,type:str]
INTERNAL_API_SECRET_KEY=ENC[AES256_GCM,data:nqAud57MKg==,iv:LP4BkZ2SepOxOW2zfylWf/Bak2OpTasDwOnqN6PDXVg=,tag:2tM1nd6V4liMI+EKX/qGTw==,type:str]
INVITE_EMAIL=ENC[AES256_GCM,data:2SRIMNhjDBMhiGQ78Qe8OUjMvvLPvjQn,iv:KtHMgJECE0+btRa4XIj6GgyhlYwGl7F1UVv/krWFfBo=,tag:mI4tpWnJTfDaoqe3u/fCIg==,type:str]
-ISSUER=ENC[AES256_GCM,data:0wR3EeQgfjfylW6/aqTlaxVPWL4zSY7RzgQ=,iv:gq3H57SWKKt5W8CmlsP5avUmyb+2wOb3KkIPSH7iWs8=,tag:QocZwJLTnSQgqwXO199Osw==,type:str]
-JWT_SECRET_KEY=ENC[AES256_GCM,data:fFhfjdV0yrsx1igMuWbBcdbQTq8A0A7MEGNX7FrXv0N7lErUou8M37/Tki2bSg==,iv:DDEmzFcXrMDLm4aelRAqTUCqsRL3jQRD/MXB/XiBOfE=,tag:vtIkoPcGO7kBhWNTN6G0ww==,type:str]
+ISSUER=ENC[AES256_GCM,data:6zNCHtMrOsjen8YMYtIaTm8=,iv:u/2ahPO0UFpuKyhZAbOOCdNksmrnHHWS87uIDDK9y4E=,tag:yOqbp/fyFETh9rzPchFcNw==,type:str]
+JWT_SECRET_KEY=ENC[AES256_GCM,data:sqr/S4EMU0Wln1/bsfsob9SfFWsDSA/NO8eokbKeRXHmufkohOTcvbgRhtdog2DuUG68wrM7cjst,iv:er2EjbD++z5LchY1ayJBoYMdxb3hEm6ZmeTXXaNogOA=,tag:IQmyXJNaYgZqPcuTlHfmow==,type:str]
LEXICAL_SERVICE_URL=ENC[AES256_GCM,data:ZmEZM/feRigcXARbGKEfp5Jk9Ex8t6hZUPsJlHk=,iv:S1nZ9YTn80Jbgp8MvOnf0Kum8/RMvfb53j8qeibGUm8=,tag:L4fKNfBvNz1Bw5MuX8vtIw==,type:str]
LINK_MANAGER_QUEUE=ENC[AES256_GCM,data:kdySe2t37JpYuHEiXtcYzRqf7H27yGKjJASbo09VNanv1ScZXWYy9keOdx6kMzzQ67JvJEe3nr5dgSK3gTsqEQ8=,iv:92USFk/X2KRbgHhF9a1KFLBdC9Gh1nwl/KqwFHSL0r4=,tag:gexR5VzLF1h0hGDs/e8caw==,type:str]
LOK_PATH=ENC[AES256_GCM,data:hnWmPHidrPfN3FG1Zgi9303mH6YJ8Ufq+T8=,iv:U1F74y0ITgEk7VGNVDFwp+tMONpRKrU2dD+DdLjz6Qg=,tag:dvqqCKi+DOiRSYRznevucg==,type:str]
@@ -122,7 +118,7 @@ sops_kms__list_1__map_arn=arn:aws:kms:us-west-1:569036502058:key/mrk-cab29bf9480
sops_kms__list_1__map_aws_profile=
sops_kms__list_1__map_created_at=2026-02-03T14:47:22Z
sops_kms__list_1__map_enc=AQICAHjuYcSMsjB0lKJtZ3DIAvxF8N3RNRn5KZaAN74Et6122wGvSsy0EhK25Hy2hdoR6HqoAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMHViQzKBwIGY72CWCAgEQgDtKthF4DIo1QiM2scSmXVBT624sUjTxO+jwAUipQ5Xc50oLOUa/tbaIiwNN1wE5AI48o8NPmyh2OoAeZw==
-sops_lastmodified=2026-02-03T19:59:56Z
-sops_mac=ENC[AES256_GCM,data:kdLOcGqUD6sYBjXBmDvMu8tsFRlgRA+IRm9CZz0Qs/+HTZLcCiXSyU4leKfst6o9tuyQRkJzdsEws8zlHK+6IgBWg0SwCkZZuLmKiJbm/H3jBgia4VDDrnyKq2YoFqyXzWwudmlG4gKq6mxhWt9Oeqkqf4EcBTTkn1nM5XZ2O5E=,iv:J0g42+zNip1j4G4z7dSBNeQ25hLvfUEqt2lrn94fSRo=,tag:ILN1SUlXTxi1bhKVmYuvbA==,type:str]
+sops_lastmodified=2026-02-06T18:22:00Z
+sops_mac=ENC[AES256_GCM,data:THly2J4vhgIrS9CLvA5QYh3qjzIAHzTMpNMOFQjhpPcB14bdRXvVuU4OHciruSTN4VYDMm+ky1bP+Uk09fPv7fyjF2ws9gXNTTqo97utuZJxcdKprYF74SkW0TBZvbMXqj/pb2crjgJ8cGQnmyOJSzw2wHZAhO8B/MOmek+5qx8=,iv:P6VZ+JkUZTC4d+bSpJVsRvgK3mT7ugDzSjTOEb68sDs=,tag:GNg491BpjtE1ImU+3KroLQ==,type:str]
sops_unencrypted_suffix=_unencrypted
sops_version=3.11.0
diff --git a/.env-localdev.enc b/.env-localdev.enc
index d87704836d..0c12d6bc0e 100644
--- a/.env-localdev.enc
+++ b/.env-localdev.enc
@@ -50,6 +50,7 @@ EMAIL_SERVICE_URL=ENC[AES256_GCM,data:/vIDe9qDVu4J4573e3/3hjYt2y7mq9dBTGQV,iv:8J
ENVIRONMENT=ENC[AES256_GCM,data:LDi57GYMEg==,iv:H8UJxB8k9cztvoUF6U10D0er2tM+ES45gngVN8uTIx4=,tag:r+r/s1GaW3KekOOqk5HQKg==,type:str]
FRECENCY_TABLE_NAME=ENC[AES256_GCM,data:TyHA84CiO9OswLgL0Xw=,iv:fmKBjYzmJL9mnSrJ2yUUhD2OzqGBqpKe2XnQePLcIR4=,tag:Zisf5gAaRASjQJKx+SEJIA==,type:str]
FUSIONAUTH_API_KEY_SECRET_KEY=ENC[AES256_GCM,data:QQ1aCX/xPClyjxmdB/ERt3AZuG9vPTk66xnU+/kDicyj7IdAG3WPtniQJMGGvbGIVasyDY2sRZdFFA==,iv:fuAaRLjSK7zWAjJE6SqWIdEppNlvCYdwcY30ubiaVCI=,tag:22IupxCezZbEiUw7begl5A==,type:str]
+FUSIONAUTH_TENANT_ID=ENC[AES256_GCM,data:JWPDfkNykNail7aB4MrgmwWa1WdW6tV9MnoyQX/+wwSvW2edkdY=,iv:qP+khm20jWNvw95ODuZU3ohYWhwJRzYp9m7Vi3k9CUw=,tag:LeBcxN9NE5C0+bfM6VNfMA==,type:str]
FUSIONAUTH_APPLICATION_ID=ENC[AES256_GCM,data:MCF+KSzGzWkb4vf5iKDOZrFD+iYdTUwjwfOAztax7IHVFBOKD+Q=,iv:MFMCiUjbiXasuJ5ZePuThEkX6Nqs5j2E1ByUdQdGzps=,tag:UDlxEH4xT9nkF9mLmh1VNQ==,type:str]
FUSIONAUTH_BASE_URL=ENC[AES256_GCM,data:aM33jXYaTQUx7+S82Y8/jGjCZbz9G24QTIk/WKnZLCe1QQ==,iv:8V0K80Ib6HzAC83nUpdCvphMdQesF3PoZT2v3VJdawQ=,tag:/zxEQp5Rh38JpclzKfsmuw==,type:str]
FUSIONAUTH_CLIENT_ID=ENC[AES256_GCM,data:XHc34Yg560RyJe7DO9kqsDXeK3X+4f4zQIypk6vj5DBIElSXovk=,iv:pqbtycYdlMqHAWsW0IT43xcGINStabeAqi1niLYfzrE=,tag:vvXe59xt7cM1BRK8ho47PQ==,type:str]
@@ -126,7 +127,7 @@ sops_kms__list_1__map_arn=arn:aws:kms:us-west-1:569036502058:key/mrk-cab29bf9480
sops_kms__list_1__map_aws_profile=
sops_kms__list_1__map_created_at=2026-02-03T14:46:45Z
sops_kms__list_1__map_enc=AQICAHjuYcSMsjB0lKJtZ3DIAvxF8N3RNRn5KZaAN74Et6122wEgw9B5bWVjFVnU2kvvYrAsAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMjqkFO5E+NmhMEFLfAgEQgDtgSVqvR4m1awQFs/oq8iNeI/6jS3IXs7bQiUUTyQySXE6/kjPJLdYITJlXCzu7t/eXd4nMFCLcDMwYqg==
-sops_lastmodified=2026-02-04T21:31:24Z
-sops_mac=ENC[AES256_GCM,data:mRK8H1S/HDOZQoZl1pu6OEoH6c2XSkUB1+13Rrc8Nb8VRNxl5Ej3jxOHxLbiZemZPV4458Khgt3xLK+Uyem11DoGFrG+0i3ry0b7YceSvgb+b2Bl+AeQGrD/nyV1xrHOr+Qw0comx+ilwI37Mnxbn2zilrDelonYqiFj1XZvsTw=,iv:yH9e1KZjCsWCxW1U9+E+ev7Rm9hPj9maiOlzAy5S1Mg=,tag:U/33o8Zr10zMVaxf6Lklgw==,type:str]
+sops_lastmodified=2026-02-06T18:37:31Z
+sops_mac=ENC[AES256_GCM,data:oUf6cUQNnFqhPfzwwR+5sBIPl873VnKLa1fi78h6eBTkQm7JFjqjl1ZpeXd6AvHkYfCfuOPWqzUS39Xnijv1op0cibX4qFQoJ3HVh4Qgixx7vrC+eVK+8gUyoBjdKyGxjACoi96ma0lDlyAbRlZVssFJbwlNXtB4Kg09mLhhCLo=,iv:ddrbMWELwJHiP13Rt/qjv53mx8q8oXXka+XKnB5KJfk=,tag:Y8iZCRZBdNt4cS6Wmq7QSg==,type:str]
sops_unencrypted_suffix=_unencrypted
sops_version=3.11.0
diff --git a/RUNNING_LOCALLY.md b/RUNNING_LOCALLY.md
index 24ad272461..905de38522 100644
--- a/RUNNING_LOCALLY.md
+++ b/RUNNING_LOCALLY.md
@@ -17,6 +17,7 @@ run:
```bash
just run_dbs
just init_local_dbs
+just infra/stacks/fusionauth-instance/setup
```
- Export the **SOPS_KMS_ARN** (you can skip if you use nix-shell)
diff --git a/docker-compose.yml b/docker-compose.yml
index dcee5c654d..9468cafa26 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -9,10 +9,10 @@ x-common-env: &common-env
services:
# ============================================================================
- # authentication_service (Port 8080)
+ # authentication-service (Port 8080)
# Primary auth service - depends on FusionAuth, Redis, MacroDB
# ============================================================================
- authentication_service:
+ authentication-service:
<<: *common-env
build:
context: ./rust/cloud-storage
@@ -145,7 +145,7 @@ services:
depends_on:
- redis
- connection_gateway
- - authentication_service
+ - authentication-service
networks:
- databases
- services
@@ -169,7 +169,7 @@ services:
ports:
- "8087:8080"
depends_on:
- - authentication_service
+ - authentication-service
- document_storage_service
- connection_gateway
- static_file_service
@@ -199,7 +199,7 @@ services:
depends_on:
- redis
- document_cognition_service
- - authentication_service
+ - authentication-service
- connection_gateway
- document_storage_service
networks:
diff --git a/infra/stacks/authentication-service/Pulumi.dev.yaml b/infra/stacks/authentication-service/Pulumi.dev.yaml
index 0cc52586a0..f30add0e75 100644
--- a/infra/stacks/authentication-service/Pulumi.dev.yaml
+++ b/infra/stacks/authentication-service/Pulumi.dev.yaml
@@ -17,3 +17,4 @@ config:
authentication-service:macro_api_token_expiry_seconds: 3600
authentication-service:stripe_webhook_secret_key: stripe-webhook-secret-dev
authentication-service:stripe_price_id: stripe-price-id-dev
+ authentication-service:fusionauth_tenant_id: 5e13f524-8d32-0454-81f8-061936256aa4
diff --git a/infra/stacks/authentication-service/Pulumi.prod.yaml b/infra/stacks/authentication-service/Pulumi.prod.yaml
index ef2ba24c59..f9c8348989 100644
--- a/infra/stacks/authentication-service/Pulumi.prod.yaml
+++ b/infra/stacks/authentication-service/Pulumi.prod.yaml
@@ -17,3 +17,4 @@ config:
authentication-service:macro_api_token_expiry_seconds: 3600
authentication-service:stripe_webhook_secret_key: stripe-webhook-secret-prod
authentication-service:stripe_price_id: stripe-price-id-prod
+ authentication-service:fusionauth_tenant_id: a3e53c3d-8d6a-3e92-d64c-fa3bf30a60be
diff --git a/infra/stacks/authentication-service/index.ts b/infra/stacks/authentication-service/index.ts
index d275ebf40a..c8c33ec365 100644
--- a/infra/stacks/authentication-service/index.ts
+++ b/infra/stacks/authentication-service/index.ts
@@ -47,6 +47,8 @@ const FUSIONAUTH_CLIENT_SECRET_KEY = config.require(
const STRIPE_SECRET_KEY = config.require(`stripe_secret_key`);
const fusionauthClientIdSecretKey = config.require(`fusionauth_client_id`);
+const FUSIONAUTH_TENANT_ID = config.require('fusionauth_tenant_id');
+
const FUSIONAUTH_CLIENT_ID = aws.secretsmanager
.getSecretVersionOutput({
secretId: fusionauthClientIdSecretKey,
@@ -194,6 +196,10 @@ const service = new AuthenticationService('authentication-service', {
name: 'FUSIONAUTH_APPLICATION_ID',
value: pulumi.interpolate`${FUSIONAUTH_CLIENT_ID}`,
},
+ {
+ name: 'FUSIONAUTH_TENANT_ID',
+ value: FUSIONAUTH_TENANT_ID,
+ },
{ name: 'ISSUER', value: pulumi.interpolate`${FUSIONAUTH_ISSUER}` },
{
name: 'JWT_SECRET_KEY',
diff --git a/infra/stacks/fusionauth-instance/.gitignore b/infra/stacks/fusionauth-instance/.gitignore
index 7e0ecd70a2..9549e0e0f6 100644
--- a/infra/stacks/fusionauth-instance/.gitignore
+++ b/infra/stacks/fusionauth-instance/.gitignore
@@ -1 +1,2 @@
!templates/*.js
+Pulumi.local.yaml.bak
diff --git a/infra/stacks/fusionauth-instance/Pulumi.local.yaml b/infra/stacks/fusionauth-instance/Pulumi.local.yaml
index d295e25a8e..f271945b93 100644
--- a/infra/stacks/fusionauth-instance/Pulumi.local.yaml
+++ b/infra/stacks/fusionauth-instance/Pulumi.local.yaml
@@ -1,10 +1,11 @@
config:
aws-native:region: us-east-1
aws:region: us-east-1
- fusionauth-instance:authentication-service-domain: http://localhost:8084
+ fusionauth-instance:authentication-service-domain: http://authentication-service:8080
fusionauth-instance:fusionauth-license-key-secret-key: fusionauth-license-key-dev
fusionauth-instance:smtp-user-secret-key: smtp-user
fusionauth-instance:fusionauth-issuer: local.macro.com
fusionauth-instance:default-from-email: [email protected]
fusionauth:host: http://localhost:9011
+ fusionauth-instance:fusionauth-signing-key-id: d7d09513-a3f5-401c-9685-34ab6c552453
fusionauth:apiKey: bf69486b-4733-4954-a44e-2e1b5f2c8a91
diff --git a/infra/stacks/fusionauth-instance/README.md b/infra/stacks/fusionauth-instance/README.md
index ab573c1ef3..3295ed9089 100644
--- a/infra/stacks/fusionauth-instance/README.md
+++ b/infra/stacks/fusionauth-instance/README.md
@@ -2,7 +2,7 @@
This pulumi stack contains everything you need to be able to setup a "macro compliant" fusionauth instance.
-Ideal for local development.
+Supports easy setup for local development.
# Prerequisites
@@ -18,15 +18,11 @@ The following are required tools you need to have setup ahead of time:
## Deploy Local Fusionauth Instance
-Download your .env file used to create the local fusionauth stack:
+Make sure you've already created your main **.env** file in the root of the repo via `just get_environment`.
-```bash
-just setup_fusionauth_env
-```
-
-This is used in the docker-compose automatically.
+Run `just setup` to setup the local fusionauth instance and get everything ready to be run.
-Now run `just start_fusionauth` to create the local fusionauth instance. Through the [./kickstart/kickstart.json](kickstart) file, we automatically create an admin user and admin api key to use.
+Important Keys:
```
@@ -34,12 +30,6 @@ password: macroIsGreat!
api-key: bf69486b-4733-4954-a44e-2e1b5f2c8a91
```
-Now you can run the following to get things in sync and ready to start your local dev journey
-
-```bash
-just instantiate_fusionauth
-```
-
# TODO
- [ ] configure idps
- [ ] sync prod with pulumi stack
diff --git a/infra/stacks/fusionauth-instance/constants.ts b/infra/stacks/fusionauth-instance/constants.ts
index a349713d74..10e22d8dd1 100644
--- a/infra/stacks/fusionauth-instance/constants.ts
+++ b/infra/stacks/fusionauth-instance/constants.ts
@@ -17,8 +17,9 @@ export const FUSIONAUTH_ISSUER = config.require('fusionauth-issuer');
export const FUSIONAUTH_APPLICATION_CLIENT_ID =
stack === 'local' ? undefined : config.require('fusionauth-client-id');
-export const FUSIONAUTH_SIGNING_KEY_ID =
- stack === 'local' ? undefined : config.require('fusionauth-signing-key-id');
+export const FUSIONAUTH_SIGNING_KEY_ID = config.require(
+ 'fusionauth-signing-key-id'
+);
// The potential pre-defined client secret for the fusionauth application
// This is only predefined for existing infra (dev and prod)
diff --git a/infra/stacks/fusionauth-instance/index.ts b/infra/stacks/fusionauth-instance/index.ts
index 8b82b775ee..fbd73aacf6 100644
--- a/infra/stacks/fusionauth-instance/index.ts
+++ b/infra/stacks/fusionauth-instance/index.ts
@@ -184,6 +184,8 @@ const defaultTenant = new FusionAuthTenant(
{ provider: fusionAuthProvider }
);
+export const defaultTenantId = defaultTenant.tenantId;
+
// Lambda
const populateLambdaBody = pulumi
.output(AUTHENTICATION_SERVICE_INTERNAL_SECRET)
@@ -219,6 +221,8 @@ const signingKey = new FusionAuthKey(
{ provider: fusionAuthProvider }
);
+export const signingKeyId = signingKey.keyId;
+
const macroApplication = new FusionAuthApplication(
'macro-application',
{
diff --git a/infra/stacks/fusionauth-instance/justfile b/infra/stacks/fusionauth-instance/justfile
index 05ee03d00b..0abd949aa9 100644
--- a/infra/stacks/fusionauth-instance/justfile
+++ b/infra/stacks/fusionauth-instance/justfile
@@ -1,29 +1,83 @@
+# Gets the .env variables for the FusionAuth docker-compose.
get_fusionauth_env:
- curl -o .env https://raw.githubusercontent.com/FusionAuth/fusionauth-containers/452efcac5c60f6a3a734947b1a8eefaae6f811fa/docker/fusionauth/.env
+ @echo "Getting fusionauth .env file for docker-compose"
+ curl -o .env https://raw.githubusercontent.com/FusionAuth/fusionauth-containers/452efcac5c60f6a3a734947b1a8eefaae6f811fa/docker/fusionauth/.env
-start_fusionauth:
- docker-compose up
+# Starts up the local FusionAuth instance. This should only be used during setup/testing.
+start *ARGS:
+ @echo "Starting fusionauth"
+ docker-compose up {{ ARGS }}
-destroy_fusionauth:
- docker-compose down -v
+# Stops the local FusionAuth instance. This should only be used for setup/testing.
+stop *ARGS:
+ @echo "Stopping fusionauth"
+ docker-compose stop {{ ARGS }}
-destroy_stack:
+# Destroys the local pulumi stack.
+destroy_local_stack:
cp Pulumi.local.yaml Pulumi.local.yaml.bak
pulumi stack rm local --yes --force
mv Pulumi.local.yaml.bak Pulumi.local.yaml
-setup_fusionauth:
- # Get .env for fusionauth
- just get_fusionauth_env
- @echo "Launching fusionauth"
- docker-compose up -d --wait
+# Destroys the local FusionAuth instance and pulumi stack.
+destroy:
+ just destroy_local_stack || true
+ docker-compose down -v
+
+# Creates the local pulumi stack and updates FusionAuth with components.
+setup_local_stack:
+ @echo "Initializing local stack"
+ pulumi stack init local || true
+ pulumi import --stack local \
+ fusionauth:index/fusionAuthKey:FusionAuthKey jwt-signing-key d7d09513-a3f5-401c-9685-34ab6c552453 \
+ --yes || true # Note: This command appears to fail but actually doesn't
+ @echo "Local stack initialized"
+ pulumi up --stack local --yes
+ @echo "FusionAuth local stack deployed"
+
+# Imports all pre-existing dev FusionAuth assets into pulumi.
+import_dev:
+ pulumi import --stack macro-inc/dev \
+ fusionauth:index/fusionAuthKey:FusionAuthKey jwt-signing-key aea64fc1-84f6-89ab-fb7c-08a21556263e \
+ fusionauth:index/fusionAuthApplication:FusionAuthApplication macro-application eb75fe7a-0ef1-4186-96d9-cc62cfb1d10c \
+ fusionauth:index/fusionAuthTenant:FusionAuthTenant default-tenant 5e13f524-8d32-0454-81f8-061936256aa4 \
+ fusionauth:index/fusionAuthLambda:FusionAuthLambda populate-jwt-lambda a7f3e8d2-4b91-4c5a-9e6f-1a2b3c4d5e6f
+
+# Performs a healthcheck on local FusionAuth.
+healthcheck:
@echo "Waiting for FusionAuth to be healthy..."
@until curl -s http://localhost:9011/api/status | grep -q '{"status":"Ok"}'; do \
echo "FusionAuth not ready, waiting..."; \
sleep 3; \
done
- @echo "FusionAuth is healthy, running Pulumi..."
- # Deploy pulumi stack
- pulumi up --stack local --yes
- @echo "FusionAuth setup complete!"
- docker-compose stop
+ @echo "FusionAuth healthy"
+
+# Sets up the local FusionAuth stack.
+setup:
+ just get_fusionauth_env
+ just start -d --wait
+ just healthcheck
+ just setup_local_stack
+ just insert_local_fusionauth_variables
+ just stop
+ @echo "FusionAuth setup complete"
+
+# Inserts local FusionAuth variables into root `.env` file
+insert_local_fusionauth_variables:
+ #!/usr/bin/env bash
+ API_KEY="bf69486b-4733-4954-a44e-2e1b5f2c8a91"
+ APPLICATION_ID=$(pulumi stack output macroApplicationClientId -s local)
+ TENANT_ID=$(pulumi stack output defaultTenantId -s local)
+ CLIENT_SECRET=$(curl -s "http://localhost:9011/api/application/${APPLICATION_ID}" \
+ -H "Authorization: ${API_KEY}" | jq -r '.application.oauthConfiguration.clientSecret')
+
+ ENV_FILE="{{justfile_directory()}}/../../../.env"
+
+ echo "#AUTO-ADDED DO NOT MODIFY" >> "$ENV_FILE"
+ echo "FUSIONAUTH_TENANT_ID=\"${TENANT_ID}\"" >> "$ENV_FILE"
+ echo "AUDIENCE=\"${APPLICATION_ID}\"" >> "$ENV_FILE"
+ echo "FUSIONAUTH_APPLICATION_ID=\"${APPLICATION_ID}\"" >> "$ENV_FILE"
+ echo "FUSIONAUTH_CLIENT_ID=\"${APPLICATION_ID}\"" >> "$ENV_FILE"
+ echo "FUSIONAUTH_CLIENT_SECRET_KEY=\"${CLIENT_SECRET}\"" >> "$ENV_FILE"
+
+ echo "Appended FusionAuth local values to .env"
diff --git a/infra/stacks/fusionauth-instance/kickstart/kickstart.json b/infra/stacks/fusionauth-instance/kickstart/kickstart.json
index e894dfee96..5305ae353a 100644
--- a/infra/stacks/fusionauth-instance/kickstart/kickstart.json
+++ b/infra/stacks/fusionauth-instance/kickstart/kickstart.json
@@ -6,6 +6,19 @@
}
],
"requests": [
+ {
+ "method": "POST",
+ "url": "/api/key/import/d7d09513-a3f5-401c-9685-34ab6c552453",
+ "body": {
+ "key": {
+ "id": "d7d09513-a3f5-401c-9685-34ab6c552453",
+ "algorithm": "HS256",
+ "name": "JWT Signing Key",
+ "secret": "super-secret-jwt-signing-key-for-local-development-only",
+ "type": "HMAC"
+ }
+ }
+ },
{
"method": "POST",
"url": "/api/user/registration",
diff --git a/rust/cloud-storage/authentication_service/src/bin/backfill_null_macro_user_id.rs b/rust/cloud-storage/authentication_service/src/bin/backfill_null_macro_user_id.rs
index a082b605fb..be7414671e 100644
--- a/rust/cloud-storage/authentication_service/src/bin/backfill_null_macro_user_id.rs
+++ b/rust/cloud-storage/authentication_service/src/bin/backfill_null_macro_user_id.rs
@@ -30,6 +30,7 @@ pub async fn main() -> anyhow::Result<()> {
let mut total = 0;
let auth_client = authentication_service::FusionAuthClient::new(
+ std::env::var("FUSIONAUTH_TENANT_ID").context("FUSIONAUTH_TENANT_ID env var not set")?,
std::env::var("FUSIONAUTH_API_KEY").context("FUSIONAUTH_API_KEY env var not set")?,
std::env::var("FUSIONAUTH_CLIENT_ID").context("FUSIONAUTH_CLIENT_ID env var not set")?,
std::env::var("FUSIONAUTH_CLIENT_SECRET")
diff --git a/rust/cloud-storage/authentication_service/src/config.rs b/rust/cloud-storage/authentication_service/src/config.rs
index 832bca3c15..0b3769ecf0 100644
--- a/rust/cloud-storage/authentication_service/src/config.rs
+++ b/rust/cloud-storage/authentication_service/src/config.rs
@@ -21,6 +21,8 @@ pub struct Config {
/// The Redis URI for the Redis this application should use.
pub redis_uri: String,
+ /// FusionAuth Tenant Id
+ pub fusionauth_tenant_id: String,
/// FusionAuth API key secret name
pub fusionauth_api_key_secret_key: String,
/// FusionAuth client id
@@ -74,6 +76,8 @@ impl Config {
let redis_uri = std::env::var("REDIS_URI").context("REDIS_URI must be provided")?;
+ let fusionauth_tenant_id = std::env::var("FUSIONAUTH_TENANT_ID")
+ .context("FUSIONAUTH_TENANT_ID must be provided")?;
let fusionauth_api_key_secret_key = std::env::var("FUSIONAUTH_API_KEY_SECRET_KEY")
.context("FUSIONAUTH_API_KEY_SECRET_KEY must be provided")?;
let fusionauth_client_id = std::env::var("FUSIONAUTH_CLIENT_ID")
@@ -123,6 +127,7 @@ impl Config {
base_url,
database_url,
redis_uri,
+ fusionauth_tenant_id,
fusionauth_api_key_secret_key,
fusionauth_client_id,
fusionauth_client_secret_key,
diff --git a/rust/cloud-storage/authentication_service/src/main.rs b/rust/cloud-storage/authentication_service/src/main.rs
index c90b1f839f..21dda53390 100644
--- a/rust/cloud-storage/authentication_service/src/main.rs
+++ b/rust/cloud-storage/authentication_service/src/main.rs
@@ -127,6 +127,7 @@ async fn main() -> anyhow::Result<()> {
};
let auth_client = service::fusionauth_client::FusionAuthClient::new(
+ config.fusionauth_tenant_id,
fusionauth_api_key,
config.fusionauth_client_id.clone(),
fusionauth_client_secret,
diff --git a/rust/cloud-storage/authentication_service/src/service/fusionauth_client/mod.rs b/rust/cloud-storage/authentication_service/src/service/fusionauth_client/mod.rs
index 80240dd56b..dfd8a5fea8 100644
--- a/rust/cloud-storage/authentication_service/src/service/fusionauth_client/mod.rs
+++ b/rust/cloud-storage/authentication_service/src/service/fusionauth_client/mod.rs
@@ -20,12 +20,27 @@ pub struct AuthedClient {
inner: reqwest::Client,
}
+/// Used to specify what tenant id we want to use
+const FUSIONAUTH_TENANT_ID_HEADER: &str = "X-FusionAuth-TenantId";
+
impl AuthedClient {
- pub fn new(api_key: String) -> Self {
+ pub fn new(url: &str, api_key: String, tenant_id: String) -> Self {
// Create authenticated client with default Authorization header
let mut auth_headers = reqwest::header::HeaderMap::new();
auth_headers.insert(reqwest::header::AUTHORIZATION, api_key.parse().unwrap());
+ // NOTE: we only want to insert this header automatically if we are
+ // using a local fusionauth instance
+ // This is due to the local fusionauth instance containing 2 tenants
+ if is_local_fusionauth(url) {
+ // We need to insert the
+ tracing::trace!(
+ "inserting {} header into fusionauth authed client",
+ FUSIONAUTH_TENANT_ID_HEADER
+ );
+ auth_headers.insert(FUSIONAUTH_TENANT_ID_HEADER, tenant_id.parse().unwrap());
+ }
+
let client = reqwest::Client::builder()
.default_headers(auth_headers)
.build()
@@ -79,6 +94,7 @@ pub struct FusionAuthClient {
impl FusionAuthClient {
#[expect(clippy::too_many_arguments, reason = "too annoying to fix")]
pub fn new(
+ tenant_id: String,
api_key: String,
client_id: String,
client_secret: String,
@@ -88,7 +104,7 @@ impl FusionAuthClient {
google_client_id: String,
google_client_secret: String,
) -> Self {
- let auth_client = AuthedClient::new(api_key);
+ let auth_client = AuthedClient::new(&fusion_auth_base_url, api_key, tenant_id);
let unauth_client = UnauthedClient::new();
Self {
@@ -107,7 +123,7 @@ impl FusionAuthClient {
/// Constructs the oauth2 authorize url for the given idp
/// If login_hint is provided, it will be used as the login_hint parameter. This is used to
/// ensure users are correctly redirected for domain specific SSO
- #[tracing::instrument(skip(self, state), fields(application_id=%self.application_id, fusion_auth_base_url=%self.fusion_auth_base_url))]
+ #[tracing::instrument(skip(self, state), fields(application_id=%self.application_id, fusion_auth_base_url=%self.fusion_auth_base_url), level = tracing::Level::TRACE)]
pub fn construct_oauth2_authorize_url<T>(
&self,
idp_id: &str,
@@ -117,8 +133,11 @@ impl FusionAuthClient {
where
T: serde::Serialize + std::fmt::Debug + 'static,
{
- let mut url = Url::parse(&format!("{}/oauth2/authorize", self.fusion_auth_base_url))
- .expect("Invalid base URL");
+ let mut url = Url::parse(&format!(
+ "{}/oauth2/authorize",
+ transform_fusionauth_url(&self.fusion_auth_base_url)
+ ))
+ .expect("Invalid base URL");
url.query_pairs_mut()
.append_pair("client_id", &self.client_id)
@@ -142,3 +161,33 @@ impl FusionAuthClient {
Ok(url.to_string())
}
}
+
+/// Determines if fusionauth is local based on the url
+#[tracing::instrument(level = tracing::Level::TRACE)]
+fn is_local_fusionauth(url: &str) -> bool {
+ url.starts_with("http://fusionauth:9011") || url.starts_with("http://localhost:9011")
+}
+
+/// Transforms the url replacing the domain with localhost
+#[tracing::instrument(level = tracing::Level::TRACE)]
+fn transform_local_fusionauth_url(url: &str) -> String {
+ if is_local_fusionauth(url) {
+ url.replace("fusionauth", "localhost")
+ } else {
+ url.to_string()
+ }
+}
+
+/// Transforms the fusionauth url from the docker-network version into the
+/// local version that will work in the browser.
+#[tracing::instrument(level = tracing::Level::TRACE)]
+fn transform_fusionauth_url(url: &str) -> String {
+ // TODO: may want to make this something we initialize once
+ match macro_env::Environment::new_or_prod() {
+ macro_env::Environment::Local => transform_local_fusionauth_url(url),
+ _ => url.to_string(),
+ }
+}
+
+#[cfg(test)]
+mod test;
diff --git a/rust/cloud-storage/authentication_service/src/service/fusionauth_client/passwordless/mod.rs b/rust/cloud-storage/authentication_service/src/service/fusionauth_client/passwordless/mod.rs
index 73eeea0304..22a87cd70a 100644
--- a/rust/cloud-storage/authentication_service/src/service/fusionauth_client/passwordless/mod.rs
+++ b/rust/cloud-storage/authentication_service/src/service/fusionauth_client/passwordless/mod.rs
@@ -166,7 +166,7 @@ async fn send(
/// Returns the access token, refresh token, and redirect uri
/// https://fusionauth.io/docs/apis/passwordless#complete-a-passwordless-login
/// Valid respones: 200, 202, 203, 212, 213, 242, 400, 404, 409, 410, 423, 500, 503, 504
-#[tracing::instrument(ret, err)]
+#[tracing::instrument(ret, err, level = tracing::Level::TRACE)]
async fn complete(
client: &AuthedClient,
base_url: &str,
@@ -255,7 +255,7 @@ impl FusionAuthClient {
.await
}
- #[tracing::instrument(skip_all)]
+ #[tracing::instrument(skip_all, level = tracing::Level::TRACE)]
pub async fn complete_passwordless_login(
&self,
code: &str,
diff --git a/rust/cloud-storage/authentication_service/src/service/fusionauth_client/test.rs b/rust/cloud-storage/authentication_service/src/service/fusionauth_client/test.rs
new file mode 100644
index 0000000000..0f19778be0
--- /dev/null
+++ b/rust/cloud-storage/authentication_service/src/service/fusionauth_client/test.rs
@@ -0,0 +1,19 @@
+use super::*;
+
+#[test]
+fn test_transform_local_fusionauth_url() {
+ let urls = vec![
+ (
+ "http://fusionauth:9011/a/b/c/d",
+ "http://localhost:9011/a/b/c/d",
+ ),
+ (
+ "https://fusionauth-dev.macro.com",
+ "https://fusionauth-dev.macro.com",
+ ),
+ ];
+
+ for (value, expected) in urls.iter() {
+ assert_eq!(&transform_local_fusionauth_url(value), expected);
+ }
+}