|
1 | | -OpenMage Stack |
2 | | -=== |
3 | | - |
4 | | -With these stack configuration files you can have a fully operational OpenMage LTS development in ONE step! |
5 | | -Upgrade it to production with just a few more easy steps! |
6 | | - |
7 | | -**NOTE: Use at your own risk! No warrants or guarantees are provided as to the stability, security or general quality of these environment files.** |
8 | | - |
9 | | -For a more robust development environment that supports https, please consider using [ddev](https://ddev.readthedocs.io/en/stable/users/cli-usage/#magento-1-quickstart). |
10 | | - |
11 | | -## Prerequisites |
12 | | - |
13 | | -- Install [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) |
14 | | -- Port 80 on your host must be unused. See [Environment Variables](#environment-variables) below if you need to use another port. |
15 | | -- Clone the OpenMage LTS repo to your location of choice (`git clone https://github.com/OpenMage/magento-lts.git`). |
16 | | - |
17 | | -## Installation |
18 | | - |
19 | | -Run `dev/openmage/install.sh`. That's it! |
20 | | - |
21 | | -Visit [http://openmage-7f000001.nip.io/](http://openmage-7f000001.nip.io/) and start coding! |
22 | | - |
23 | | -Tips |
24 | | -=== |
25 | | - |
26 | | -See [colinmollenhour/docker-openmage](https://github.com/colinmollenhour/docker-openmage) for more information |
27 | | -on the containers used in this setup, but here are some quick tips: |
28 | | - |
29 | | -- You can start the cron task using `docker-compose up -d cron`. |
30 | | -- The `cli` service contains many useful tools like `composer`, `magerun`, `modman`, `mageconfigsync` and more. |
31 | | -- XDebug is enabled using `remote_connect_back=1` with `idekey=phpstorm`. Customize this in `.env` if needed as described below. |
32 | | - |
33 | | -Here are some common commands you may wish to try (from the `dev/openmage` directory): |
34 | | - |
35 | | -``` |
36 | | -$ docker-compose run --rm -u $(id -u):$(id -g) cli composer show |
37 | | -$ docker-compose run --rm -u $(id -u):$(id -g) cli bash |
38 | | -$ docker-compose run --rm cli magerun sys:check |
39 | | -$ docker-compose run --rm cli magerun cache:clean |
40 | | -$ docker-compose run --rm cli magerun db:console |
41 | | -$ docker-compose exec mysql mysql |
42 | | -``` |
43 | | - |
44 | | -- *The cli container runs as `www-data` by default so use `-u $(id -u):$(id -g)` with composer so that the container will create/modify files with your user permissions to avoid file permission errors in your IDE.* |
45 | | -- *Always use `run --rm` with the cli container to avoid creating lots of orphan containers.* |
46 | | - |
47 | | -Environment Variables |
48 | | ---- |
49 | | - |
50 | | -You can override some defaults using environment variables defined in a file (that you must create) at `dev/openmage/.env`. |
51 | | - |
52 | | -- `ENABLE_SENDMAIL=true` - Enable the sendmail MTA |
53 | | -- `XDEBUG_CONFIG=...` - Override the default XDebug config |
54 | | -- `HOST_NAME=your-preferred-hostname` |
55 | | - - `openmage-7f000001.nip.io` is used by default to resolve to `127.0.0.1`. See [nip.io](https://nip.io) for more info. |
56 | | -- `HOST_PORT=8888` |
57 | | - - `80` is used by default |
58 | | -- `ADMIN_HOST_NAME` |
59 | | - - `openmage-admin-7f000001.nip.io` is used by default to resolve to `127.0.0.1`. See [nip.io](https://nip.io) for more info. |
60 | | -- `ADMIN_HOST_PORT` |
61 | | - - `81` is used by default to avoid conflicts with the frontend port |
62 | | -- `ADMIN_EMAIL` |
63 | | -- `ADMIN_USERNAME` |
64 | | -- `ADMIN_PASSWORD` (must be 14 characters or more) |
65 | | -- `ADMIN_FIRSTNAME` |
66 | | -- `ADMIN_LASTNAME` |
67 | | -- `MAGE_IS_DEVELOPER_MODE` |
68 | | - - `1` is used by default, set to `0` to disable |
69 | | -- `CURRENCY` |
70 | | - - `USD` is used by default |
71 | | -- `LOCALE` |
72 | | - - `en-US` is used by default |
73 | | -- `TIMEZONE` |
74 | | - - `America/New_York` is used by default |
75 | | -- `MYSQL_PORT` |
76 | | - - `3306` is used by default |
77 | | -- `PM_MAX_CHILDREN` - Tune to your environment and needs - see [PHP-FPM configuration](https://www.php.net/manual/en/install.fpm.configuration.php) |
78 | | -- `PM_START_SERVERS` |
79 | | -- `PM_MIN_SPARE_SERVERS` |
80 | | -- `PM_MAX_SPARE_SERVERS` |
81 | | - |
82 | | -Wiping |
83 | | ---- |
84 | | - |
85 | | -If you want to start fresh, wipe out your installation with the following command: |
86 | | - |
87 | | -``` |
88 | | -$ docker-compose down --volumes && rm -f ../../app/etc/local.xml |
89 | | -``` |
90 | | - |
91 | | -HTTPS / Production |
92 | | -===== |
93 | | - |
94 | | -You can easily have a multi-store SSL-protected environment using Docker with the `docker-compose-production.yml` file. |
95 | | - |
96 | | -Features included out of the box: |
97 | | - |
98 | | -- Free and automatic SSL provided by [Caddy](https://caddyserver.com/docs/caddyfile) |
99 | | -- Separate domains for frontend and admin sites |
100 | | -- Examples included for redirects, Basic Auth, multi-store routing |
101 | | -- Easily add routes to your other sites |
102 | | -- Root static assets (e.g. robots.txt) in a separate directory for each store view |
103 | | - |
104 | | -**Do not try to run a dev environment and a production environment from the same working copy!** |
105 | | - |
106 | | -If using OpenMage as a composer dependency, to avoid files being overwritten by composer upon updating OpenMage, |
107 | | -it is recommended to copy the following files into your own project root and modify them as needed: |
108 | | - |
109 | | -- `dev/openmage/docker-compose-production.yml` --> `docker-compose.yml` |
110 | | -- `dev/openmage/nginx-admin.conf` --> `nginx-admin.conf` |
111 | | -- `dev/openmage/nginx-frontend.conf` --> `nginx-frontend.conf` |
112 | | -- `dev/openmage/Caddyfile-sample` --> `Caddyfile` |
113 | | -- `pub/admin/` --> `static/admin/` |
114 | | -- `pub/default/{favicon.ico,robots.txt}` --> `static/default/` |
115 | | - |
116 | | -Then perform the following steps: |
117 | | - |
118 | | -1. `echo "COMPOSE_FILE=docker-compose-production.yml" >> .env` to make the production stack the default |
119 | | -1. Add `BASE_URL` and `ADMIN_URL` to your `.env` file |
120 | | -1. `cp Caddyfile-sample Caddyfile` and edit the `Caddyfile` to reflect your domain names and Magento store codes |
121 | | -1. If you did not hard-code your admin domain name in `Caddyfile` edit `.env` and make sure it includes `ADMIN_HOST_NAME` |
122 | | -1. Run `docker-compose up -d` to launch your new production-ready environment! |
123 | | -1. Load your existing database into the MySQL container volume and copy an existing `local.xml` file into the `app/etc/` subdirectory of your OpenMage root (e.g. `pub/app/etc/local.xml` for composer installations with default `magento-root-dir`). |
124 | | - 1. OR copy `dev/openmage/install.sh` into your root directory and run it to create a fresh installation. |
125 | | - |
126 | | -Environment variables supported by the `docker-compose-production.yml` file and `install.sh` which may be set in `.env` |
127 | | -when installing a new production environment: |
128 | | - |
129 | | -- `SRC_DIR=./pub` - relative path to the OpenMage root - corresponds to the composer `magento-root-dir` |
130 | | -- `STATIC_DIR=./static` - relative path to the directory which contains custom static files to be served from the root - must contain a subdirectory for `admin` and each store view. |
131 | | -- `BASE_URL=https://frontend.example.com/` (overrides `HOST_NAME` and `HOST_PORT`) |
132 | | -- `ADMIN_URL=https://backend.exmaple.com/` (overrides `ADMIN_HOST_NAME` and `ADMIN_HOST_PORT`) |
133 | | - |
134 | | -**Backups, intrusion protection and other security features are not provided and are left up to you! This is simply a |
135 | | -web server configuration that adds an easy to configure and maintain SSL termination.** |
136 | | - |
137 | | -### Adding more store views |
138 | | - |
139 | | -1. Create your new website and/or store codes in OpenMage. |
140 | | -2. Create new root static asset directories in your static asset directory such as `static/store1`, `static/store2`, etc... |
141 | | -3. Edit `Caddyfile` to map your domain name to the appropriate `runcode` and `runtype`. |
142 | | -4. Configure the URLs in the System > Configuration. |
143 | | -5. Set up your DNS and relaunch Caddy (`docker compose restart caddy`). |
144 | | - |
145 | | -Mapping paths to different stores can be done using additional `reverse_proxy` declarations. See `@customfrontend` as an example. |
| 1 | +Please visit the [official documentation](https://docs.openmage.org/developers/tools/oneline/) for more information. |
0 commit comments