-
Notifications
You must be signed in to change notification settings - Fork 9
Generate a project
In this example let's say we have application that only needs a database and something to manually run SQL query
The first obvious step is to go to https://okty.io/ and press "Start" !
Now, we need something that may manage a database.
Search for you favorite database software in the list.
In this example, we'll go on with mysql
This is the must important step, you have to tell to okty what you really need !
Here is the recommended configuration for this example :
Here's some explanation :
- Container ID : This is the container identifiant and should be unique
- Mysql Port : Port to used on the host computer if you want to connect to the database outside of the application
- Local path of database folder: Folder where you want to store database files (Allows persistent data storage)
- Database name : The name of the database where application data will be stored
- Mysql user : Username used to access database
- Mysql password : Password used to access database
Once your configuration is done, save your container by hitting the "save" button
In the case that all we want is a database, we may export our project at this step but we're not really comfortable with mysql command lines and it would be great if we may have an UI to manage data
Let's add another container to do this !
We have implemented in okty a light container to manage database through UI.
Adminer is a light container that doesn't require any configuration.
Do you remember when I told you that adminer didn't require any configuration ?
That was a lie ... You have to specify host port on which one adminer will be available
In our example, default value is just fine
Our project is now ready to be run ! Just export it and unzip it.
Create an empty folder somewhere on your computer and put the docker-compose file inside it.
Open a terminal and navigate to your folder.
Run : docker-compose up -d
At this point, you have a database running on your computer !
Don't you believe me ? Okay...
Open your favorite internet browser and go to : http://127.0.0.1:8081/
In order to connect to your database, you have to specify data from step 3 of this tutorial
WARNING : In this case your have to access database through container, this means server address isn't 127.0.0.1
If you have to connect to your database from an application inside another container, database ip value is the value specified in "Container ID" of mysql
If you want to stop you database, all you have to do is run one command
docker-compose stop
And that's all ! Less than 10 step to run a local database without polluting your computer 😄