Coder Social home page Coder Social logo

vancoding / treolabs-docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from treolabs/docker-treopim

0.0 2.0 0.0 3.46 MB

This repository is developed source for docker image.

License: GNU General Public License v3.0

Shell 85.45% Dockerfile 14.55%

treolabs-docker's Introduction

Docker Containers Configuration Description

These Docker images are designed for faster deployment of TreoPIM than LAMP or other method of local deployment. Having executed docker-run, the script will automatically put up containers with Apache and PHP, MySQL, PphMyadmin, and MailHog. Also, it will automatically clone the latest TreoPIM version from GitHub.

If that script is completed successfully, you will have to open the http://localhost:8081 link to continue the installation via the web installer.

Project Structure

Folder/File Description
docker-run.sh main script for starting all containers
.env main configuration file
data folder with user data
web_server container for web server (Apache + PHP)
docker-apache.sh connection to the container with web server
docker-mysql.sh connection to the container with MySQL server
docker-clean.sh script for cleaning downloaded Docker images
docker-compose.yml settings for Docker compose
.dockerignore the list of files to be ignored by the Docker container
.gitattributes Git settings
.gitignore the list of files to be ignored by Git

Installation and Setup

  1. Install Docker and be sure to follow the post-installation instructions given here. This will allow Docker and Apache in Docker to run from the main user in the system, and there will be no issues with access rights.

  2. For start and restart it is convenient to use the docker-run.sh script, since it rebuilds and launches the Docker containers.

  3. When you encounter any problems, you can use the docker-clean.sh script to delete all images, containers, and sections.

  4. The initial Docker setup is to configure the .env file parameters.

Main Parameters Description

DOMAIN – indicates the target folder for the cloned project. In case of cloning, this folder will be indicated as DocumentRoot.

Without cloning projects in the container, DocumentRoot has the /var/www/html path.

DOMAIN=localhost

The default value is localhost

PLATFORM – indicates the platform type, influences the teams after the container deployment. Platforms TREOPIM, TREOCORE, TREODAM should be defined.

PLATFORM=TREOPIM

The default value is TREOPIM

Allowed values are TREOPIM, TREOCORE, TREODAM.

APACHE_PORT – port, on which the Apache web server is available. The address is http://localhost:8081.

APACHE_PORT=8081

The default value is 8081

MAILHOG_PORT – port for MailHog, available on http://localhost:8025, assigned for viewing mail. Also all system errors in the container will be sent to MailHog.

MAILHOG_PORT=8025

The default value is 8025

PHPMYADMIN_PORT – port for connecting to phpMyAdmin, available on http://localhost:8084.

PHPMYADMIN_PORT=8084

The default value is 8084

MYSQL_PORT – port for external connection to the MySQL server, for instance, through MySQL Workbench. The connection settings are host:localhost port:13306.

MYSQL_PORT=1306

The default value is 1306

PHP_VER – the PHP version in the container; for Apache and CLI.

PHP_VER=7.3

The default value is 7.3

Allowed values are 5.6, 7.0, 7.1, 7.2, 7.3.

MYSQL_DATABASE – the local DB name in the database_server container.

MYSQL_DATABASE=db

The default value is db

MYSQL_USER – the name of the local DB user in the database_server container.

MYSQL_USER=db

The default value is db

MYSQL_PASSWORD – the password of the local DB user in the database_server container.

MYSQL_PASSWORD=db

The default value is db

MYSQL_ROOT_PASSWORD – the password of the root user to the local DB in the database_server container. This password can be used for external connection.

MYSQL_ROOT_PASSWORD=root

MYSQL_REMOTE_DATABASE – the remote DB name, which is to be defined for downloading the DB from the remote server.

MYSQL_REMOTE_DATABASE=docker

MYSQL_REMOTE_USER – the name of the DB user for connecting to the MYSQL_REMOTE_HOST remote server.

MYSQL_REMOTE_USER=docker

MYSQL_REMOTE_PASSWORD – the password of the DB user for connecting to the MYSQL_REMOTE_HOST remote server.

MYSQL_REMOTE_PASSWORD=docker

MYSQL_REMOTE_HOST – the remote host for DB cloning. A standard 3306 port is used.

MYSQL_REMOTE_HOST=db.treotest.com

On the startup, the system will automatically check if the DB has been previously deployed, and if it hasn't, the system will try to receive the latest backup from the /data/dumps/*.sql folder. If no backup is found in the folder, there will be an attempt to receive the DB from the MySQL remote server.

On the first launch of Docker, this process takes several minutes, so the first Docker launch may take up to 10 minutes. The DB is stored locally in the /data/mysql folder.

Project Structure in Docker

The main project must be stored in the root folder, i.e. the project folder must be /home/project, and the Docker folder must be located in the /home/project/docker folder.

└── home
    └── localhost - project folder
        └── docker - Docker folder
        │   ├── data
        │   │   ├── dumps
        │   │   ├── images
        │   │   ├── logs
        │   │   └── mysql
        │   └── web_server
        │       ├── entrypoint.d
        │       ├── php5.6
        │       ├── php7.0
        │       ├── php7.1
        │       ├── php7.2
        │       ├── php7.3
        │       └── scripts
        └── index.php - project file located in the `project1` folder
  • Database host to connect to within Docker: database_server.
  • Mail sending server: mail.server:1025.
  • Environment variables in order to understand that we are in Docker: ENV=DOCKER and SHOPWARE_ENV=dev.

Connecting to Docker Containers

The following helping scripts are available in the system: docker-apache(mysql).sh. These scripts are aimed at connecting to the corresponding container.

Features of Containers Launched in Docker

  1. To enable redirecting of mail to MailHog, the SMTP server must be configured in the system: mail.server:1025.

  2. The PHP settings are located in the ./web_server/phpX.X/config folder. Having made any changes, the container should be reloaded.

  3. Adding crons to the www-data user should be done in the following format: crontab -l -u www-data | { cat; printf "\n* * * * * COMMAND\n"; } | crontab -u www-data -

Troubleshooting

  1. Validation in PhpStorm is completed, but breakpoints don't work. In the Xdebug settings we have xdebug.remote_connect_back = 1, which means that Xdebug is automatically connecting to the same IP, from which the request has been sent. If validation in PhpStorm works, but there is no connection, it is necessary to check if the 9000 port is open on the host machine.

    The port can be opened via the ufw allow 9900 command.

  2. Also the PhpStorm configuration is to be checked:

Xdebug

Xdebug

treolabs-docker's People

Contributors

vancoding avatar alexukua avatar ania-vol avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.