Skip to content

Commit 1c9f198

Browse files
authored
add initial working gitpod configuration (#1836)
1 parent 8b9bfae commit 1c9f198

File tree

4 files changed

+136
-0
lines changed

4 files changed

+136
-0
lines changed

.gitpod.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/
2+
tasks:
3+
- init: echo 'init script' # runs during prebuild
4+
command: echo 'start script'
5+
- name: Install OpenMage
6+
init: |
7+
BASE_URL="$(echo "$GITPOD_WORKSPACE_URL" | sed s~https://~https://8000-~)"
8+
HOST_PORT=8000 BASE_URL=$BASE_URL bash dev/gitpod/install.sh
9+
command: docker ps
10+
openMode: tab-after
11+
- name: prepare git
12+
init: git config core.fileMode false
13+
14+
vscode:
15+
extensions:
16+
- bmewburn.vscode-intelephense-client
17+
18+
# List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/
19+
ports:
20+
- port: 8000
21+
visibility: public
22+
onOpen: open-preview

dev/gitpod/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
docker-magento/
2+
.env

dev/gitpod/docker-compose.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
version: "3.7"
2+
3+
services:
4+
apache:
5+
image: openmage/php-dev:7.3-apache
6+
hostname: ${HOST_NAME:-openmage-7f000001.nip.io}
7+
user: "33333:33333"
8+
ports:
9+
- "${HOST_PORT:-80}:80"
10+
volumes:
11+
- ../..:/var/www/html
12+
environment:
13+
- ENABLE_SENDMAIL=true
14+
- XDEBUG_CONFIG=remote_connect_back=1 remote_enable=1 idekey=phpstorm
15+
- MAGE_IS_DEVELOPER_MODE=1
16+
links:
17+
- mysql
18+
19+
cron:
20+
image: openmage/php-dev:7.3-cli
21+
working_dir: /var/www/html
22+
command: /run-cron.sh
23+
user: www-data
24+
volumes:
25+
- ../..:/var/www/html
26+
environment:
27+
- ENABLE_SENDMAIL=true
28+
links:
29+
- mysql
30+
31+
cli:
32+
image: openmage/php-dev:7.3-apache
33+
working_dir: /var/www/html
34+
command: /bin/true
35+
user: "33333:33333"
36+
volumes:
37+
- ../..:/var/www/html
38+
# environment:
39+
# - AWS_ACCESS_KEY_ID=00000000000000000000
40+
# - AWS_SECRET_ACCESS_KEY=0000000000000000000000000000000000000000
41+
# - AWS_REGION=eu-west-1
42+
# - AWS_BUCKET=magedbm
43+
# - AWS_MEDIA_BUCKET=magemm
44+
links:
45+
- mysql
46+
- "apache:${HOST_NAME:-openmage-7f000001.nip.io}"
47+
48+
mysql:
49+
image: mysql:5.7
50+
ports:
51+
- 3306
52+
command: --default-authentication-plugin=mysql_native_password
53+
environment:
54+
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
55+
- MYSQL_USER=openmage
56+
- MYSQL_PASSWORD=openmage
57+
- MYSQL_DATABASE=openmage
58+
volumes:
59+
- mysql:/var/lib/mysql
60+
61+
volumes:
62+
mysql:

dev/gitpod/install.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
set -e
3+
dir=$(dirname "${BASH_SOURCE[0]}")
4+
cd $dir
5+
test -f .env && source .env
6+
7+
chmod 777 ../../app/etc ../../media ../../var
8+
9+
docker-compose up -d mysql apache
10+
sleep 4
11+
# mostly a copy from the openmage directory
12+
echo "Starting services..."
13+
for i in $(seq 1 20); do
14+
sleep 1
15+
docker exec openmage_mysql_1 mysql -e 'show databases;' 2>/dev/null | grep -qF 'openmage' && break
16+
done
17+
18+
HOST_PORT_PART=":${HOST_PORT:-80}"
19+
test "$HOST_PORT_PART" = ":80" && HOST_PORT_PART=""
20+
BASE_URL=${BASE_URL:-"http://${HOST_NAME:-openmage-7f000001.nip.io}${HOST_PORT_PART}/"}
21+
ADMIN_EMAIL="${ADMIN_EMAIL:-admin@example.com}"
22+
ADMIN_USERNAME="${ADMIN_USERNAME:-admin}"
23+
ADMIN_PASSWORD="${ADMIN_PASSWORD:-veryl0ngpassw0rd}"
24+
25+
echo "Installing OpenMage LTS..."
26+
docker-compose run --rm cli php install.php \
27+
--license_agreement_accepted yes \
28+
--locale en_US \
29+
--timezone America/New_York \
30+
--default_currency USD \
31+
--db_host mysql \
32+
--db_name openmage \
33+
--db_user openmage \
34+
--db_pass openmage \
35+
--url "$BASE_URL" \
36+
--use_rewrites yes \
37+
--use_secure no \
38+
--secure_base_url "$BASE_URL" \
39+
--use_secure_admin no \
40+
--skip_url_validation \
41+
--admin_firstname OpenMage \
42+
--admin_lastname User \
43+
--admin_email "$ADMIN_EMAIL" \
44+
--admin_username "$ADMIN_USERNAME" \
45+
--admin_password "$ADMIN_PASSWORD"
46+
47+
echo ""
48+
echo "Setup is complete!"
49+
echo "Visit ${BASE_URL}admin and login with '$ADMIN_USERNAME' : '$ADMIN_PASSWORD'"
50+
echo "MySQL server IP: $(docker exec openmage_apache_1 getent hosts mysql | awk '{print $1}')"

0 commit comments

Comments
 (0)