Skip to content

Commit

Permalink
Merge pull request #1 from shaal/ddev-gitpod-update
Browse files Browse the repository at this point in the history
ddev v1.18.2 with native gitpod support
  • Loading branch information
BrianGilbert authored Feb 17, 2022
2 parents 7c04a30 + 53deb49 commit 549cc89
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 53 deletions.
26 changes: 10 additions & 16 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
image:
file: .gitpod/Dockerfile
image: drupalpod/drupalpod-gitpod-base:20211116-ready-made-envs

tasks:
- init: |
# Installing DDev and Drupal backend.
.gitpod/scripts/ddev-download-images.sh
.gitpod/scripts/ddev-setup.sh
.gitpod/scripts/drupal-setup.sh
# Installing Nuxt/Druxt frontend.
Expand Down Expand Up @@ -37,24 +35,20 @@ ports:
- port: 3003
onOpen: ignore
visibility: public

# Currently un-notified and unsupported mailhog http port
- port: 8025
# Used by ddev - local db clients
- port: 3306
onOpen: ignore
# Currently un-notified and unsupported mailhog https port
- port: 8026
# Used by MailHog
- port: 8027
onOpen: ignore
# Currently un-notified and unsupported phpmyadmin http port
# Used by phpMyAdmin
- port: 8036
onOpen: ignore
# Currently un-notified and unsupported phpmyadmin https port
- port: 8037
onOpen: ignore
# router http port that we're ignoring.
- port: 8888
# Direct-connect ddev-webserver port that is the main port
- port: 8080
onOpen: ignore
# router https port that we're ignoring.
- port: 8889
# Ignore host https port
- port: 8443
onOpen: ignore
# xdebug port
- port: 9000
Expand Down
42 changes: 5 additions & 37 deletions .gitpod/scripts/ddev-setup.sh
Original file line number Diff line number Diff line change
@@ -1,45 +1,13 @@
#!/usr/bin/env bash

# Download ddev's images
ddev debug download-images

# Set up ddev for use on gitpod
DRUPAL_DIR="${GITPOD_REPO_ROOT}/drupal"
DDEV_DIR="${DRUPAL_DIR}/.ddev"

# Generate a config.gitpod.yaml that adds the gitpod
# proxied ports so they're known to ddev.
shortgpurl="${GITPOD_WORKSPACE_URL#'https://'}"

cat <<CONFIGEND > "${DDEV_DIR}"/config.gitpod.yaml
#ddev-gitpod-generated
php_version: "7.4"
bind_all_interfaces: true
host_webserver_port: 8080
# Will ignore the direct-bind https port, which will land on 2222
host_https_port: 2222
# Allows local db clients to run
host_db_port: 3306
# Assign MailHog port
host_mailhog_port: 8025
# Assign phpMyAdmin port
host_phpmyadmin_port: 8036
CONFIGEND

# We need host.docker.internal inside the container,
# So add it via docker-compose.host-docker-internal.yaml
hostip=$(awk "\$2 == \"$HOSTNAME\" { print \$1; }" /etc/hosts)

cat <<COMPOSEEND >"${DDEV_DIR}"/docker-compose.host-docker-internal.yaml
#ddev-gitpod-generated
version: "3.6"
services:
web:
environment:
- DRUSH_OPTIONS_URI=$(gp url 8080)
extra_hosts:
- "host.docker.internal:${hostip}"
COMPOSEEND

# Misc housekeeping before start
ddev config global --instrumentation-opt-in=true --omit-containers=ddev-router
ddev config global --instrumentation-opt-in=true

# Start ddev
cd $DRUPAL_DIR && ddev start
cd $DRUPAL_DIR && ddev start -y

0 comments on commit 549cc89

Please sign in to comment.