{"id":20320195,"url":"https://github.com/julienloizelet/docker-openmage","last_synced_at":"2025-03-04T09:26:22.135Z","repository":{"id":107782918,"uuid":"278270495","full_name":"julienloizelet/docker-openmage","owner":"julienloizelet","description":"Docker compose for OpenMage development environment","archived":false,"fork":false,"pushed_at":"2020-12-15T11:17:51.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T13:33:12.242Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/julienloizelet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-09T05:22:06.000Z","updated_at":"2022-02-12T20:08:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"c7a89053-ffb5-41a2-9a8b-5ffa8474bc20","html_url":"https://github.com/julienloizelet/docker-openmage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julienloizelet%2Fdocker-openmage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julienloizelet%2Fdocker-openmage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julienloizelet%2Fdocker-openmage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julienloizelet%2Fdocker-openmage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/julienloizelet","download_url":"https://codeload.github.com/julienloizelet/docker-openmage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241820724,"owners_count":20025598,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T18:49:16.964Z","updated_at":"2025-03-04T09:26:22.115Z","avatar_url":"https://github.com/julienloizelet.png","language":"Shell","readme":"# Docker for OpenMage Project\n\u003e Use it to manage an OpenMage project with docker and docker-compose.\n\u003e\n\u003eOriginally forked from [andreaskoch/dockerized-magento](https://github.com/andreaskoch/dockerized-magento).\n\n\nTable of Contents\n=================\n\n   * [Docker for OpenMage Project](#docker-for-openmage-project)\n      * [Installing / Getting started](#installing--getting-started)\n         * [Requirements](#requirements)\n            * [Use Linux](#use-linux)\n            * [Install Docker and docker-compose](#install-docker-and-docker-compose)\n            * [Add the domain name](#add-the-domain-name)\n         * [Installation](#installation)\n            * [First build](#first-build)\n            * [OpenMage installation](#openmage-installation)\n               * [Option 1) : Quick install](#option-1--quick-install)\n               * [Option 2) : Custom sources install](#option-2--custom-sources-install)\n               * [Option 3) : Full custom install](#option-3--full-custom-install)\n      * [Usage](#usage)\n         * [Components Overview](#components-overview)\n         * [Custom Configuration](#custom-configuration)\n         * [Changing the domain name](#changing-the-domain-name)\n         * [Change the MySQL Root User Password](#change-the-mysql-root-user-password)\n         * [Working with X-debug and Phpstorm](#working-with-x-debug-and-phpstorm)\n         * [Working with my \u003ca href=\"https://github.com/julienloizelet/composer-magento1.git\"\u003eOpenMage installation based on composer\u003c/a\u003e](#working-with-my-openmage-installation-based-on-composer)\n      * [Troubleshooting](#troubleshooting)\n      * [Contributing](#contributing)\n      * [Licensing](#licensing)\n\nCreated by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)\n\n\n## Installing / Getting started\n\n### Requirements\n\n#### Use Linux\n\nI gave up using docker on Mac OS. Never tried on Windows OS.\n\n#### Install Docker and docker-compose\n\nIf you are on Linux you should install [docker and docker-compose](http://docs.docker.com/compose/install/)\n\n\n#### Add the domain name\n\nThe web-server will be bound to your local ports 80 and 443. By default, host is set to be `openmage.local`. \nSo, in order to access the shop you must add a hosts file entry for `openmage.local`.\n\nFor Linux Users, in order to access the shop you must add the domain name `openmage.local` to your hosts file (`/etc/hosts`).\nIf you are using docker **natively** you can use this command:\n\n```bash\nsudo su\necho \"127.0.0.1    openmage.local\" \u003e\u003e /etc/hosts\n```\n \n\n### Installation\n\nWe can divide the installation process in two step: `First build` and `OpenMage installation`. In the first step, you will have\nto create and modify a `docker-compose.override.yml` file and your modification will depend on the way you want to install OpenMage. \nSo please read the [OpenMage installation](#openmage-installation) paragraph to understand the 3 options you have.\n\n#### First build\n\n\n1. Create a  `docker-compose.override.yml` from the example `docker-compose.override.yml.dist` and make the necessary changes :\n   - If you want to use the quick install process : uncomment the two lines : `- ./openmage-sources/:/var/www/html/web/`\n   - If you want to use the custom install process or full custom install process : uncomment the two lines `- /some/path/for/your-project-sources/:/var/www/html/web/`\n   and replace the example path with your custom sources path.\n2. Start the projects using `sudo ./openmage start` (maybe you will have to do a `chmod +x openmage`).\n\n\n**Note**: The build process will take a while if you start the project for the first time. After that, starting and stopping the project will be a matter of seconds.\n\n#### OpenMage installation\n\nOnce you have created all your docker containers (i.e once the `sudo ./openmage start` command has finished), you have 3 options \nto have ready-to-use OpenMage project.\n\n##### Option 1) : Quick install\n\nThis option should be use to install and try OpenMage quickly.\n\ni) Ensure that all your volumes in your `docker-compose.override.yml` file are well configured : i.e `./openmage-sources/` \nwill be mount in `/var/www/html/web`.\n\nii) `sudo ./openmage install quick`\n\nThis command will:\n\n- download sources as specified by the `OPENMAGE_VERSION` environment variable (e.g `openmage-lts-1.9.4.x`) in the `openmage-sources` folder.\n- create a database with a name specified by the `DATABASE_NAME` environment variable (e.g `openmage`).\n- install the sample datas specified in the [magerun config file](conf/magerun/n98-magerun.yaml) (e.g `sample-data-1.9.2.4`).\n- Configure your OpenMage instance with default value of the magerun script and values of the [magerun config file](conf/magerun/n98-magerun.yaml).\n\nN.B : \n\n  - database must not exist prior to this quick install.\n\n  - source code must not exist in the `openmage-sources` folder prior to this quick install.\n      \n\n##### Option 2) : Custom sources install\n\nThis option should be use to install and try OpenMage with custom sources and no custom database.\nFor example, if you want to contribute to the OpenMage github project by submitting a merge request or reviewing an \nexisting one, you will be able to clone the project, switch to the branch you want test, and have ready-to-test OpenMage\ninstance.\n\ni)  Get your sources ready :\n We will assume sources are in a directory called `/some/path/for/your-project-sources` and that\nall your volumes in your `docker-compose.override.yml` file are well configured : i.e `/some/path/for/your-project-sources` will be mount in \n`/var/www/html/web`.\n\nii) `sudo ./openmage install custom`\n\nThis command will:\n\n- create a database with a name specified by the `DATABASE_NAME` environment variable (e.g `openmage`).\n- Configure your OpenMage instance with default value of the magerun script and values of the [magerun config file](conf/magerun/n98-magerun.yaml).\n\nN.B : \n  -  database will be re-created if already exists\n  \n  - `app/etc/local.xml` must not be present in your custom sources\n      \n\n##### Option 3) : Full custom install\n\nThis is a full manual installation because you already have a custom database and custom sources.\nFor example, you could use it if you have to manage an already existing Magento 1 or OpenMage project and someone gave you access\nto sources and database.\n\ni)  Get your sources ready :\n We will assume sources are in a directory called `/some/path/for/your-project-sources` and that all your volumes in \n your `docker-compose.override.yml` file are well configured : i.e `/some/path/for/your-project-sources` will be mount in \n `/var/www/html/web`.\n \nii) Get your database ready :\n   Copy a dump `yourdatabasedump.sql` in the path `data/dump`.\n\niii) Import the database\n- Create a `yourdatabase` database (a simple way is to use `phpmyadmin` by going to the url : `http://localhost:8081`)\n- We will the import the database with the following commands (use `pw` as root password when prompted.):\n```sudo ./openmage enter mysql\ncd /etc/dump\nmysql -u root -h localhost -p yourdatabase \u003c yourdatabase.sql\n```\niv) Modify the `app/etc/local.xml` file\n\nGo to the `/some/path/for/magento/sources` and edit the `app/etc/local.xml` file with the following content (replace `yourdatabase` name by yours):\n```\n\u003c?xml version=\"1.0\"?\u003e\n\u003cconfig\u003e\n    \u003cglobal\u003e\n        \u003cinstall\u003e\n            \u003cdate\u003e\u003c![CDATA[Sat, 11 Apr 2015 12:33:05 +0000]]\u003e\u003c/date\u003e\n        \u003c/install\u003e\n        \u003ccrypt\u003e\n            \u003ckey\u003e\u003c![CDATA[731aea833710535779fe8c7c49bc6c4d]]\u003e\u003c/key\u003e\n        \u003c/crypt\u003e\n        \u003cdisable_local_modules\u003efalse\u003c/disable_local_modules\u003e\n        \u003cresources\u003e\n            \u003cdb\u003e\n                \u003ctable_prefix\u003e\u003c![CDATA[]]\u003e\u003c/table_prefix\u003e\n            \u003c/db\u003e\n            \u003cdefault_setup\u003e\n                \u003cconnection\u003e\n                    \u003chost\u003e\u003c![CDATA[mysql]]\u003e\u003c/host\u003e\n                    \u003cusername\u003e\u003c![CDATA[root]]\u003e\u003c/username\u003e\n                    \u003cpassword\u003e\u003c![CDATA[pw]]\u003e\u003c/password\u003e\n                    \u003cdbname\u003e\u003c![CDATA[yourdatabase]]\u003e\u003c/dbname\u003e\n                    \u003cinitStatements\u003e\u003c![CDATA[SET NAMES utf8]]\u003e\u003c/initStatements\u003e\n                    \u003cmodel\u003e\u003c![CDATA[mysql4]]\u003e\u003c/model\u003e\n                    \u003ctype\u003e\u003c![CDATA[pdo_mysql]]\u003e\u003c/type\u003e\n                    \u003cpdoType\u003e\u003c![CDATA[]]\u003e\u003c/pdoType\u003e\n                    \u003cactive\u003e1\u003c/active\u003e\n                \u003c/connection\u003e\n            \u003c/default_setup\u003e\n        \u003c/resources\u003e\n        \u003csession_save\u003e\u003c![CDATA[files]]\u003e\u003c/session_save\u003e\n    \u003c/global\u003e\n    \u003cadmin\u003e\n        \u003crouters\u003e\n            \u003cadminhtml\u003e\n                \u003cargs\u003e\n                    \u003cfrontName\u003e\u003c![CDATA[admin]]\u003e\u003c/frontName\u003e\n                \u003c/args\u003e\n            \u003c/adminhtml\u003e\n        \u003c/routers\u003e\n    \u003c/admin\u003e\n\u003c/config\u003e\n```\n\n## Usage\n\nYou can control the project using the built-in `openmage`-script which is basically just a **wrapper for docker and docker-compose** that offers some **convenience features**:\n\n```bash\nsudo ./openmage \u003caction\u003e\n```\n\n**Available Actions**\n\n- **start**: Starts the docker containers\n- **stop**: Stops all docker containers\n- **restart**: Restarts all docker containers and flushes the cache\n- **status**: Prints the status of all docker containers\n- **stats**: Displays live resource usage statistics of all containers\n- **magerun**: Executes magerun in the magento root directory\n- **composer**: Executes composer in the magento root directory\n- **enter**: Enters the bash of a given container type (e.g. php, mysql, ...)\n- **destroy**: Stops all containers and removes all data\n- **install**: 2 possible options : \n   - quick (download OpenMage sources and create database with sample datas)\n   - custom : create an empty database (sources has to be specified manually)\n- **logs**: Show containers logs\n\n\n### Components Overview\n\nThe dockerized OpenMage project consists of the following components:\n\n- **[docker images](docker-images)**\n  1. a [PHP 7.3 FPM](docker-images/php7.3-fpm/Dockerfile) image with magerun, composer and xdebug enabled\n  1. a [Nginx 1.18](https://github.com/nginxinc/docker-nginx/blob/793319d7251c03eccecbf27b60e0cfbbd2d1f400/stable/buster/Dockerfile) image\n  1. a [MySQL 5.7](https://hub.docker.com/_/mysql/) database server image\n  1. a [phpMyAdmin](https://hub.docker.com/r/phpmyadmin/phpmyadmin/) image that allows you to access the database on port 8080\n  1. a [Maildev](https://hub.docker.com/r/maildev/maildev) image to prevent sending email on test environnment.\n- a **[shell script](openmage)** for controlling the project: [`./openmage \u003caction\u003e`](openmage)\n- and the [docker-compose.yml](docker-compose.yml)-file which connects all components\n\n\n### Custom Configuration\n\nAll parameters of the OpenMage installation are defined via environment variables that are set in the [docker-compose.yml](docker-compose.yml) file - if you want to tailor the OpenMage Shop installation to your needs you can do so **by modifying the environment variables** before you start the project.\n\nIf you have started the shop before you must **repeat the installation process** in order to apply changes:\n\n1. Create a `docker-compose.override.yml` file from the example file `docker-compose.override.yml.dist`. \n2. Modify the parameters in the `docker-compose.override.yml`\n3. Shutdown the containers and remove all data (`sudo ./openmage destroy`)\n4. Start the containers again (`sudo ./openmage start`)\n\n### Changing the domain name\n\nI set the default domain name to `openmage.local`. To change the domain name, replace `openmage.local` with `your-domain.tld` in the `docker-compose.override.yml` file:\n\n```yaml\nnginx:\n  environment:\n    DOMAIN: your-domain.tld\n```\n\n### Change the MySQL Root User Password\n\nI chose a very weak passwords for the MySQL root-user. You can change it by modifying the respective environment variables for the **mysql-container** because otherwise the installation will fail:\n\n```yaml\nmysql:\n  environment:\n    MYSQL_ROOT_PASSWORD: \u003cyour-mysql-root-user-password\u003e\n```\n\n### Working with X-debug and Phpstorm\nHere is what I am doing to configure X-debug on Phpstorm (tested on 2020.1.1 version)\n1. First get your host local IP to put in your `docker-compose-override.yml`. (I obtain something like 172.19.0.1).\nFind the name of your php container with `sudo docker ps`. Then run `sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' php_container_name` to find it.\n2. Install and configure a plugin for Firefox or Chrome: (I use [Xdebug-ext](https://addons.mozilla.org/en-US/firefox/addon/xdebug-ext-quantum/))  \n   Go to Tools-\u003eAddons-\u003eExtensions-\u003eXdebug-ext and change your IDE-key : `phpstorm-xdebug`.\n3. Configure Phpstorm in Project Settings (where are the OpenMage sources) :\n  - Settings -\u003e Languages and Frameworks -\u003e PHP -\u003e Debug -\u003e Set the port (9000 for me)\n  - Settings -\u003e Languages and Frameworks -\u003e PHP -\u003e Servers : Add server with name `openmage.local` and configuration of your site (`host = openmage.local`)\n  and add the path mapping `/some/path/for/your-project-sources` to `/var/www/html/web`\n  - Go to Run-\u003eEdit configurations. Add \"PHP Remote Debug\" configuration, select your server (that you just added) and enter an IDE-key : `phpstorm-xdebug`.\n  - Select Run-\u003eDebug... and select your remote configuration name (as you named it above)\n  \n### Working with my [OpenMage installation based on composer](https://github.com/julienloizelet/composer-magento1.git)\n\nIf you are using composer with a repo like [mine](https://github.com/julienloizelet/composer-magento1.git) (i.e if you are me ...), beware that you have to create the `docker-compose.override.yml` with some specific volumes (see the `docker-compose.override.yml.dist` file).\nYou will then be able to run your composer commands once you will be in the `php` container :\n- On a fresh install : run the following commands : \n  - `sudo ./openmage start`.\n  - `sudo ./openmage enter php`\n  - `composer install`\n- As the `htdocs` folder is created at this moment, we have to restart container in order to have a functional volume (i.e a link between `htdocs` and `/var/www/html/web`).\nSo, just run `sudo ./openmage destroy` and then `sudo ./openmage start` again.\n  \n## Troubleshooting\n  - Before running the command `sudo ./openmage start `, you must stop all programs that are listening to port 80 or 443 (e.g apache or nginx). For example : `sudo service apache2 stop`\n\n  - On first `sudo ./openmage start`, you may have an error :\n`for nginx  Cannot start service nginx: oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"/bin/nginx.sh\\\": permission denied\"`\nWorkaround : before launch it again : `sudo chmod -R 777 bin`\n\n  - X-debug not working because of ufw firewall. Maybe you will have to open port 9000 on your machine if you are using ufw :\n  `sudo ufw allow from any to any port 9000 proto tcp comment xdebug`\n\n  \n\n## Contributing\nIf you'd like to contribute, please fork the repository and use a feature\nbranch. Pull requests are warmly welcome.\nIf you found any issue, please go [there](https://github.com/julienloizelet/docker-openmage/issues).\n\n## Licensing\n[GNU General Public License, version 3 (GPLv3)](http://opensource.org/licenses/gpl-3.0)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulienloizelet%2Fdocker-openmage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjulienloizelet%2Fdocker-openmage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulienloizelet%2Fdocker-openmage/lists"}