Skip to content

Commit bd20713

Browse files
authored
1 parent c57eb3a commit bd20713

File tree

4 files changed

+170
-0
lines changed

4 files changed

+170
-0
lines changed

dev/docker-dde/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# OpenMage Docker-Dev-Environment
2+
3+
## Prerequisites
4+
- Install [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/)
5+
- Install [DDE](https://github.com/sandstein/docker-dev-environment)
6+
- Port 80 on your host must be unused
7+
8+
## Install
9+
10+
### Docker containers
11+
- copy `dev/docker-dde/config/.env-sample` to `.env` and adjust it to load all containers you need
12+
- __Note:__ when changing the php version you need to modify virtual host file too
13+
14+
### Apache VHOST
15+
16+
- copy `dev/docker-dde/config/openmage.conf` to `<path_to_dde>/config/apache-24/conf.d`
17+
18+
If you have successfully installed DDE start your containers with
19+
20+
```bash
21+
$ dde-start
22+
```
23+
24+
### Initial setup
25+
To install OpenMage run
26+
27+
```bash
28+
$ dde-cli dev/docker-dde/init-dev-environment.sh
29+
```
30+
31+
### Final steps
32+
- install with or w/o sample data
33+
- set your admin credentials
34+
- open [http://openmage.localhost](openmage.localhost)
35+
36+
#### Recommendation
37+
38+
- add `mailhog` to `.env`
39+
- use a [SMTP-extension](https://github.com/aschroder/Magento-SMTP-Pro-Email-Extension])
40+
- host: mailhog
41+
- port: 1025
42+
- check you mails at [http://mailhog.localhost](mailhog.localhost)

dev/docker-dde/config/.env.sample

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
####################################################################
2+
#
3+
# Put this document as .env in the root directory of your project
4+
# and modify the variables. Additional variables will be set for
5+
# your docker dev environment commands
6+
#
7+
####################################################################
8+
9+
#
10+
# which path has to be appended to /var/www/vhosts in order
11+
# to reach the project root. So if your current project is
12+
# located at ~/workspace/<path> and your workpace is directly
13+
# linked into docker-dev-environment then <path> is your choice
14+
#
15+
# eg. PROJECT_ROOT=magento1/openmage
16+
#
17+
PROJECT_ROOT=
18+
#
19+
# which containers should be started
20+
# use comma separated list
21+
# used by docker-start
22+
#
23+
# eg. DOCKER_CONTAINER=apache-24,mysql-80,mailhog
24+
#
25+
DOCKER_CONTAINER=
26+
#
27+
# which phpversion is used in project
28+
#
29+
# e.g. PHP_FMP_CONTAINER=php-fpm-74
30+
#
31+
PHP_FPM_CONTAINER=
32+
#
33+
# which container is used to execute the php commands
34+
# used by e.g. bin/docker-composer
35+
#
36+
# eg. PHP_CLI_CONTAINER=php-cli-74
37+
#
38+
PHP_CLI_CONTAINER=

dev/docker-dde/config/openmage.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<VirtualHost "*:80">
2+
ServerName openmage.localhost
3+
DocumentRoot "${WORKSPACE}/magento1/openmage"
4+
USE PHP74 "${WORKSPACE}/magento1/openmage"
5+
</VirtualHost>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
3+
#
4+
# docker settings which can be modified if desired
5+
#
6+
DB_SCHEMA=openmage
7+
8+
#
9+
# docker settings which should not be altered
10+
#
11+
DB_HOST=mysql-80
12+
PROJECT_DIR=$(realpath "$(dirname "$0")"/../..)
13+
14+
#
15+
# init database
16+
#
17+
echo "Initialising database"
18+
echo "CREATE SCHEMA IF NOT EXISTS \`${DB_SCHEMA}\` DEFAULT CHARACTER SET utf8;" | mysql -u root -h ${DB_HOST}
19+
20+
#
21+
# install dependencies
22+
#
23+
echo "Installing dependencies"
24+
cd "${PROJECT_DIR}" || exit
25+
composer install --prefer-source
26+
27+
read -r -p "Install sample data? [y/N]" INSTALL_SAMPLE_DATA
28+
INSTALL_SAMPLE_DATA=${INSTALL_SAMPLE_DATA,,} # to lower
29+
if [[ $INSTALL_SAMPLE_DATA =~ ^(yes|y) ]]; then
30+
if [[ ! -d "${PROJECT_DIR}/backups" ]]; then
31+
echo "Creating backup directory"
32+
mkdir -p "${PROJECT_DIR}/backups"
33+
fi
34+
cd "${PROJECT_DIR}/backups" || exit
35+
if [[ ! -f "${PROJECT_DIR}/backups/magento-sample-data-1.9.2.4.zip" ]]; then
36+
echo "Downloading sample data"
37+
wget https://github.com/sreichel/magento-1-compressed-sample-data/raw/master/magento-sample-data-1.9.2.4.zip
38+
fi
39+
echo "Uncompress sample data"
40+
unzip magento-sample-data-1.9.2.4.zip;
41+
echo "Copy sample data"
42+
cp -r magento-sample-data-1.9.2.4/* "${PROJECT_DIR}/";
43+
echo "Import sample data"
44+
mysql -u root -h ${DB_HOST} ${DB_SCHEMA} < "${PROJECT_DIR}/backups/magento-sample-data-1.9.2.4/magento_sample_data_for_1.9.2.4.sql"
45+
echo "Remove sample data"
46+
rm -rf magento-sample-data-1.9.2.4;
47+
fi
48+
49+
cd "${PROJECT_DIR}" || exit
50+
read -r -p "Admin user [admin]:" ADMIN_USER
51+
ADMIN_USER=${ADMIN_USER:-admin}
52+
read -r -p "Admin firstname [John]:" ADMIN_FIRSTNAME
53+
ADMIN_FIRSTNAME=${ADMIN_FIRSTNAME:-John}
54+
read -r -p "Admin lastname [Doe]:" ADMIN_LASTNAME
55+
ADMIN_LASTNAME=${ADMIN_FIRSTNAME:-Doe}
56+
read -r -p "Admin email [admin@example.com]:" ADMIN_EMAIL
57+
ADMIN_EMAIL=${ADMIN_EMAIL:-admin@example.com}
58+
read -r -p "Admin password [password123password123]:" ADMIN_PASSWORD
59+
ADMIN_PASSWORD=${ADMIN_PASSWORD:-password123password123}
60+
61+
php -f install.php -- \
62+
--license_agreement_accepted 'yes' \
63+
--locale 'de_DE' \
64+
--timezone 'Europe/Berlin' \
65+
--db_host ${DB_HOST} \
66+
--db_name ${DB_SCHEMA} \
67+
--db_user 'root' \
68+
--db_pass '' \
69+
--db_prefix '' \
70+
--url 'http://openmage.localhost/' \
71+
--use_rewrites 'yes' \
72+
--use_secure 'no' \
73+
--secure_base_url '' \
74+
--use_secure_admin 'no' \
75+
--admin_username "${ADMIN_USER}" \
76+
--admin_lastname "${ADMIN_LASTNAME}" \
77+
--admin_firstname "${ADMIN_FIRSTNAME}" \
78+
--admin_email "${ADMIN_EMAIL}" \
79+
--admin_password "${ADMIN_PASSWORD}" \
80+
--session_save 'files' \
81+
--admin_frontname 'admin' \
82+
--backend_frontname 'admin' \
83+
--default_currency 'EUR' \
84+
--skip_url_validation 'yes'
85+

0 commit comments

Comments
 (0)