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.

feat: initial local environment support (#1131)

Will Hutchinson598e208b6ed9
diff --git a/RUNNING_LOCALLY.md b/RUNNING_LOCALLY.md
new file mode 100644
index 0000000000..783c317d17
--- /dev/null
+++ b/RUNNING_LOCALLY.md
@@ -0,0 +1,25 @@
+# Running Locally
+
+**DISCLAIMER**: This is a work in progress and we only support running services against dev-assets at this time.
+
+## Prerequisites
+
+- Doppler
+- Docker
+- AWS
+
+
+## Setup
+
+- Go into doppler and the `local_services` project. Under the `_personal` environment you will need to update the following variables:
+
+```
+AWS_ACCESS_KEY_ID
+AWS_SECRET_ACCESS_KEY
+```
+
+- Next generate your `.env` file via `just get_environment`
+
+## Running
+
+You can run the services via `just build_run_local` or `just run_local` if you have already built the docker images.
diff --git a/docker-compose-databases.yml b/docker-compose-databases.yml
new file mode 100644
index 0000000000..94c85c9a98
--- /dev/null
+++ b/docker-compose-databases.yml
@@ -0,0 +1,35 @@
+services:
+ postgres:
+ image: postgres:16
+ ports:
+ - '5432:5432'
+ expose:
+ - '5432'
+ environment:
+ - POSTGRES_USER=user
+ - POSTGRES_PASSWORD=password
+ - PGPASSWORD=password
+ volumes:
+ - db:/var/lib/postgresql/data
+ networks:
+ - databases
+ redis:
+ image: 'redis/redis-stack:latest'
+ ports:
+ - '6379:6379' # Expose Redis on the default port
+ - '8001:8001' # Expose Redis Stack Server UI/tools
+ environment:
+ - ALLOW_EMPTY_PASSWORD=yes
+ volumes:
+ - cache:/data
+ networks:
+ - databases
+
+networks:
+ databases:
+ external: true
+volumes:
+ db:
+ driver: local
+ cache:
+ driver: local
diff --git a/docker-compose.yml b/docker-compose.yml
index 1e3553fa22..69b21b6e12 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,126 +1,409 @@
-version: '3.8'
+# Services
+include:
+ - docker-compose-databases.yml
+
+x-common-env: &common-env
+ env_file:
+ - .env
+
services:
- macrodb:
- image: postgres:16
- container_name: macrodb
+ # ============================================================================
+ # authentication_service (Port 8080)
+ # Primary auth service - depends on FusionAuth, Redis, MacroDB
+ # ============================================================================
+ authentication_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: authentication_service
ports:
- - '5432:5432'
- expose:
- - '5432'
- environment:
- - POSTGRES_USER=user
- - POSTGRES_PASSWORD=password
- - PGPASSWORD=password
- volumes:
- - db:/var/lib/postgresql/data
- - ./database/Initiate.sql:/etc/Initiate.sql
- - ./database/Clear.sql:/etc/Clear.sql
- networks:
- - macro_api_network
- macrocache:
- image: 'redis/redis-stack:latest'
- container_name: macrocache
- ports:
- - '6379:6379' # Expose Redis on the default port
- - '8001:8001' # Expose Redis Stack Server UI/tools
- environment:
- - ALLOW_EMPTY_PASSWORD=yes
- volumes:
- - cache:/data
+ - "8080:8080"
networks:
- - macro_api_network
- redis-node-0:
- image: bitnami/redis-cluster:7.0
- environment:
- - REDIS_PORT_NUMBER=6369
- - REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE=hostname
- - REDIS_CLUSTER_ANNOUNCE_HOSTNAME=redis-node-0
- - ALLOW_EMPTY_PASSWORD=yes
- - REDIS_CLUSTER_CREATOR=yes
- - REDIS_NODES=redis-node-0:6369,redis-node-1:6380,redis-node-2:6381, redis-node-3:6382,redis-node-4:6383, redis-node-5:6384
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
+
+ # ============================================================================
+ # comms_service (Port 8081)
+ # Communications/messaging service
+ # ============================================================================
+ comms_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: comms_service
ports:
- - '6369:6369'
- depends_on: [redis-node-1, redis-node-2, redis-node-3, redis-node-4]
+ - "8081:8080"
+ depends_on:
+ - authentication_service
+ - connection_gateway
networks:
- - macro_api_network
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
- redis-node-1:
- image: bitnami/redis-cluster:7.0
- environment:
- - REDIS_PORT_NUMBER=6380
- - REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE=hostname
- - REDIS_CLUSTER_ANNOUNCE_HOSTNAME=redis-node-1
- - ALLOW_EMPTY_PASSWORD=yes
- - REDIS_NODES=redis-node-0:6369,redis-node-1:6380,redis-node-2:6381, redis-node-3:6382,redis-node-4:6383, redis-node-5:6384
+ # ============================================================================
+ # connection_gateway (Port 8082)
+ # WebSocket gateway - Redis only
+ # ============================================================================
+ connection_gateway:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: connection_gateway_service
ports:
- - '6380:6380'
+ - "8082:8080"
+ depends_on:
+ - redis
networks:
- - macro_api_network
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
- redis-node-2:
- image: bitnami/redis-cluster:7.0
+ # ============================================================================
+ # contacts_service (Port 8083)
+ # Contact management - ContactsDB
+ # ============================================================================
+ contacts_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: contacts_service
+ ports:
+ - "8083:8080"
environment:
- - REDIS_PORT_NUMBER=6381
- - REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE=hostname
- - REDIS_CLUSTER_ANNOUNCE_HOSTNAME=redis-node-2
- - ALLOW_EMPTY_PASSWORD=yes
- - REDIS_NODES=redis-node-0:6369,redis-node-1:6380,redis-node-2:6381, redis-node-3:6382,redis-node-4:6383, redis-node-5:6384
+ - DATABASE_URL=${CONTACTSDB_URL}
+ networks:
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
+
+ # ============================================================================
+ # convert_service (Port 8084)
+ # Document format conversion - requires LibreOffice
+ # ============================================================================
+ convert_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.convert_service.dev
+ target: convert_service
ports:
- - '6381:6381'
+ - "8084:8080"
networks:
- - macro_api_network
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
- redis-node-3:
- image: bitnami/redis-cluster:7.0
- environment:
- - REDIS_PORT_NUMBER=6382
- - REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE=hostname
- - REDIS_CLUSTER_ANNOUNCE_HOSTNAME=redis-node-3
- - ALLOW_EMPTY_PASSWORD=yes
- - REDIS_NODES=redis-node-0:6369,redis-node-1:6380,redis-node-2:6381, redis-node-3:6382,redis-node-4:6383, redis-node-5:6384
+ # ============================================================================
+ # document_cognition_service (Port 8085)
+ # Document analysis and processing
+ # ============================================================================
+ document_cognition_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: document_cognition_service
ports:
- - '6382:6382'
+ - "8085:8080"
+ depends_on:
+ - comms_service
+ - document_storage_service
+ - search_service
+ - email_service
+ - static_file_service
networks:
- - macro_api_network
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
- redis-node-4:
- image: bitnami/redis-cluster:7.0
- environment:
- - REDIS_PORT_NUMBER=6383
- - REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE=hostname
- - REDIS_CLUSTER_ANNOUNCE_HOSTNAME=redis-node-4
- - ALLOW_EMPTY_PASSWORD=yes
- - REDIS_NODES=redis-node-0:6369,redis-node-1:6380,redis-node-2:6381, redis-node-3:6382,redis-node-4:6383, redis-node-5:6384
+ # ============================================================================
+ # document_storage_service (Port 8086)
+ # Main document storage API
+ # ============================================================================
+ document_storage_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: document_storage_service
+ ports:
+ - "8086:8080"
+ depends_on:
+ - redis
+ - connection_gateway
+ - authentication_service
+ networks:
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
+
+ # ============================================================================
+ # email_service (Port 8087)
+ # Email processing and management
+ # ============================================================================
+ email_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: email_service
+ ports:
+ - "8087:8080"
+ depends_on:
+ - authentication_service
+ - document_storage_service
+ - connection_gateway
+ - static_file_service
+ - redis
+ networks:
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
+
+ # ============================================================================
+ # experiment_service (Port 8088)
+ # Feature flags and experiments
+ # ============================================================================
+ experiment_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: experiment_service
ports:
- - '6383:6383'
+ - "8088:8080"
networks:
- - macro_api_network
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
- redis-node-5:
- image: bitnami/redis-cluster:7.0
+ # ============================================================================
+ # notification_service (Port 8089)
+ # User notifications - NotificationDB
+ # ============================================================================
+ notification_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: notification_service
+ ports:
+ - "8089:8080"
environment:
- - REDIS_PORT_NUMBER=6384
- - REDIS_CLUSTER_PREFERRED_ENDPOINT_TYPE=hostname
- - REDIS_CLUSTER_ANNOUNCE_HOSTNAME=redis-node-5
- - ALLOW_EMPTY_PASSWORD=yes
- - REDIS_NODES=redis-node-0:6369,redis-node-1:6380,redis-node-2:6381, redis-node-3:6382,redis-node-4:6383, redis-node-5:6384
+ # Explicitly override as this is a unique databas
+ - DATABASE_URL=${NOTIFICATIONDB_URL}
+ depends_on:
+ - redis
+ - document_cognition_service
+ - authentication_service
+ - connection_gateway
+ - document_storage_service
+ networks:
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
+
+ # ============================================================================
+ # organization_service (Port 8090)
+ # Organization and team management
+ # ============================================================================
+ organization_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: organization_service
+ ports:
+ - "8090:8080"
+ depends_on:
+ - redis
+ - document_storage_service
+ - authentication_service
+ networks:
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
+
+ # ============================================================================
+ # properties_service (Port 8091)
+ # User/document properties
+ # ============================================================================
+ properties_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: properties_service
+ ports:
+ - "8091:8080"
+ depends_on:
+ - comms_service
+ networks:
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
+
+ # ============================================================================
+ # search_processing_service (Port 8092)
+ # Search indexing worker
+ # ============================================================================
+ search_processing_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.search_processing_service.dev
+ ports:
+ - "8092:8080"
+ depends_on:
+ - email_service
+ - comms_service
+ networks:
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
+
+ # ============================================================================
+ # search_service (Port 8093)
+ # Search API
+ # ============================================================================
+ search_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: search_service
+ ports:
+ - "8093:8080"
+ depends_on:
+ - comms_service
+ - email_service
+ - document_storage_service
+ networks:
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
+
+ # ============================================================================
+ # static_file_service (Port 8094)
+ # Static file serving - DynamoDB
+ # ============================================================================
+ static_file_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: static_file_service
+ ports:
+ - "8094:8080"
+ networks:
+ - databases
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
+
+ # ============================================================================
+ # unfurl_service (Port 8095)
+ # URL unfurling - no dependencies
+ # ============================================================================
+ unfurl_service:
+ <<: *common-env
+ build:
+ context: ./rust/cloud-storage
+ dockerfile: Dockerfile.dev
+ target: unfurl_service
ports:
- - '6384:6384'
+ - "8095:8080"
networks:
- - macro_api_network
+ - services
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 10s
networks:
- macro_api_network:
- name: macro_api_network
+ services:
driver: bridge
- macro_fusion_network:
- # external: true
-volumes:
- db:
- name: macro_db_volume
+ databases:
external: true
- # driver: local
- cache:
- name: macro_cache_volume
- # external: true
- driver: local
diff --git a/infra/bun.lock b/infra/bun.lock
index f2750d0dfb..1ca0d41ad4 100644
--- a/infra/bun.lock
+++ b/infra/bun.lock
@@ -1,5 +1,6 @@
{
"lockfileVersion": 1,
+ "configVersion": 0,
"workspaces": {
"": {
"name": "cloud-storage-infra",
diff --git a/infra/stacks/cloud-storage-service/index.ts b/infra/stacks/cloud-storage-service/index.ts
index a695263dea..1379695d04 100644
--- a/infra/stacks/cloud-storage-service/index.ts
+++ b/infra/stacks/cloud-storage-service/index.ts
@@ -277,23 +277,23 @@ const cloudStorageService = new CloudStorageService(
value: stack === 'prod' ? '5000' : '5000',
},
{
- name: 'PRESIGNED_URL_EXPIRY_SECONDS',
+ name: 'DOCUMENT_STORAGE_SERVICE_PRESIGNED_URL_EXPIRY_SECONDS',
value: '900',
},
{
- name: 'PRESIGNED_URL_BROWSER_CACHE_EXPIRY_SECONDS',
+ name: 'DOCUMENT_STORAGE_SERVICE_PRESIGNED_URL_BROWSER_CACHE_EXPIRY_SECONDS',
value: '840',
},
{
- name: 'CLOUDFRONT_DISTRIBUTION_URL',
+ name: 'DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_DISTRIBUTION_URL',
value: pulumi.interpolate`${cloudfronDistributionUrl}`,
},
{
- name: 'CLOUDFRONT_SIGNER_PUBLIC_KEY_ID',
+ name: 'DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PUBLIC_KEY_ID',
value: pulumi.interpolate`${cloudfronSignerPublicKeyId}`,
},
{
- name: 'CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME',
+ name: 'DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME',
value: pulumi.interpolate`${CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME}`,
},
{ name: 'ISSUER', value: pulumi.interpolate`${FUSIONAUTH_ISSUER}` },
diff --git a/infra/stacks/email-service/index.ts b/infra/stacks/email-service/index.ts
index e26f192e75..da404068a6 100644
--- a/infra/stacks/email-service/index.ts
+++ b/infra/stacks/email-service/index.ts
@@ -491,11 +491,11 @@ const containerEnvVars = [
value: pulumi.interpolate`${MACRO_API_TOKENS.macroApiTokenPublicKey}`,
},
{
- name: 'PRESIGNED_URL_TTL_SECS',
+ name: 'EMAIL_SERVICE_PRESIGNED_URL_TTL_SECS',
value: pulumi.interpolate`${PRESIGNED_URL_TTL_SECS}`,
},
{
- name: 'CLOUDFRONT_SIGNER_PRIVATE_KEY',
+ name: 'EMAIL_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY',
value: pulumi.interpolate`${CLOUDFRONT_PRIVATE_KEY}`,
},
{
@@ -507,11 +507,11 @@ const containerEnvVars = [
value: emailAttachmentBucket.bucket.id,
},
{
- name: 'CLOUDFRONT_DISTRIBUTION_URL',
+ name: 'EMAIL_SERVICE_CLOUDFRONT_DISTRIBUTION_URL',
value: pulumi.interpolate`${cloudfrontDistribution.domain}`,
},
{
- name: 'CLOUDFRONT_SIGNER_PUBLIC_KEY_ID',
+ name: 'EMAIL_SERVICE_CLOUDFRONT_SIGNER_PUBLIC_KEY_ID',
value: pulumi.interpolate`${cloudfrontDistribution.publicKey.id}`,
},
];
diff --git a/docker-compose-opensearch.yml b/infra/stacks/opensearch/docker-compose-opensearch.yml
similarity index 100%
rename from docker-compose-opensearch.yml
rename to infra/stacks/opensearch/docker-compose-opensearch.yml
diff --git a/infra/stacks/organization-service/index.ts b/infra/stacks/organization-service/index.ts
index 48e9ed9c2f..278a967bea 100644
--- a/infra/stacks/organization-service/index.ts
+++ b/infra/stacks/organization-service/index.ts
@@ -39,11 +39,13 @@ const jwtSecretKeyArn: pulumi.Output<string> = aws.secretsmanager
.getSecretVersionOutput({ secretId: JWT_SECRET_KEY })
.apply((secret) => secret.arn);
-const AUTH_INTERNAL_AUTH_SECRET_KEY = config.require(
+const AUTHENTICATION_SERVICE_INTERNAL_API_SECRET_KEY = config.require(
`authentication_service_internal_api_key`
);
const authInternalSecretKeyArn: pulumi.Output<string> = aws.secretsmanager
- .getSecretVersionOutput({ secretId: AUTH_INTERNAL_AUTH_SECRET_KEY })
+ .getSecretVersionOutput({
+ secretId: AUTHENTICATION_SERVICE_INTERNAL_API_SECRET_KEY,
+ })
.apply((secret) => secret.arn);
const fusionauthClientIdSecretKey = config.require(`fusionauth_client_id`);
@@ -69,18 +71,6 @@ const cloudStorageClusterName: pulumi.Output<string> = cloudStorageStack
.getOutput('cloudStorageClusterName')
.apply((arn) => arn as string);
-const cloudStorageServiceStack = new pulumi.StackReference(
- 'cloud-storage-service-stack',
- {
- name: `macro-inc/cloud-storage-service/${stack}`,
- }
-);
-
-export const cloudStorageServiceUrl: pulumi.Output<string> =
- cloudStorageServiceStack
- .getOutput('cloudStorageServiceUrl')
- .apply((url) => url as string);
-
export const INVITE_EMAIL = `invite${
stack === 'prod' ? '' : `-${stack}`
}@macro.com`;
@@ -122,8 +112,10 @@ const organizationService = new OrganizationService(
value: pulumi.interpolate`${DOCUMENT_STORAGE_SERVICE_AUTH_KEY}`,
},
{
- name: 'DSS_URL',
- value: pulumi.interpolate`${cloudStorageServiceUrl}`,
+ name: 'DOCUMENT_STORAGE_SERVICE_URL',
+ value: `https://cloud-storage${
+ stack === 'prod' ? '' : `-${stack}`
+ }.macro.com`,
},
{
name: 'INVITE_EMAIL',
@@ -149,12 +141,12 @@ const organizationService = new OrganizationService(
value: pulumi.interpolate`${FUSIONAUTH_CLIENT_ID}`,
},
{
- name: 'AUTH_URL',
+ name: 'AUTHENTICATION_SERVICE_URL',
value: `https://auth-service${stack === 'prod' ? '' : '-dev'}.macro.com`,
},
{
- name: 'AUTH_INTERNAL_AUTH_SECRET_KEY',
- value: pulumi.interpolate`${AUTH_INTERNAL_AUTH_SECRET_KEY}`,
+ name: 'AUTHENTICATION_SERVICE_INTERNAL_API_SECRET_KEY',
+ value: pulumi.interpolate`${AUTHENTICATION_SERVICE_INTERNAL_API_SECRET_KEY}`,
},
{
name: 'MACRO_API_TOKEN_ISSUER',
diff --git a/infra/stacks/static-file-service/index.ts b/infra/stacks/static-file-service/index.ts
index 5f167953e1..27f6fab823 100644
--- a/infra/stacks/static-file-service/index.ts
+++ b/infra/stacks/static-file-service/index.ts
@@ -68,7 +68,10 @@ const containerEnvVars = [
{ name: 'ISSUER', value: pulumi.interpolate`${FUSIONAUTH_ISSUER}` },
- { name: 'SERVICE_URL', value: pulumi.interpolate`${SERVICE_URL}` },
+ {
+ name: 'STATIC_FILE_SERVICE_URL',
+ value: pulumi.interpolate`${SERVICE_URL}`,
+ },
{
name: 'STATIC_STORAGE_BUCKET',
value: pulumi.interpolate`${STATIC_FILE_BUCKET}`,
diff --git a/infra/stacks/static-file-service/static-file-service.ts b/infra/stacks/static-file-service/static-file-service.ts
index e3e4a6dda0..8ca15d12d0 100644
--- a/infra/stacks/static-file-service/static-file-service.ts
+++ b/infra/stacks/static-file-service/static-file-service.ts
@@ -436,9 +436,18 @@ export class StaticFileService extends pulumi.ComponentResource {
cpu: 256,
memory: 512,
environment: [
- { name: `DYNAMODB_TABLE_NAME`, value: args.dynamoDbTableName },
- { name: `S3_BUCKET_URL`, value: STORAGE_LOCATION },
- { name: 'S3_EVENT_QUEUE_URL', value: queueQueue.url },
+ {
+ name: `STATIC_FILE_SERVICE_DYNAMODB_TABLE_NAME`,
+ value: args.dynamoDbTableName,
+ },
+ {
+ name: `STATIC_FILE_SERVICE_S3_BUCKET_URL`,
+ value: STORAGE_LOCATION,
+ },
+ {
+ name: 'STATIC_FILE_SERVICE_S3_EVENT_QUEUE_URL',
+ value: queueQueue.url,
+ },
...(args.containerEnvVars ?? []),
],
logConfiguration: {
diff --git a/justfile b/justfile
index 77bb94f154..a0d5aa39ef 100644
--- a/justfile
+++ b/justfile
@@ -1,2 +1,34 @@
-run_dbs:
- docker-compose up macrodb redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5 macrocache
+# Creates global networks that are shared across docker-compose files
+create_networks:
+ docker network create databases 2>/dev/null || true
+ echo "docker networks created"
+
+get_environment:
+ doppler secrets download --no-file --format env > .env
+
+# Creates the docker networks then runs the databases
+# This is used when initializing your databases
+run_dbs *ARGS:
+ just create_networks
+ docker-compose -f docker-compose-databases.yml up postgres redis {{ ARGS }}
+
+# Spins up main docker-compose
+docker_up *ARGS:
+ echo "startup docker compose"
+ docker compose up {{ ARGS }}
+
+# Run all services locally using docker-compose
+# Requires .env file with dev environment variables
+run_local *ARGS:
+ just create_networks
+ just docker_up {{ ARGS }}
+
+# Builds the main docker images for the services and runs the docker-compose
+# after
+build_run_local *ARGS:
+ just rust/cloud-storage/build_dev_service_images
+ just run_local {{ ARGS }}
+
+# Stop all local services
+stop-local:
+ docker compose down
diff --git a/rust/cloud-storage/.dockerignore b/rust/cloud-storage/.dockerignore
index 4f960ca87b..46c4765b4f 100644
--- a/rust/cloud-storage/.dockerignore
+++ b/rust/cloud-storage/.dockerignore
@@ -38,3 +38,6 @@ CLAUDE.md
*.swp
*.swo
*~
+
+.env
+docker-compose.yml
diff --git a/rust/cloud-storage/.gitignore b/rust/cloud-storage/.gitignore
index 8353bd8b53..bc3194c348 100644
--- a/rust/cloud-storage/.gitignore
+++ b/rust/cloud-storage/.gitignore
@@ -14,6 +14,9 @@ ai_tools/schemas/
!*/**/.env.sample
*/**/.env
+# Root .env file for docker-compose
+/.env
+
# Jetbrains IDE files
**/.idea/
**/.helix/
diff --git a/rust/cloud-storage/Dockerfile.convert_service.dev b/rust/cloud-storage/Dockerfile.convert_service.dev
new file mode 100644
index 0000000000..9fe4274b0a
--- /dev/null
+++ b/rust/cloud-storage/Dockerfile.convert_service.dev
@@ -0,0 +1,55 @@
+# Download LibreOffice/Collabora Online assets
+FROM debian:trixie-slim AS lok
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ curl tar ca-certificates \
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
+RUN curl -L -O https://github.com/CollaboraOnline/online/releases/download/for-code-assets/core-co-25.04-assets.tar.gz
+RUN tar -xvf core-co-25.04-assets.tar.gz
+
+# Build stage with clang dependencies for bindgen
+FROM rust:latest AS chef
+ENV SQLX_OFFLINE=true
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ llvm libclang-dev clang \
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
+RUN cargo install cargo-strip
+WORKDIR /app
+
+FROM chef AS builder
+COPY . .
+
+RUN cargo build --release --bin convert_service \
+ && cargo strip \
+ && mv /app/target/release/convert_service /app/svc
+
+# Runtime image with LibreOffice
+FROM ubuntu:noble AS convert_service
+WORKDIR /app
+
+# Accept Microsoft fonts license
+RUN echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ libreoffice \
+ libreofficekit-dev \
+ ca-certificates \
+ openssl \
+ dumb-init \
+ libkrb5-3 \
+ ttf-mscorefonts-installer \
+ wget xfonts-utils \
+ cabextract \
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
+
+# Refresh font cache
+RUN fc-cache -f -v
+
+# Copy binary and LOK assets
+COPY --from=builder /app/svc /app/svc
+COPY --from=lok /instdir /app/lok/instdir
+COPY --from=lok /include /app/lok/include
+RUN chmod +x svc
+
+ENV PORT=8080
+EXPOSE 8080
+ENTRYPOINT ["dumb-init", "./svc"]
diff --git a/rust/cloud-storage/Dockerfile.dev b/rust/cloud-storage/Dockerfile.dev
new file mode 100644
index 0000000000..675bea7708
--- /dev/null
+++ b/rust/cloud-storage/Dockerfile.dev
@@ -0,0 +1,105 @@
+FROM rust:latest AS chef
+ENV SQLX_OFFLINE=true
+RUN cargo install cargo-strip
+WORKDIR /app
+
+FROM chef AS builder
+COPY . .
+
+# Build ALL standard service binaries at once
+RUN cargo build --release \
+ --bin authentication_service \
+ --bin comms_service \
+ --bin connection_gateway_service \
+ --bin contacts_service \
+ --bin document_cognition_service \
+ --bin document_storage_service \
+ --bin email_service \
+ --bin experiment_service \
+ --bin notification_service \
+ --bin organization_service \
+ --bin properties_service \
+ --bin search_service \
+ --bin static_file_service \
+ --bin unfurl_service \
+ && cargo strip
+
+# Base runtime image
+FROM debian:trixie-slim AS base
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ ca-certificates openssl dumb-init curl \
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
+WORKDIR /app
+ENV PORT=8080
+EXPOSE 8080
+
+# Individual service targets
+FROM base AS authentication_service
+COPY --from=builder /app/target/release/authentication_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS comms_service
+COPY --from=builder /app/target/release/comms_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS connection_gateway_service
+COPY --from=builder /app/target/release/connection_gateway_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS contacts_service
+COPY --from=builder /app/target/release/contacts_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS document_cognition_service
+COPY --from=builder /app/target/release/document_cognition_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS document_storage_service
+COPY --from=builder /app/target/release/document_storage_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS email_service
+COPY --from=builder /app/target/release/email_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS experiment_service
+COPY --from=builder /app/target/release/experiment_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS notification_service
+COPY --from=builder /app/target/release/notification_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS organization_service
+COPY --from=builder /app/target/release/organization_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS properties_service
+COPY --from=builder /app/target/release/properties_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS search_service
+COPY --from=builder /app/target/release/search_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS static_file_service
+COPY --from=builder /app/target/release/static_file_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
+
+FROM base AS unfurl_service
+COPY --from=builder /app/target/release/unfurl_service /app/svc
+RUN chmod +x /app/svc
+ENTRYPOINT ["dumb-init", "./svc"]
diff --git a/rust/cloud-storage/Dockerfile.search_processing_service.dev b/rust/cloud-storage/Dockerfile.search_processing_service.dev
new file mode 100644
index 0000000000..c90ff7032d
--- /dev/null
+++ b/rust/cloud-storage/Dockerfile.search_processing_service.dev
@@ -0,0 +1,30 @@
+FROM rust:latest AS chef
+ENV SQLX_OFFLINE=true
+RUN cargo install cargo-strip
+WORKDIR /app
+
+FROM chef AS builder
+COPY . .
+
+RUN cargo build --release --bin search_processing_service \
+ && cargo strip \
+ && mv /app/target/release/search_processing_service /app/svc
+
+# Runtime image
+FROM debian:trixie-slim AS search_processing_service
+WORKDIR /app
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ ca-certificates openssl dumb-init curl \
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
+
+COPY --from=builder /app/svc /app/svc
+
+RUN mkdir -p /app/pdfium-lib/linux
+COPY ./search_processing_service/pdfium-lib/linux/libpdfium.so /app/pdfium-lib/linux/libpdfium.so
+
+RUN chmod +x svc
+
+ENV PORT=8080
+EXPOSE 8080
+ENTRYPOINT ["dumb-init", "./svc"]
diff --git a/rust/cloud-storage/contacts_service/src/main.rs b/rust/cloud-storage/contacts_service/src/main.rs
index 608689e53b..beca562752 100644
--- a/rust/cloud-storage/contacts_service/src/main.rs
+++ b/rust/cloud-storage/contacts_service/src/main.rs
@@ -39,21 +39,19 @@ async fn connect_to_database(config: &Config) -> anyhow::Result<PgPool> {
async fn create_sqs_worker(config: &Config) -> SQSWorker {
let queue_url = config.queue_url.clone();
- let aws_config = match config.environment {
- Environment::Local => {
- aws_config::defaults(aws_config::BehaviorVersion::latest())
- .region("us-east-1")
- .endpoint_url(&queue_url)
- .load()
- .await
- }
- _ => {
- aws_config::defaults(aws_config::BehaviorVersion::latest())
- .region("us-east-1")
- .load()
- .await
- }
+ let aws_config = if queue_url.contains("localhost") {
+ aws_config::defaults(aws_config::BehaviorVersion::latest())
+ .region("us-east-1")
+ .endpoint_url(&queue_url)
+ .load()
+ .await
+ } else {
+ aws_config::defaults(aws_config::BehaviorVersion::latest())
+ .region("us-east-1")
+ .load()
+ .await
};
+
let sqs_client = aws_sdk_sqs::Client::new(&aws_config);
sqs_worker::SQSWorker::new(
sqs_client,
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/export_document.rs b/rust/cloud-storage/document_storage_service/src/api/documents/export_document.rs
index 5283ceec2a..77ea164b33 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/export_document.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/export_document.rs
@@ -200,13 +200,24 @@ async fn sign_docx_url(state: &ApiContext, key: &str) -> anyhow::Result<String>
let encoded_key = urlencoding::encode(key);
let signed_options = get_cloudfront_signed_options(
- &state.config.vars.cloudfront_signer_public_key_id,
- state.config.cloudfront_signer_private_key.as_ref(),
- state.config.presigned_url_expiry_seconds,
+ &state
+ .config
+ .vars
+ .document_storage_service_cloudfront_signer_public_key_id,
+ state
+ .config
+ .document_storage_service_cloudfront_signer_private_key
+ .as_ref(),
+ state
+ .config
+ .document_storage_service_presigned_url_expiry_seconds,
);
let signed_url = get_presigned_url(
- &state.config.vars.cloudfront_distribution_url,
+ &state
+ .config
+ .vars
+ .document_storage_service_cloudfront_distribution_url,
&encoded_key,
&signed_options,
)?;
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/location.rs b/rust/cloud-storage/document_storage_service/src/api/documents/location.rs
index a285750ec8..655dd45c94 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/location.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/location.rs
@@ -118,7 +118,9 @@ pub async fn get_location_handler_v3(
}
};
- let max_age = state.config.presigned_url_browser_cache_expiry_seconds;
+ let max_age = state
+ .config
+ .document_storage_service_presigned_url_browser_cache_expiry_seconds;
Response::builder()
.status(StatusCode::OK)
@@ -233,7 +235,9 @@ pub async fn get_location_handler(
}
};
- let max_age = state.config.presigned_url_browser_cache_expiry_seconds;
+ let max_age = state
+ .config
+ .document_storage_service_presigned_url_browser_cache_expiry_seconds;
Response::builder()
.status(StatusCode::OK)
@@ -289,13 +293,24 @@ async fn get_editable_url(
}
let signed_options = get_cloudfront_signed_options(
- &state.config.vars.cloudfront_signer_public_key_id,
- state.config.cloudfront_signer_private_key.as_ref(),
- state.config.presigned_url_expiry_seconds,
+ &state
+ .config
+ .vars
+ .document_storage_service_cloudfront_signer_public_key_id,
+ state
+ .config
+ .document_storage_service_cloudfront_signer_private_key
+ .as_ref(),
+ state
+ .config
+ .document_storage_service_presigned_url_expiry_seconds,
);
let signed_url = get_presigned_url(
- &state.config.vars.cloudfront_distribution_url,
+ &state
+ .config
+ .vars
+ .document_storage_service_cloudfront_distribution_url,
&document_key,
&signed_options,
)?;
@@ -340,13 +355,24 @@ pub(in crate::api::documents) async fn get_static_url(
}
let signed_options = get_cloudfront_signed_options(
- &state.config.vars.cloudfront_signer_public_key_id,
- state.config.cloudfront_signer_private_key.as_ref(),
- state.config.presigned_url_expiry_seconds,
+ &state
+ .config
+ .vars
+ .document_storage_service_cloudfront_signer_public_key_id,
+ state
+ .config
+ .document_storage_service_cloudfront_signer_private_key
+ .as_ref(),
+ state
+ .config
+ .document_storage_service_presigned_url_expiry_seconds,
);
let signed_url = get_presigned_url(
- &state.config.vars.cloudfront_distribution_url,
+ &state
+ .config
+ .vars
+ .document_storage_service_cloudfront_distribution_url,
&document_key,
&signed_options,
)?;
@@ -382,13 +408,24 @@ async fn get_converted_docx_url(
}
let signed_options = get_cloudfront_signed_options(
- &state.config.vars.cloudfront_signer_public_key_id,
- state.config.cloudfront_signer_private_key.as_ref(),
- state.config.presigned_url_expiry_seconds,
+ &state
+ .config
+ .vars
+ .document_storage_service_cloudfront_signer_public_key_id,
+ state
+ .config
+ .document_storage_service_cloudfront_signer_private_key
+ .as_ref(),
+ state
+ .config
+ .document_storage_service_presigned_url_expiry_seconds,
);
let signed_url = get_presigned_url(
- &state.config.vars.cloudfront_distribution_url,
+ &state
+ .config
+ .vars
+ .document_storage_service_cloudfront_distribution_url,
&document_key,
&signed_options,
)?;
@@ -420,12 +457,24 @@ async fn get_docx_urls(
tracing::debug!(elapsed = ?start_shas.elapsed(), "got document shas");
let signed_options = get_cloudfront_signed_options(
- &state.config.vars.cloudfront_signer_public_key_id,
- state.config.cloudfront_signer_private_key.as_ref(),
- state.config.presigned_url_expiry_seconds,
+ &state
+ .config
+ .vars
+ .document_storage_service_cloudfront_signer_public_key_id,
+ state
+ .config
+ .document_storage_service_cloudfront_signer_private_key
+ .as_ref(),
+ state
+ .config
+ .document_storage_service_presigned_url_expiry_seconds,
);
- let cloudfront_distribution_url = state.config.vars.cloudfront_distribution_url.as_ref();
+ let cloudfront_distribution_url = state
+ .config
+ .vars
+ .document_storage_service_cloudfront_distribution_url
+ .as_ref();
let start_presigned_urls = std::time::Instant::now();
let presigned_urls: Vec<PresignedUrl> = shas
diff --git a/rust/cloud-storage/document_storage_service/src/config.rs b/rust/cloud-storage/document_storage_service/src/config.rs
index 9585bed235..8d9ecc86a4 100644
--- a/rust/cloud-storage/document_storage_service/src/config.rs
+++ b/rust/cloud-storage/document_storage_service/src/config.rs
@@ -22,10 +22,11 @@ pub struct Config {
pub document_limit: u64,
/// The number of seconds a presigned url is valid for
- pub presigned_url_expiry_seconds: u64,
+ pub document_storage_service_presigned_url_expiry_seconds: u64,
/// The number of seconds a browser cache for a presigned url is valid for
- pub presigned_url_browser_cache_expiry_seconds: u64,
- pub cloudfront_signer_private_key: LocalOrRemoteSecret<CloudfrontSignerPrivateKeySecretName>,
+ pub document_storage_service_presigned_url_browser_cache_expiry_seconds: u64,
+ pub document_storage_service_cloudfront_signer_private_key:
+ LocalOrRemoteSecret<DocumentStorageServiceCloudfrontSignerPrivateKeySecretName>,
pub document_permission_jwt: LocalOrRemoteSecret<DocumentPermissionJwtSecretKey>,
}
@@ -36,8 +37,8 @@ env_var! {
pub DocumentStorageBucket,
pub DocxDocumentUploadBucket,
pub DocumentDeleteQueue,
- pub CloudfrontDistributionUrl,
- pub CloudfrontSignerPublicKeyId,
+ pub DocumentStorageServiceCloudfrontDistributionUrl,
+ pub DocumentStorageServiceCloudfrontSignerPublicKeyId,
pub RedisUri,
pub NotificationQueue,
pub SearchEventQueue,
@@ -53,14 +54,16 @@ env_var! {
env_var! { struct Port; }
env_var! { struct DocumentLimit; }
-env_var! { struct PresignedUrlExpirySeconds; }
-env_var! { struct PresignedUrlBrowserCacheExpirySeconds; }
-env_var! { pub struct CloudfrontSignerPrivateKeySecretName; }
+env_var! { struct DocumentStorageServicePresignedUrlExpirySeconds; }
+env_var! { struct DocumentStorageServicePresignedUrlBrowserCacheExpirySeconds; }
+env_var! { pub struct DocumentStorageServiceCloudfrontSignerPrivateKeySecretName; }
env_var! { pub struct DocumentPermissionJwtSecretKey; }
impl Config {
pub fn from_env(
- cloudfront_signer_private_key: LocalOrRemoteSecret<CloudfrontSignerPrivateKeySecretName>,
+ document_storage_service_cloudfront_signer_private_key: LocalOrRemoteSecret<
+ DocumentStorageServiceCloudfrontSignerPrivateKeySecretName,
+ >,
document_permission_jwt: LocalOrRemoteSecret<DocumentPermissionJwtSecretKey>,
) -> anyhow::Result<Self> {
let environment = Environment::new_or_prod();
@@ -75,13 +78,14 @@ impl Config {
.and_then(|v| v.as_ref().parse::<u64>().ok())
.unwrap_or(20);
- let presigned_url_expiry_seconds = PresignedUrlExpirySeconds::new()
- .ok()
- .and_then(|v| v.as_ref().parse::<u64>().ok())
- .unwrap_or(DEFAULT_PRESIGNED_URL_EXPIRY_SECONDS);
+ let document_storage_service_presigned_url_expiry_seconds =
+ DocumentStorageServicePresignedUrlExpirySeconds::new()
+ .ok()
+ .and_then(|v| v.as_ref().parse::<u64>().ok())
+ .unwrap_or(DEFAULT_PRESIGNED_URL_EXPIRY_SECONDS);
- let presigned_url_browser_cache_expiry_seconds =
- PresignedUrlBrowserCacheExpirySeconds::new()
+ let document_storage_service_presigned_url_browser_cache_expiry_seconds =
+ DocumentStorageServicePresignedUrlBrowserCacheExpirySeconds::new()
.ok()
.and_then(|v| v.as_ref().parse::<u64>().ok())
.unwrap_or(DEFAULT_PRESIGNED_URL_BROWSER_CACHE_EXPIRY_SECONDS);
@@ -93,13 +97,13 @@ impl Config {
port,
environment,
document_limit,
- presigned_url_expiry_seconds,
- presigned_url_browser_cache_expiry_seconds,
- cloudfront_signer_private_key,
+ document_storage_service_presigned_url_expiry_seconds,
+ document_storage_service_presigned_url_browser_cache_expiry_seconds,
+ document_storage_service_cloudfront_signer_private_key,
document_permission_jwt,
})
}
}
pub const DEFAULT_PRESIGNED_URL_EXPIRY_SECONDS: u64 = 900; // 15 minutes
-pub const DEFAULT_PRESIGNED_URL_BROWSER_CACHE_EXPIRY_SECONDS: u64 = 840; // remember that this is just a suggestion to the client browser, the API Gateway settings determine the actual cache time on the server
+pub const DEFAULT_PRESIGNED_URL_BROWSER_CACHE_EXPIRY_SECONDS: u64 = 840; // remember that this is just a suggestion to the client browser
diff --git a/rust/cloud-storage/document_storage_service/src/main.rs b/rust/cloud-storage/document_storage_service/src/main.rs
index 7f406b2068..0f9f2e1e4d 100644
--- a/rust/cloud-storage/document_storage_service/src/main.rs
+++ b/rust/cloud-storage/document_storage_service/src/main.rs
@@ -1,6 +1,8 @@
use crate::{
api::context::{ApiContext, DocumentStorageServiceAuthKey},
- config::{CloudfrontSignerPrivateKeySecretName, DocumentPermissionJwtSecretKey},
+ config::{
+ DocumentPermissionJwtSecretKey, DocumentStorageServiceCloudfrontSignerPrivateKeySecretName,
+ },
service::s3::S3,
};
use anyhow::Context;
@@ -51,7 +53,10 @@ async fn main() -> anyhow::Result<()> {
);
let cloudfront_signer_private_key = secretsmanager_client
- .get_maybe_secret_value(env, CloudfrontSignerPrivateKeySecretName::new()?)
+ .get_maybe_secret_value(
+ env,
+ DocumentStorageServiceCloudfrontSignerPrivateKeySecretName::new()?,
+ )
.await?;
let document_permission_jwt_secret = secretsmanager_client
diff --git a/rust/cloud-storage/email_service/src/api/email/attachments/get.rs b/rust/cloud-storage/email_service/src/api/email/attachments/get.rs
index b5d0b72aaa..cbfc5b617c 100644
--- a/rust/cloud-storage/email_service/src/api/email/attachments/get.rs
+++ b/rust/cloud-storage/email_service/src/api/email/attachments/get.rs
@@ -231,10 +231,19 @@ pub async fn upload_single_attachment(
// get a presigned cloudfront url for the attachment
async fn get_presigned_url(state: &ApiContext, key: &str) -> anyhow::Result<String> {
let encoded_key = urlencoding::encode(key);
- let presigned_url_expiry_secs = state.config.presigned_url_ttl_secs;
- let public_key_id = state.config.cloudfront_signer_public_key_id.clone();
- let private_key = state.config.cloudfront_signer_private_key.as_ref();
- let url = state.config.cloudfront_distribution_url.clone();
+ let presigned_url_expiry_secs = state.config.email_service_presigned_url_ttl_secs;
+ let public_key_id = state
+ .config
+ .email_service_cloudfront_signer_public_key_id
+ .clone();
+ let private_key = state
+ .config
+ .email_service_cloudfront_signer_private_key
+ .as_ref();
+ let url = state
+ .config
+ .email_service_cloudfront_distribution_url
+ .clone();
let current_unix_timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
diff --git a/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rs b/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rs
index c2a4531d00..ca5e2b7476 100644
--- a/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rs
+++ b/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rs
@@ -1,6 +1,6 @@
use anyhow::Context;
use document_storage_service_client::DocumentStorageServiceClient;
-use email_service::config::{CloudfrontSignerPrivateKey, Config};
+use email_service::config::{Config, EmailServiceCloudfrontSignerPrivateKey};
use macro_entrypoint::MacroEntrypoint;
use macro_env::Environment;
use macro_middleware::auth::internal_access::InternalApiSecretKey;
@@ -29,7 +29,7 @@ async fn main() -> anyhow::Result<()> {
);
let cloudfront_signer_private_key = secretsmanager_client
- .get_maybe_secret_value(env, CloudfrontSignerPrivateKey::new()?)
+ .get_maybe_secret_value(env, EmailServiceCloudfrontSignerPrivateKey::new()?)
.await?;
// Parse our configuration from the environment.
diff --git a/rust/cloud-storage/email_service/src/config.rs b/rust/cloud-storage/email_service/src/config.rs
index fc84d61dc8..8045d97217 100644
--- a/rust/cloud-storage/email_service/src/config.rs
+++ b/rust/cloud-storage/email_service/src/config.rs
@@ -115,23 +115,26 @@ pub struct Config {
pub connection_gateway_url: String,
// The URL for cloudfront
- pub cloudfront_distribution_url: String,
+ pub email_service_cloudfront_distribution_url: String,
// The secret for the cloudfront private key
- pub cloudfront_signer_private_key: LocalOrRemoteSecret<CloudfrontSignerPrivateKey>,
+ pub email_service_cloudfront_signer_private_key:
+ LocalOrRemoteSecret<EmailServiceCloudfrontSignerPrivateKey>,
// The public key for cloudfront
- pub cloudfront_signer_public_key_id: String,
+ pub email_service_cloudfront_signer_public_key_id: String,
// How long presigned urls should be valid for attachments
- pub presigned_url_ttl_secs: u64,
+ pub email_service_presigned_url_ttl_secs: u64,
}
-env_var! { pub struct CloudfrontSignerPrivateKey; }
+env_var! { pub struct EmailServiceCloudfrontSignerPrivateKey; }
impl Config {
pub fn from_env(
- cloudfront_signer_private_key: LocalOrRemoteSecret<CloudfrontSignerPrivateKey>,
+ email_service_cloudfront_signer_private_key: LocalOrRemoteSecret<
+ EmailServiceCloudfrontSignerPrivateKey,
+ >,
) -> anyhow::Result<Self> {
let database_url =
std::env::var("MACRO_DB_URL").context("MACRO_DB_URL must be provided")?;
@@ -267,16 +270,19 @@ impl Config {
let document_storage_service_url = std::env::var("DOCUMENT_STORAGE_SERVICE_URL")
.context("DOCUMENT_STORAGE_SERVICE_URL must be provided")?;
- let cloudfront_distribution_url = std::env::var("CLOUDFRONT_DISTRIBUTION_URL")
- .context("CLOUDFRONT_DISTRIBUTION_URL must be provided")?;
+ let email_service_cloudfront_distribution_url =
+ std::env::var("EMAIL_SERVICE_CLOUDFRONT_DISTRIBUTION_URL")
+ .context("EMAIL_SERVICE_CLOUDFRONT_DISTRIBUTION_URL must be provided")?;
- let cloudfront_signer_public_key_id = std::env::var("CLOUDFRONT_SIGNER_PUBLIC_KEY_ID")
- .context("CLOUDFRONT_SIGNER_PUBLIC_KEY_ID must be provided")?;
+ let email_service_cloudfront_signer_public_key_id =
+ std::env::var("EMAIL_SERVICE_CLOUDFRONT_SIGNER_PUBLIC_KEY_ID")
+ .context("EMAIL_SERVICE_CLOUDFRONT_SIGNER_PUBLIC_KEY_ID must be provided")?;
- let presigned_url_ttl_secs: u64 = std::env::var("PRESIGNED_URL_TTL_SECS")
- .unwrap_or("3600".to_string())
- .parse::<u64>()
- .unwrap();
+ let email_service_presigned_url_ttl_secs: u64 =
+ std::env::var("EMAIL_SERVICE_PRESIGNED_URL_TTL_SECS")
+ .unwrap_or("3600".to_string())
+ .parse::<u64>()
+ .unwrap();
Ok(Config {
macro_db_url: database_url,
@@ -314,10 +320,10 @@ impl Config {
static_file_service_url,
document_storage_service_url,
connection_gateway_url,
- cloudfront_distribution_url,
- cloudfront_signer_public_key_id,
- cloudfront_signer_private_key,
- presigned_url_ttl_secs,
+ email_service_cloudfront_distribution_url,
+ email_service_cloudfront_signer_public_key_id,
+ email_service_cloudfront_signer_private_key,
+ email_service_presigned_url_ttl_secs,
})
}
}
diff --git a/rust/cloud-storage/email_service/src/main.rs b/rust/cloud-storage/email_service/src/main.rs
index bc446b63bd..9c1d6f0c86 100644
--- a/rust/cloud-storage/email_service/src/main.rs
+++ b/rust/cloud-storage/email_service/src/main.rs
@@ -2,7 +2,7 @@ use crate::api::context::ApiContext;
use anyhow::Context;
use document_storage_service_client::DocumentStorageServiceClient;
use email::{domain::service::EmailServiceImpl, inbound::EmailPreviewState, outbound::EmailPgRepo};
-use email_service::config::CloudfrontSignerPrivateKey;
+use email_service::config::EmailServiceCloudfrontSignerPrivateKey;
use frecency::{domain::services::FrecencyQueryServiceImpl, outbound::postgres::FrecencyPgStorage};
use macro_auth::middleware::decode_jwt::JwtValidationArgs;
use macro_entrypoint::MacroEntrypoint;
@@ -36,7 +36,7 @@ async fn main() -> anyhow::Result<()> {
);
let cloudfront_signer_private_key = secretsmanager_client
- .get_maybe_secret_value(env, CloudfrontSignerPrivateKey::new()?)
+ .get_maybe_secret_value(env, EmailServiceCloudfrontSignerPrivateKey::new()?)
.await?;
// Parse our configuration from the environment.
diff --git a/rust/cloud-storage/justfile b/rust/cloud-storage/justfile
index 5e3ee7b1a6..3f5282f142 100644
--- a/rust/cloud-storage/justfile
+++ b/rust/cloud-storage/justfile
@@ -24,6 +24,12 @@ clean:
build:
SQLX_OFFLINE=true cargo build
+# Build all dev service Docker images (pre-warms cache for run_local_build)
+build_dev_service_images:
+ docker build -f Dockerfile.dev --target builder -t local-services .
+ docker build -f Dockerfile.convert_service.dev --target builder -t local-convert-service .
+ docker build -f Dockerfile.search_processing_service.dev --target builder -t local-search-processing-service .
+
# Build all lambda functions
build_lambdas:
#!/usr/bin/env -S parallel --shebang --ungroup --jobs {{ num_cpus() }}
diff --git a/rust/cloud-storage/notification_service/src/config.rs b/rust/cloud-storage/notification_service/src/config.rs
index 210a742080..23480641b1 100644
--- a/rust/cloud-storage/notification_service/src/config.rs
+++ b/rust/cloud-storage/notification_service/src/config.rs
@@ -77,7 +77,7 @@ impl Config {
std::env::var("DATABASE_URL").context("DATABASE_URL must be provided")?;
let port: usize = std::env::var("PORT")
- .unwrap_or("8079".to_string())
+ .unwrap_or("8080".to_string())
.parse::<usize>()
.context("should be valid port number")?;
diff --git a/rust/cloud-storage/organization_service/src/api/users/delete_user.rs b/rust/cloud-storage/organization_service/src/api/users/delete_user.rs
index 352ee9b29a..d03e00270a 100644
--- a/rust/cloud-storage/organization_service/src/api/users/delete_user.rs
+++ b/rust/cloud-storage/organization_service/src/api/users/delete_user.rs
@@ -88,7 +88,7 @@ async fn delete_user(auth_context: &Config, user_to_delete: &str) -> anyhow::Res
let res = client
.delete(format!(
"{}/internal/users/{url_encoded_user_id}",
- auth_context.dss_url
+ auth_context.document_storage_service_url
))
.header(
"x-document-storage-service-auth-key",
@@ -111,13 +111,18 @@ async fn delete_user(auth_context: &Config, user_to_delete: &str) -> anyhow::Res
let start_time_auth = std::time::Instant::now();
// Delete user DSS items through DSS API
let res = client
- .delete(format!("{}/webhooks/user", auth_context.auth_url))
+ .delete(format!(
+ "{}/webhooks/user",
+ auth_context.authentication_service_url
+ ))
.body(serde_json::to_string(&DeleteUserRequest {
user_id: user_to_delete.to_string(),
})?)
.header(
"x-internal-auth-key",
- auth_context.auth_internal_auth_secret_key.as_ref(),
+ auth_context
+ .authentication_service_internal_api_secret_key
+ .as_ref(),
)
.header("User-Agent", "organization-service")
.header(reqwest::header::CONTENT_TYPE, "application/json")
diff --git a/rust/cloud-storage/organization_service/src/config.rs b/rust/cloud-storage/organization_service/src/config.rs
index c09748e3d9..d96a9163b5 100644
--- a/rust/cloud-storage/organization_service/src/config.rs
+++ b/rust/cloud-storage/organization_service/src/config.rs
@@ -15,7 +15,7 @@ pub(crate) struct Config {
pub internal_api_secret_key: InternalApiSecretKey,
/// The DSS URL.
- pub dss_url: String,
+ pub document_storage_service_url: String,
/// The email used to send user invites to macro
pub invite_email: String,
@@ -27,25 +27,29 @@ pub(crate) struct Config {
pub environment: Environment,
/// The Auth service url
- pub auth_url: String,
+ pub authentication_service_url: String,
/// The Auth service internal auth secret key
- pub auth_internal_auth_secret_key: LocalOrRemoteSecret<AuthInternalAuthSecretKey>,
+ pub authentication_service_internal_api_secret_key:
+ LocalOrRemoteSecret<AuthenticationServiceInternalApiSecretKey>,
}
env_var! {
- pub(crate) struct AuthInternalAuthSecretKey;
+ pub(crate) struct AuthenticationServiceInternalApiSecretKey;
}
impl Config {
pub fn from_env(
- auth_internal_auth_secret_key: LocalOrRemoteSecret<AuthInternalAuthSecretKey>,
+ authentication_service_internal_api_secret_key: LocalOrRemoteSecret<
+ AuthenticationServiceInternalApiSecretKey,
+ >,
) -> anyhow::Result<Self> {
let database_url =
std::env::var("DATABASE_URL").context("DATABASE_URL must be provided")?;
let redis_uri = std::env::var("REDIS_URI").context("REDIS_URI must be provided")?;
- let dss_url = std::env::var("DSS_URL").context("DSS_URL must be provided")?;
+ let document_storage_service_url = std::env::var("DOCUMENT_STORAGE_SERVICE_URL")
+ .context("DOCUMENT_STORAGE_SERVICE_URL must be provided")?;
let invite_email =
std::env::var("INVITE_EMAIL").context("INVITE_EMAIL must be provided")?;
@@ -57,18 +61,19 @@ impl Config {
let environment = Environment::new_or_prod();
- let auth_url = std::env::var("AUTH_URL").context("AUTH_URL must be provided")?;
+ let authentication_service_url = std::env::var("AUTHENTICATION_SERVICE_URL")
+ .context("AUTHENTICATION_SERVICE_URL must be provided")?;
Ok(Config {
database_url,
redis_uri,
internal_api_secret_key: InternalApiSecretKey::new()?,
- dss_url,
+ document_storage_service_url,
invite_email,
port,
environment,
- auth_url,
- auth_internal_auth_secret_key,
+ authentication_service_url,
+ authentication_service_internal_api_secret_key,
})
}
}
diff --git a/rust/cloud-storage/organization_service/src/main.rs b/rust/cloud-storage/organization_service/src/main.rs
index 4a7f32f021..4be232e541 100644
--- a/rust/cloud-storage/organization_service/src/main.rs
+++ b/rust/cloud-storage/organization_service/src/main.rs
@@ -1,4 +1,4 @@
-use crate::{api::context::ApiContext, config::AuthInternalAuthSecretKey};
+use crate::{api::context::ApiContext, config::AuthenticationServiceInternalApiSecretKey};
use anyhow::Context;
use config::{Config, Environment};
use macro_auth::middleware::decode_jwt::JwtValidationArgs;
@@ -26,7 +26,7 @@ async fn main() -> anyhow::Result<()> {
));
let auth_service_key = secretsmanager_client
- .get_maybe_secret_value(env, AuthInternalAuthSecretKey::new()?)
+ .get_maybe_secret_value(env, AuthenticationServiceInternalApiSecretKey::new()?)
.await?;
// Parse our configuration from the environment.
diff --git a/rust/cloud-storage/search_processing_service/src/main.rs b/rust/cloud-storage/search_processing_service/src/main.rs
index 1af191b872..882d937a42 100644
--- a/rust/cloud-storage/search_processing_service/src/main.rs
+++ b/rust/cloud-storage/search_processing_service/src/main.rs
@@ -101,6 +101,13 @@ async fn main() -> anyhow::Result<()> {
{
use std::sync::Arc;
+ // Ensures that pdfium binary exists so we can kill the container early on failure
+ if !std::fs::exists("./pdfium-lib/linux/libpdfium.so").expect("able to find file") {
+ anyhow::bail!("libpdfium.so is missing");
+ } else {
+ tracing::trace!("libpdfium is present");
+ }
+
let sync_service_auth_key = match config.environment {
Environment::Local => config.sync_service_auth_key.clone(),
_ => secretsmanager_client
diff --git a/rust/cloud-storage/static_file_service/src/config.rs b/rust/cloud-storage/static_file_service/src/config.rs
index 49e0fc9696..080bf34d21 100644
--- a/rust/cloud-storage/static_file_service/src/config.rs
+++ b/rust/cloud-storage/static_file_service/src/config.rs
@@ -26,16 +26,17 @@ impl Config {
.unwrap_or("8080".to_string())
.parse::<usize>()
.unwrap();
- let dynamodb_table = std::env::var("DYNAMODB_TABLE_NAME")
- .context("DYNAMMODB_TABLE_NAME must be provided")?;
+ let dynamodb_table = std::env::var("STATIC_FILE_SERVICE_DYNAMODB_TABLE_NAME")
+ .context("STATIC_FILE_SERVICE_DYNAMODB_TABLE_NAME must be provided")?;
let storage_bucket_name = std::env::var("STATIC_STORAGE_BUCKET")
.context("STATIC_STORAGE_BUCKET must be provided")?;
- let service_url = std::env::var("SERVICE_URL").context("SERVICE_URL must be provided")?;
+ let service_url = std::env::var("STATIC_FILE_SERVICE_URL")
+ .context("STATIC_FILE_SERVICE_URL must be provided")?;
- let s3_event_queue_url =
- std::env::var("S3_EVENT_QUEUE_URL").context("S3_EVENT_QUEUE_URL must be provided")?;
+ let s3_event_queue_url = std::env::var("STATIC_FILE_SERVICE_S3_EVENT_QUEUE_URL")
+ .context("S3_EVENT_QUEUE_URL must be provided")?;
let internal_api_secret_key = std::env::var("INTERNAL_API_SECRET_KEY")
.context("INTERNAL_API_SECRET_KEY must be provided")?;