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): image proxy service (#4241)
Will Hutchinson5db235597b27
diff --git a/.github/workspace-dep-closures.json b/.github/workspace-dep-closures.jsonindex a31a651f1d..fc7eae997a 100644--- a/.github/workspace-dep-closures.json+++ b/.github/workspace-dep-closures.json@@ -20,7 +20,6 @@"ai_projections","cowlike","macro_user_id",- "macro_uuid","model-error-response","model_user","workspace-hack"@@ -2042,6 +2041,8 @@"ip_extractor","macro_auth","macro_aws_config",+ "macro_config",+ "macro_config_derive","macro_cors","macro_db_client","macro_entrypoint",diff --git a/infra/stacks/doppler-projects/index.ts b/infra/stacks/doppler-projects/index.tsindex 12ee6822cc..cbbb08c91a 100644--- a/infra/stacks/doppler-projects/index.ts+++ b/infra/stacks/doppler-projects/index.ts@@ -9,6 +9,7 @@ const SERVICE_NAMES = ['search-processing-service','unfurl-service','static-file-service',+ 'image-proxy-service',];for (const service_name of SERVICE_NAMES) {diff --git a/infra/stacks/image-proxy-service/image-proxy-service.ts b/infra/stacks/image-proxy-service/image-proxy-service.tsindex 917aec0208..87ef895327 100644--- a/infra/stacks/image-proxy-service/image-proxy-service.ts+++ b/infra/stacks/image-proxy-service/image-proxy-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 = 'image-proxy-service';+const BASE_NAME = pulumi.getProject();const BASE_PATH = '../../../rust/cloud-storage';export const SERVICE_DOMAIN_NAME = `image-proxy${@@ -168,6 +169,12 @@ export class ImageProxyService extends pulumi.ComponentResource {{ parent: this });+ const dopplerEcsEnvironment = new DopplerEcsEnvironment(+ BASE_NAME,+ { tags: this.tags },+ { parent: this }+ );+// serviceconst service = new awsx.ecs.FargateService(`${BASE_NAME}`,@@ -187,6 +194,9 @@ export class ImageProxyService extends pulumi.ComponentResource {taskRole: {roleArn: this.role.arn,},+ executionRole: {+ roleArn: dopplerEcsEnvironment.executionRole.arn,+ },containers: {log_router: fargateLogRouterSidecarContainer,datadog_agent: datadogAgentContainer,@@ -197,6 +207,7 @@ export class ImageProxyService extends pulumi.ComponentResource {cpu: 512,memory: 1024,environment: containerEnvVars,+ secrets: [...dopplerEcsEnvironment.containerSecrets],logConfiguration: {logDriver: 'awsfirelens',options: {diff --git a/infra/stacks/image-proxy-service/index.ts b/infra/stacks/image-proxy-service/index.tsindex 173306dfd0..1e55057da3 100644--- a/infra/stacks/image-proxy-service/index.ts+++ b/infra/stacks/image-proxy-service/index.ts@@ -30,14 +30,6 @@ const jwtSecretKeyArn: pulumi.Output<string> = aws.secretsmanager.getSecretVersionOutput({ secretId: JWT_SECRET_KEY }).apply((secret) => secret.arn);-const fusionauthClientIdSecretKey = config.require(`fusionauth_client_id`);-const FUSIONAUTH_CLIENT_ID = aws.secretsmanager- .getSecretVersionOutput({- secretId: fusionauthClientIdSecretKey,- })- .apply((secret) => secret.secretString);-const FUSIONAUTH_ISSUER = config.require(`fusionauth_issuer`);-const MACRO_API_TOKENS = getMacroApiToken();const secretKeyArns = [@@ -63,32 +55,6 @@ const imageProxyService = new ImageProxyService(name: 'ENVIRONMENT',value: stack,},- {- name: 'RUST_LOG',- value: `image_proxy_service=${- stack === 'prod' ? 'debug' : 'trace'- },tower_http=debug`,- },- {- name: 'JWT_SECRET_KEY',- value: pulumi.interpolate`${JWT_SECRET_KEY}`,- },- {- name: 'AUDIENCE',- value: pulumi.interpolate`${FUSIONAUTH_CLIENT_ID}`,- },- {- name: 'ISSUER',- value: pulumi.interpolate`${FUSIONAUTH_ISSUER}`,- },- {- name: 'MACRO_API_TOKEN_ISSUER',- value: pulumi.interpolate`${MACRO_API_TOKENS.macroApiTokenIssuer}`,- },- {- name: 'MACRO_API_TOKEN_PUBLIC_KEY',- value: pulumi.interpolate`${MACRO_API_TOKENS.macroApiTokenPublicKey}`,- },// OpenTelemetry / Datadog tracing configuration{name: 'DD_SERVICE',diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex 102cb69c5d..01c91312e9 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -5971,14 +5971,15 @@ dependencies = ["aws-sdk-secretsmanager","axum","bytes",+ "doppler-config","futures","http-body-util","macro_auth","macro_aws_config",+ "macro_config","macro_cors","macro_entrypoint","macro_env",- "macro_env_var","macro_middleware","model","reqwest 0.13.4",diff --git a/rust/cloud-storage/image_proxy_service/Cargo.toml b/rust/cloud-storage/image_proxy_service/Cargo.tomlindex 5d77fef043..31b0b16b08 100644--- a/rust/cloud-storage/image_proxy_service/Cargo.toml+++ b/rust/cloud-storage/image_proxy_service/Cargo.toml@@ -13,16 +13,21 @@ path = "src/main.rs"name = "image_proxy_service_openapi"path = "src/openapi.rs"+[[bin]]+name = "image_proxy_service_doppler_config"+path = "src/doppler_config.rs"+[dependencies]anyhow = { workspace = true }aws-sdk-secretsmanager = { workspace = true }axum = { workspace = true, features = ["macros"] }+doppler-config = { workspace = true }macro_auth = { path = "../macro_auth" }macro_aws_config = { path = "../macro_aws_config" }+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" }macro_middleware = { path = "../macro_middleware", default-features = false, features = ["auth","tracking",diff --git a/rust/cloud-storage/image_proxy_service/src/config.rs b/rust/cloud-storage/image_proxy_service/src/config.rsindex 46711eec00..5313d3b21e 100644--- a/rust/cloud-storage/image_proxy_service/src/config.rs+++ b/rust/cloud-storage/image_proxy_service/src/config.rs@@ -1,29 +1,22 @@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.-#[derive(Debug)]+#[derive(Debug, macro_config::MacroConfig)]+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub struct Config {- /// The port to listen on+ /// The port to listen on.+ #[macro_config_default(8080)]pub port: usize,- /// The environment we are in+ /// 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 image proxy service config")}}diff --git a/rust/cloud-storage/image_proxy_service/src/doppler_config.rs b/rust/cloud-storage/image_proxy_service/src/doppler_config.rsnew file mode 100644index 0000000000..24a613ba27--- /dev/null+++ b/rust/cloud-storage/image_proxy_service/src/doppler_config.rs@@ -0,0 +1,31 @@+#![allow(unused)]+#![recursion_limit = "256"]++use macro_env::Environment;++mod config;++const DOPPLER_PROJECT: &str = "image-proxy-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(())+}