Skip to content

Commit 0f77578

Browse files
authored
Merge branch 'main' into add_to_migration_readme
2 parents f815e82 + bcacfcd commit 0f77578

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

docker-compose.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
services:
66
nginx:
77
image: nginx:1.25-alpine
8-
container_name: nginx-reverse-proxy # Match the name from your error message
8+
container_name: nginx-reverse-proxy # Match the name from your error message
99
ports:
1010
- "80:80"
1111
- "443:443"
@@ -28,22 +28,22 @@ services:
2828
- backend_network
2929
restart: unless-stopped
3030

31-
migrator: # db migration service
32-
image: ${BACKEND_IMAGE_NAME} # reuse backend image
31+
migrator: # db migration service
32+
image: ${BACKEND_IMAGE_NAME} # reuse backend image
3333
build:
3434
context: ${BACKEND_BUILD_CONTEXT}
3535
container_name: db-migrator
3636
platform: ${PLATFORM}
3737
environment:
38-
ROLE: migrator # entrypoint knows to migrate
39-
RUST_ENV: ${RUST_ENV} # development, staging, production
38+
ROLE: migrator # entrypoint knows to migrate
39+
RUST_ENV: ${RUST_ENV} # development, staging, production
4040
POSTGRES_SSL_ROOT_CERT: ${POSTGRES_SSL_ROOT_CERT}
4141
DATABASE_SCHEMA: ${POSTGRES_SCHEMA:-public}
4242
DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?${POSTGRES_OPTIONS}
4343
PLATFORM: ${PLATFORM}
4444
BACKEND_IMAGE_NAME: ${BACKEND_IMAGE_NAME}
45-
restart: "no" # run once, then exit
46-
command: [] # keep original ENTRYPOINT
45+
restart: "no" # run once, then exit
46+
command: [] # keep original ENTRYPOINT
4747
volumes:
4848
# Read-only bind mount of our production DB CA certificate
4949
- ${POSTGRES_SSL_ROOT_CERT}:/app/root.crt:ro
@@ -55,7 +55,7 @@ services:
5555
build:
5656
context: ${BACKEND_BUILD_CONTEXT}
5757
platform: ${PLATFORM}
58-
container_name: rust-app # Explicitly set the name nginx expects
58+
container_name: rust-app # Explicitly set the name nginx expects
5959
environment:
6060
ROLE: app
6161
RUST_ENV: ${RUST_ENV}
@@ -74,6 +74,7 @@ services:
7474
BACKEND_API_VERSION: ${BACKEND_API_VERSION}
7575
BACKEND_ALLOWED_ORIGINS: ${BACKEND_ALLOWED_ORIGINS}
7676
BACKEND_LOG_FILTER_LEVEL: ${BACKEND_LOG_FILTER_LEVEL}
77+
TIPTAP_APP_ID: ${TIPTAP_APP_ID}
7778
TIPTAP_URL: ${TIPTAP_URL}
7879
TIPTAP_AUTH_KEY: ${TIPTAP_AUTH_KEY}
7980
TIPTAP_JWT_SIGNING_KEY: ${TIPTAP_JWT_SIGNING_KEY}
@@ -113,4 +114,4 @@ services:
113114

114115
networks:
115116
backend_network:
116-
driver: bridge
117+
driver: bridge

migration/src/m20240210_153056_create_schema_and_base_db_setup.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl MigrationTrait for Migration {
1414

1515
manager
1616
.get_connection()
17-
.execute_unprepared("SET search_path TO refactor_platform, public;")
17+
.execute_unprepared("SET search_path TO refactor_platform;")
1818
.await?;
1919

2020
// Create the base DB user that will execute all platform queries
@@ -32,6 +32,12 @@ impl MigrationTrait for Migration {
3232
"#)
3333
.await?;
3434

35+
// Revoke all public CREATE privileges to the public schema, which plugs a significant security concern
36+
manager
37+
.get_connection()
38+
.execute_unprepared("REVOKE CREATE ON SCHEMA public FROM PUBLIC;")
39+
.await?;
40+
3541
Ok(())
3642
}
3743

0 commit comments

Comments
 (0)