Skip to content

Commit

Permalink
add initial working gitpod configuration (#1836)
Browse files Browse the repository at this point in the history
  • Loading branch information
Flyingmana authored Nov 6, 2021
1 parent 8b9bfae commit 1c9f198
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/
tasks:
- init: echo 'init script' # runs during prebuild
command: echo 'start script'
- name: Install OpenMage
init: |
BASE_URL="$(echo "$GITPOD_WORKSPACE_URL" | sed s~https://~https://8000-~)"
HOST_PORT=8000 BASE_URL=$BASE_URL bash dev/gitpod/install.sh
command: docker ps
openMode: tab-after
- name: prepare git
init: git config core.fileMode false

vscode:
extensions:
- bmewburn.vscode-intelephense-client

# List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/
ports:
- port: 8000
visibility: public
onOpen: open-preview
2 changes: 2 additions & 0 deletions dev/gitpod/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker-magento/
.env
62 changes: 62 additions & 0 deletions dev/gitpod/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
version: "3.7"

services:
apache:
image: openmage/php-dev:7.3-apache
hostname: ${HOST_NAME:-openmage-7f000001.nip.io}
user: "33333:33333"
ports:
- "${HOST_PORT:-80}:80"
volumes:
- ../..:/var/www/html
environment:
- ENABLE_SENDMAIL=true
- XDEBUG_CONFIG=remote_connect_back=1 remote_enable=1 idekey=phpstorm
- MAGE_IS_DEVELOPER_MODE=1
links:
- mysql

cron:
image: openmage/php-dev:7.3-cli
working_dir: /var/www/html
command: /run-cron.sh
user: www-data
volumes:
- ../..:/var/www/html
environment:
- ENABLE_SENDMAIL=true
links:
- mysql

cli:
image: openmage/php-dev:7.3-apache
working_dir: /var/www/html
command: /bin/true
user: "33333:33333"
volumes:
- ../..:/var/www/html
# environment:
# - AWS_ACCESS_KEY_ID=00000000000000000000
# - AWS_SECRET_ACCESS_KEY=0000000000000000000000000000000000000000
# - AWS_REGION=eu-west-1
# - AWS_BUCKET=magedbm
# - AWS_MEDIA_BUCKET=magemm
links:
- mysql
- "apache:${HOST_NAME:-openmage-7f000001.nip.io}"

mysql:
image: mysql:5.7
ports:
- 3306
command: --default-authentication-plugin=mysql_native_password
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_USER=openmage
- MYSQL_PASSWORD=openmage
- MYSQL_DATABASE=openmage
volumes:
- mysql:/var/lib/mysql

volumes:
mysql:
50 changes: 50 additions & 0 deletions dev/gitpod/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
set -e
dir=$(dirname "${BASH_SOURCE[0]}")
cd $dir
test -f .env && source .env

chmod 777 ../../app/etc ../../media ../../var

docker-compose up -d mysql apache
sleep 4
# mostly a copy from the openmage directory
echo "Starting services..."
for i in $(seq 1 20); do
sleep 1
docker exec openmage_mysql_1 mysql -e 'show databases;' 2>/dev/null | grep -qF 'openmage' && break
done

HOST_PORT_PART=":${HOST_PORT:-80}"
test "$HOST_PORT_PART" = ":80" && HOST_PORT_PART=""
BASE_URL=${BASE_URL:-"http://${HOST_NAME:-openmage-7f000001.nip.io}${HOST_PORT_PART}/"}
ADMIN_EMAIL="${ADMIN_EMAIL:-admin@example.com}"
ADMIN_USERNAME="${ADMIN_USERNAME:-admin}"
ADMIN_PASSWORD="${ADMIN_PASSWORD:-veryl0ngpassw0rd}"

echo "Installing OpenMage LTS..."
docker-compose run --rm cli php install.php \
--license_agreement_accepted yes \
--locale en_US \
--timezone America/New_York \
--default_currency USD \
--db_host mysql \
--db_name openmage \
--db_user openmage \
--db_pass openmage \
--url "$BASE_URL" \
--use_rewrites yes \
--use_secure no \
--secure_base_url "$BASE_URL" \
--use_secure_admin no \
--skip_url_validation \
--admin_firstname OpenMage \
--admin_lastname User \
--admin_email "$ADMIN_EMAIL" \
--admin_username "$ADMIN_USERNAME" \
--admin_password "$ADMIN_PASSWORD"

echo ""
echo "Setup is complete!"
echo "Visit ${BASE_URL}admin and login with '$ADMIN_USERNAME' : '$ADMIN_PASSWORD'"
echo "MySQL server IP: $(docker exec openmage_apache_1 getent hosts mysql | awk '{print $1}')"

0 comments on commit 1c9f198

Please sign in to comment.