You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will simplify setting up and running the application database locally. By adding a simple docker compose file, we can pull the database image from docker and when setting up a development environment. This will help do a few things:
Ensure all devs are using the same version of MYSQL
Lay the foundation for adding config/settings files to the Flask application because we have explicitly defined what the development database looks like.
This feature will have no breaking changes and should have bare minimum impact on the existing infrastructure. The only thing that will need to be updated is the README.
For the time being this is only aimed at being implemented in a development environment, this will not change the UI/front-end.
@zachtheclimber Docker is awesome although a bit intimidating if you are new to it. But here is an example of how simple this makes things. So assuming you have docker installed on your machine here is how this would work:
This is a simple docker-compse.yaml file example which would get added to the root project directory of MPV:
version: '3.3'
services:
db:
image: mysql:5.7
restart: always
environment:
# Use root/password as user/password credentials
MYSQL_DATABASE: 'mpv_db'
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:
- mpv_db:/var/lib/mysql
# Names our volume
volumes:
mpv_db:
Navigate to the root directory for MPV
Run the shell command docker-compose up
This will download and build a docker image of a MYSQL database using the specified version and environment variables specified in the docker-compose.yaml file.
If you want to connect from the shell to the running database image run the command mysql -u root -p mpv_db -h 127.0.0.1 -P 3306
Notice the port number 3306, inside of docker-compose.yaml we expose this port on the docker container and that will allow us to connect to the containerized instance of MYSQL via that port.
Let me know what you think! Here are a few links to some good reading about docker:
Super cool! I know a tiny bit about Docker, so I'm excited to learn more through implementing it with MPV. I also appreciate you leaving the option for a non-container setup as well. Thanks for the addition!
Containerize the development instance of MYSQL.
This will simplify setting up and running the application database locally. By adding a simple docker compose file, we can pull the database image from docker and when setting up a development environment. This will help do a few things:
This feature will have no breaking changes and should have bare minimum impact on the existing infrastructure. The only thing that will need to be updated is the
README
.For the time being this is only aimed at being implemented in a development environment, this will not change the UI/front-end.
@zachtheclimber Docker is awesome although a bit intimidating if you are new to it. But here is an example of how simple this makes things. So assuming you have docker installed on your machine here is how this would work:
This is a simple docker-compse.yaml file example which would get added to the root project directory of MPV:
docker-compose up
This will download and build a docker image of a MYSQL database using the specified version and environment variables specified in the
docker-compose.yaml
file.mysql -u root -p mpv_db -h 127.0.0.1 -P 3306
Notice the port number
3306
, inside ofdocker-compose.yaml
we expose this port on the docker container and that will allow us to connect to the containerized instance of MYSQL via that port.Let me know what you think! Here are a few links to some good reading about docker:
https://hub.docker.com/_/mysql/
https://severalnines.com/blog/mysql-docker-building-container-image
The text was updated successfully, but these errors were encountered: