Page:
Creating new databases
Pages
API SMHI
API TimeEdit
Accessibility Testing
Api documentation
Bat/Ps
Branch Creation
C# Coding Convention
CSS Coding Convention
Coding Conventions
Creating new databases
Dapper
Documentation for service endpoints
Documentation of useTemperature and mock sensor
Energy endpoints
Environment
Evaluation react-grid-layout
Evaluation Localization
Evaluation Password hashing
Evaluation Testing framework
Evaluation of Logging Frameworks
Formatter
Frontend model
Generic Diagram for Sensor data flow
Home
How to- Creating Databases in Docker
Implementing different Styles
Implementing new Mockup sensors
Implementing new Views
Installation script documentation
Installation
Issues
JSON Coding Convention
Jest Testing
Layout endpoints
Linux
Localization
Login endpoints
Mac
Middleware model
Mock API Ceation Guidelines
Mockup models
Model Tools and Standards
Parking endpoints
React/JavaScript Coding Convention
React
Reviews
Room booking endpoints
SQL Coding Convention
Scheduled Database tasks
Scripting Coding Convention
Secrets and .env
Server Access
Server-Deployment
Service/API models
System models
System requirements
Temperature endpoints
Testing API with Bruno
Testing Architecture
Testing frontend for Mobile devices
Testing frontend with Playwright
Testing methodology
Västtrafik API
Webpage Design
Windows
pg_cron and scheduled database jobs
xUnit Testing
No results
5
Creating new databases
Abdalrahman Alhindi edited this page 2026-04-17 12:38:02 +00:00
Table of Contents
Database Setup with Docker
1- Creating multiple databases in the same Container:
Description
A single PostgreSQL container can host multiple databases. Additional databases are created during container initialization using SQL scripts.
Characteristics
- One PostgreSQL instance
- Multiple databases are created inside the same container
- shared configuration (user, password, and port)
Advantages
- Simple setup and configuration
- Low resource usage. I.e., only one container
- Easy to manage in development environments
Disadvantages
- Single point of failure, where if the container crashes or stops, all databases are affected
- Shared credentials and configuration
- Less isolation between databases.
When to use:
- Local development
- small-scale setups, systems that are not comlex or large
- when simplicity is preferred over isolation
2- Creating separate containers for each database
Description
Each database runs in its own PostgreSQL container, defined as separate services in compose.yaml
Characteristics
- One database per container
- Independent configuration per database
- Separate storage, ports, and credentials
Advantages
- Strong isolation between databases
- No Single point of failure
- More flexibility, can have different configs per database.
Disadvantages
- Higher resource usage
- More complex setup and maintenance
- More Configuration required
When to use:
- Larger systems
- When databases must be isolated
- When reliability and fault tolerance are important
Recommendation
For most development use cases, using the first option, multiple databases in a single container is efficient and simpler. However, for more advanced scenarios requiring isolation or higher reliability, the separate containers for each database solutions, is considered to be better.
How to
step-by-step guide can be found here
1. Setup
2. Standards
- Coding Conventions
- Issues
- Branch creation
- Reviews
- Implementation Standards
- [WIP] Creating new databases
- Localization
3. Models and Diagrams
4. Testing
5. Documentation
- Documentation for service endpoints
- API documentation
- Webpage Design
- Secrets and .env
- Evaluations
- Installation and Rebuild script documentation
6. Guides and How-to's
7. Micro Service Mockup Api
- Guidelines Mircro Service Mockup
- Documentation of useTemperature/useTemperatureTimeSeries mockup sensor