-
Notifications
You must be signed in to change notification settings - Fork 268
How to add MySQL and PostgreSQL to Docker #160
-
I checked the Docker configuration/docker-compose file in that only MongoDB is getting installed.
I want to install two other databases.
- MySQL
- PostgreSQL
How to modify the file and configure these two RDBMS?
Regards,
Yogesh
Beta Was this translation helpful? Give feedback.
All reactions
Typically you would only add this as new sections to the docker-compose file.
For MySQL:
services:
db:
image: mysql:5.7 #or any other version
restart: always
environment:
MYSQL_DATABASE: 'db'
# So you don't have to use root, but you can if you like
MYSQL_USER: 'user'
# You can use whatever password you like
MYSQL_PASSWORD: 'password'
# Password for root access
MYSQL_ROOT_PASSWORD: 'password'
ports:
# <Port exposed> : <MySQL Port running inside container>
- '3306:3306'
expose:
# Opens port 3306 on the container
- '3306'
# Where our data will be persisted
volumes:
- my-db:/var/lib/mysql
#...
Replies: 3 comments 2 replies
-
Typically you would only add this as new sections to the docker-compose file.
For MySQL:
services:
db:
image: mysql:5.7 #or any other version
restart: always
environment:
MYSQL_DATABASE: 'db'
# So you don't have to use root, but you can if you like
MYSQL_USER: 'user'
# You can use whatever password you like
MYSQL_PASSWORD: 'password'
# Password for root access
MYSQL_ROOT_PASSWORD: 'password'
ports:
# <Port exposed> : <MySQL Port running inside container>
- '3306:3306'
expose:
# Opens port 3306 on the container
- '3306'
# Where our data will be persisted
volumes:
- my-db:/var/lib/mysql
# Names our volume
volumes:
my-db:
And Postgres:
services:
db:
image: postgres:14.1-alpine #or any other version
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- '5432:5432'
volumes:
- db:/var/lib/postgresql/data
volumes:
db:
driver: local
These are just examples.
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
Would it be possible to define Environment variables which LC would pickup for connecting with Other Database services added?
Beta Was this translation helpful? Give feedback.
All reactions
-
No. Environment Variables are meant to configure an instance "how to run." MongoDB is the so called "Meta-Data-Database", which does not contain "Application Data" in the sense of the Applications which you build on Lowcoder.
Other Database Services - to use in Lowcoder Applications are meant to be added as Data Sources, as is done in the UI or via API.
Beta Was this translation helpful? Give feedback.
All reactions
-
Can add another instance of Mongo?
Beta Was this translation helpful? Give feedback.
All reactions
-
As an docker-compose file is flexible it it's architecture, you can add as many databases or instances as you like. You would simply extend the docker compose. However, remember only one MongoDB Server (as Replika Set, Cluster or Single DB) can be used for Lowcoder as Meta-Data-Database. The other Databases which installation you would manage by the docker compose file, can get used as Lowcoder Data Sources - but need as all other Lowcoder Data Sources to get configured in the normal operating Lowcoder Software.
Beta Was this translation helpful? Give feedback.