Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mubarokahh/migrating-app-to-container-
https://github.com/mubarokahh/migrating-app-to-container-
deployment-automation docker docker-container docker-image
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mubarokahh/migrating-app-to-container-
- Owner: Mubarokahh
- Created: 2024-01-17T22:12:52.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-01-31T19:56:23.000Z (11 months ago)
- Last Synced: 2024-01-31T20:46:03.591Z (11 months ago)
- Topics: deployment-automation, docker, docker-container, docker-image
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MIGRATING TO THE CLOUD WITH CONTAINERIZATION
In this project,when i talk about containers, I imply docker. Although there are other containerization technology,docker is the standard tool for deploying application its dependencies and configuration in a sandbox also known as containers in an operating system.For my previous projects, i have been using VMs to deploy web solution. For efficiency purpose, i will be using docker to deploy my application.Unlike a VM, Docker allocated not the whole guest OS for your application, but only isolated minimal part of it - this isolated container has all that your application needs and at the same time is lighter, faster, and can be shipped as a Docker image to multiple physical or virtual environments, as long as this environment can run Docker engine. This approach also solves the environment incompatibility issue. It is a well-known problem when a developer sends his application to you, you try to deploy it, deployment fails, and the developer replies, "- It works on my machine!". With Docker - if the application is shipped as a container, it has its own environment isolated from the rest of the world, and it will always work the same way on any server that has Docker engine.
## Installing docker engine
For the purpose of this project, i installed docker desktop that is conpartible with my local host.## Deploying mySQL into a container in docker engine.
`docker run --name -e MYSQL_ROOT_PASSWORD= -d mysql/mysql-server:latest`
I aaded the needed values into the command and the got the container up and running.
## Connecting to the MySQL Docker Container
I connected directly to the mySQL server as to creating another container to serve as mySQL client
`docker exec -it mubarokah mysql -uroot -p`
## Preparing database schema
- Cloning the following repository (git clone https://github.com/darey-devops/tooling.git)
- Exporting the location of the SQL file that contains data for setting up the MySQL database: `export tooling_db_schema=~/tooling_db_schema.sql`
- Using the SQL script to create the database and prepare the schema: `docker exec -i mysql-server mysql -uroot -p$MYSQL_PW < $tooling_db_schema`
- I updated the db_conn.php with the connection details to the database.
$servername = "mysqlserverhost";
$username = "mubarokah";
$password = "*****";
$dbname = "toolingdb";## Runing the Tooling Application
Containerizing the Tooling Appliaction
- I ran the following command in the directory that has dockerfile
'docker build -t tooling:0.0.1'
- Running the container
'docker run --network tooling_app_network -p 8085:80 -it tooling:0.0.1'
## Migarating the php-Todo app into a containerized application
- Cloning this repsository 'https://github.com/Mubarokahh/php-todo.git'
- I created mysql container for the php-todo
- The dockerfile
- Creating a docker image with the build command
`docker build -t php-todo:0.0.3 .`
- Running the container
- Running the artisan migrate command inside the php-todo container since it was ignored during the build process