-
-
Notifications
You must be signed in to change notification settings - Fork 483
Docker Persistent Container
Get started with Uvdesk now by using the docker container persistent.
To setup with docker container persistent then first you will be install the uvdesk community helpdesk project using composer (recommended), use the following commands:
$ composer create-project uvdesk/community-skeleton
If you don't wish to use composer, you can just download the zip of the project.
Now you can dockerize your helpdesk project to easily deploy your setup from within a docker container.
To build an image, simply switch to your project's directory and run the following command:
$ docker build -t {IMAGE_NAME} .
Upon successfully execution, this will create a docker image with the specified tag using the -t option. You can use this image to deploy your helpdesk project.
For check your docker images list then run the below command:
$ docker images
- If you want to persist mysql database setup locally within container use the below line:
uvdesk_db (/var/lib/mysql)
[You can use the any name of volume: uvdesk_db ]
- If you want to persist the entire app and associated data including configurations, logs, and any changes to source code:
uvdesk_app (/var/www/uvdesk)
- If you want to persist only the app and related environment configurations:
uvdesk_config (/var/www/uvdesk/config)
${PWD}/.env (/var/www/uvdesk/.env)
Now create a container using the mount volumes follow the below deploy container command:
Create container with mounted volumes:
docker run -dit -p 82:80 -p 3306:3306 \
-v uvdesk_app:/var/www/uvdesk \
-v uvdesk_db:/var/lib/mysql \
--name <your-container-name> <your-build-image-name>;
Alternatively:
docker run -dit -p 82:80 -p 3306:3306 \
-v uvdesk_config:/var/www/uvdesk/config \
-v uvdesk_db:/var/lib/mysql \
-v ${PWD}/.env:/var/www/uvdesk/.env \
--name <your-container-name> <your-build-image-name>;
Alternatively:
docker run -dit -p 82:80 -p 3306:3306 \
-e MYSQL_USER={MYSQL_USER} \
-e MYSQL_ROOT_PASSWORD={MYSQL_ROOT_PASSWORD} \
-e MYSQL_PASSWORD={MYSQL_PASSWORD} \
-e MYSQL_DATABASE={MYSQL_DATABASE} \
-v uvdesk_config:/var/www/uvdesk/config \
-v uvdesk_db:/var/lib/mysql \
-v ${PWD}/.env:/var/www/uvdesk/.env \
--name <your-container-name> <your-build-image-name>;
For Reference check the below screenshot:
Now setup your docker project using the port number like this:
Note: At this moment here shows an error while you will setup of mysql setup, so you will be first create mysql database credentials on your created container.
Follow the below command:
$ docker exec -it <your-container-name> /bin/bash
After that you will be access your mysql terminal in your created container using the below command:
$ mysql
or
$ mysql -u root
After access mysql terminal now you will be configure mysql credentials and use containerized database.
Manage and update user credentials & privileges
mysql> ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY '{MYSQL_ROOT_PASSWORD}';
mysql> CREATE USER {MYSQL_USER}@localhost IDENTIFIED WITH mysql_native_password BY '{MYSQL_PASSWORD}';
mysql> GRANT ALL ON *.* To uvdesk@localhost;
mysql> UPDATE mysql.user SET host='%' WHERE user='{MYSQL_USER}';
mysql> FLUSH PRIVILEGES;`
For Exit mysql terminal & back to container shell terminal using the below command:
mysql> exit
Now Setup your project again now add the same mysql DB details you have created, after setup you will be shows your helpdesk
Admin Panel:
http://localhost:4003/en/member/login
Front-end Panel:
Additional Notes for docker and mysql commands:
After create mysql credentials access for mysql:
$ mysql -u root -p
[Then enter your password]
For Restart mysql service:
$ service mysql restart
For check mysql status:
$ service mysql status
For apache service restart:
$ service apache2 restart
For check apache status:
$ service apache2 status