Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(doppler): unfurl service (#4229)
Will Hutchinson7948433653c6
diff --git a/.github/workspace-dep-closures.json b/.github/workspace-dep-closures.jsonindex 536a7ab475..55414bf316 100644--- a/.github/workspace-dep-closures.json+++ b/.github/workspace-dep-closures.json@@ -1053,6 +1053,8 @@"lexical_client","macro_auth","macro_aws_config",+ "macro_config",+ "macro_config_derive","macro_cors","macro_db_client","macro_entrypoint",@@ -4057,10 +4059,13 @@"workspace-hack"],"unfurl_service": [+ "macro_config",+ "macro_config_derive","macro_cors","macro_entrypoint","macro_env","macro_env_var",+ "remote_env_var","unfurl","unfurl_service","workspace-hack"diff --git a/infra/stacks/doppler-projects/Pulumi.prod.yaml b/infra/stacks/doppler-projects/Pulumi.prod.yamlindex 65ecd5ce6f..60507631b5 100644--- a/infra/stacks/doppler-projects/Pulumi.prod.yaml+++ b/infra/stacks/doppler-projects/Pulumi.prod.yaml@@ -4,4 +4,4 @@ config:doppler-projects:doppler_secrets_manager_integration_id:secure: AAABAH2bDAIjSwi83Nj6L5LVc4u/+RVp63kK/XxjC+YF/hMIHpHJ5bKthb1X1YBZKO46FktEvztGhzCCKvj+sR/Y3Ak=doppler:dopplerToken:- secure: AAABACy9/cdqGE3ErYm91DTYBI6Ci3/B741AotvmPi7a9VjLlUu7KWRtzLHjXlXJpLup1HRnfc/1GskYJGs5C3Y5ZAIyMpJLGSuPID2hjyut+ secure: AAABAN/PSOOeZluaT/lAdwTw0STWzVfN83Fmv9NlCjmDSz0AjubvbnRpj4ZqxKLr1VlrTVDTxj+7uMiu/2N5+NCQQf5ubTb2ZbHVZ2KVq1eZdiff --git a/infra/stacks/doppler-projects/index.ts b/infra/stacks/doppler-projects/index.tsindex 232f8c2dae..d1543b0818 100644--- a/infra/stacks/doppler-projects/index.ts+++ b/infra/stacks/doppler-projects/index.ts@@ -7,6 +7,7 @@ const SERVICE_NAMES = ['contacts-service','cloud-storage-service','search-processing-service',+ 'unfurl-service',];for (const service_name of SERVICE_NAMES) {diff --git a/infra/stacks/unfurl-service/index.ts b/infra/stacks/unfurl-service/index.tsindex af75cc7b4f..f3db71601d 100644--- a/infra/stacks/unfurl-service/index.ts+++ b/infra/stacks/unfurl-service/index.ts@@ -38,12 +38,6 @@ const unfurlService = new UnfurlService(`unfurl-service-${stack}`, {name: 'ENVIRONMENT',value: stack,},- {- name: 'RUST_LOG',- value: `unfurl_service=${- stack === 'prod' ? 'debug' : 'trace'- },tower_http=debug`,- },// OpenTelemetry / Datadog tracing configuration{name: 'DD_SERVICE',diff --git a/infra/stacks/unfurl-service/unfurl-service.ts b/infra/stacks/unfurl-service/unfurl-service.tsindex d22fbf1fe7..99eb14c29a 100644--- a/infra/stacks/unfurl-service/unfurl-service.ts+++ b/infra/stacks/unfurl-service/unfurl-service.ts@@ -13,10 +13,11 @@ import { EcrImage } from '../../packages/service';import {BASE_DOMAIN,CLOUD_TRAIL_SNS_TOPIC_ARN,+ DopplerEcsEnvironment,stack,} from '../../packages/shared';-const BASE_NAME = 'unfurl-service';+const BASE_NAME = pulumi.getProject();const BASE_PATH = '../../../rust/cloud-storage';export const SERVICE_DOMAIN_NAME = `unfurl-service${@@ -137,6 +138,12 @@ export class UnfurlService extends pulumi.ComponentResource {{ parent: this });+ const dopplerEcsEnvironment = new DopplerEcsEnvironment(+ BASE_NAME,+ { tags: this.tags },+ { parent: this }+ );+// serviceconst service = new awsx.ecs.FargateService(`${BASE_NAME}`,@@ -156,6 +163,10 @@ export class UnfurlService extends pulumi.ComponentResource {taskRole: {roleArn: this.role.arn,},+ executionRole: {+ roleArn: dopplerEcsEnvironment.executionRole.arn,+ },+containers: {log_router: fargateLogRouterSidecarContainer,datadog_agent: datadogAgentContainer,@@ -166,6 +177,7 @@ export class UnfurlService extends pulumi.ComponentResource {cpu: 256,memory: 512,environment: containerEnvVars,+ secrets: [...dopplerEcsEnvironment.containerSecrets],logConfiguration: {logDriver: 'awsfirelens',options: {diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex f485584623..1125d354ac 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -12832,13 +12832,14 @@ dependencies = ["anyhow","axum","bytes",+ "doppler-config","futures","http 1.4.0","http-body-util",+ "macro_config","macro_cors","macro_entrypoint","macro_env",- "macro_env_var","reqwest 0.13.4","scraper","serde",diff --git a/rust/cloud-storage/unfurl_service/Cargo.toml b/rust/cloud-storage/unfurl_service/Cargo.tomlindex 7e01f9c703..ed46746518 100644--- a/rust/cloud-storage/unfurl_service/Cargo.toml+++ b/rust/cloud-storage/unfurl_service/Cargo.toml@@ -12,20 +12,25 @@ path = "src/main.rs"name = "unfurl_service_openapi"path = "src/openapi.rs"+[[bin]]+name = "unfurl_service_doppler_config"+path = "src/doppler_config.rs"+[features]mock = [][dependencies]anyhow = { workspace = true }axum = { workspace = true, features = ["macros"] }+doppler-config = { workspace = true }bytes = { workspace = true }futures = { workspace = true }http = { workspace = true }http-body-util = { workspace = true }+macro_config = { path = "../macro_config" }macro_cors = { path = "../macro_cors" }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }-macro_env_var = { path = "../macro_env_var" }reqwest = { workspace = true, features = ["stream"] }scraper = { workspace = true }serde = { workspace = true }diff --git a/rust/cloud-storage/unfurl_service/src/config.rs b/rust/cloud-storage/unfurl_service/src/config.rsindex eaa134eba4..079bf5bb19 100644--- a/rust/cloud-storage/unfurl_service/src/config.rs+++ b/rust/cloud-storage/unfurl_service/src/config.rs@@ -1,11 +1,6 @@use anyhow::Context;pub use macro_env::Environment;-use macro_env_var::maybe_env_vars;--maybe_env_vars! {- struct Port;-}/// The configuration parameters for the application.///@@ -14,21 +9,20 @@ maybe_env_vars! {/// populate the Docker container////// See `.env.sample` in cognitive-workspace root for details.-#[derive(Debug)]+#[derive(macro_config::MacroConfig)]+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub struct Config {+ /// The port to listen for HTTP requests on.+ #[macro_config_default(8080)]pub port: usize,+/// The environment we are in+ #[macro_config_default(Environment::new_or_prod())]pub environment: Environment,}impl Config {pub fn from_env() -> anyhow::Result<Self> {- let port = Port::new()- .map(|port| port.parse::<usize>().context("PORT must be a valid usize"))- .transpose()?- .unwrap_or(8080);- let environment = Environment::new_or_prod();-- Ok(Config { port, environment })+ macro_config::ConfigLoader::load::<Config>().context("failed to load unfurl service config")}}diff --git a/rust/cloud-storage/unfurl_service/src/doppler_config.rs b/rust/cloud-storage/unfurl_service/src/doppler_config.rsnew file mode 100644index 0000000000..0db52af80b--- /dev/null+++ b/rust/cloud-storage/unfurl_service/src/doppler_config.rs@@ -0,0 +1,31 @@+#![allow(unused)]+#![recursion_limit = "256"]++use macro_env::Environment;++mod config;++const DOPPLER_PROJECT: &str = "unfurl-service";++#[tokio::main]+async fn main() -> anyhow::Result<()> {+ let dev = doppler_config::DopplerConfig::builder()+ .token_from_env("DOPPLER_TOKEN")+ .config(Environment::Develop.to_doppler_slug())+ .project(DOPPLER_PROJECT)+ .build()+ .expect("able to grab doppler project");++ dev.load::<config::Config>().await?;++ let prd = doppler_config::DopplerConfig::builder()+ .token_from_env("DOPPLER_TOKEN")+ .config(Environment::Production.to_doppler_slug())+ .project(DOPPLER_PROJECT)+ .build()+ .expect("able to grab doppler project");++ prd.load::<config::Config>().await?;++ Ok(())+}