Skip to content

Commit

Permalink
chore(#343): update gitpod setup (#346)
Browse files Browse the repository at this point in the history
* chore(#343): update gitpod config

* chore(#343): update gitpod ddev setup

* chore(#343): add welcome message

* chore(#343): update gitpod/drupal setup
  • Loading branch information
Decipher authored Oct 22, 2021
1 parent 6fdc2a7 commit b51dd16
Show file tree
Hide file tree
Showing 9 changed files with 1,073 additions and 147 deletions.
93 changes: 35 additions & 58 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,23 @@
image:
file: .gitpod/.gitpod.Dockerfile
file: .gitpod/Dockerfile

# ddev and composer are running as part of the prebuild
# when starting a workspace all docker images are ready
tasks:
- name: ddev/drupal
- before: git pull -f origin main:main
init: |
# drupal installation
.gitpod/download-ddev-images.sh
.gitpod/setup-drupal.sh
command: |
.gitpod/setup-ddev.sh
cd $GITPOD_REPO_ROOT/examples/drupal/drupal-9 && ddev start
gp sync-done ddev
- name: druxt/docs
init: |
# druxt/docs installation
gp sync-await build
cd $GITPOD_REPO_ROOT/docs && yarn
command: |
gp sync-await ddev
cd $GITPOD_REPO_ROOT/docs && BASE_URL=$(gp url 8080) yarn dev
# DDev prebuild tasks
.gitpod/scripts/ddev-download.sh
.gitpod/scripts/drupal-setup.sh
- name: druxt.js
before: git pull -f origin main:main
init: |
# druxt installation
# druxt.js build install and build
yarn install
yarn build
yarn build:docs
gp sync-done build
# druxtjs.org install
cd $GITPOD_REPO_ROOT/docs && yarn
cd $GITPOD_REPO_ROOT && yarn build:docs
command: |
.gitpod/scripts/ddev-setup.sh && clear
cat .gitpod/WELCOME.md
# VScode xdebug extension
vscode:
Expand All @@ -45,48 +32,38 @@ ports:
# Nuxt/Druxt
- port: 3000
visibility: public
# Drupal
# Drupal
- port: 8080
visibility: public
# Currently un-notified and unsupported mailhog http port
- port: 8025
onOpen: ignore
# Currently un-notified and unsupported mailhog https port
- port: 8026
onOpen: ignore
# Currently un-notified and unsupported phpmyadmin http port
- 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
onOpen: ignore
# router https port that we're ignoring.
- port: 8889
onOpen: ignore
# xdebug port
- port: 9000
onOpen: ignore
# projector port
- port: 9999
# Currently un-notified and unsupported mailhog http port
# - port: 8025
# onOpen: ignore
# # Currently un-notified and unsupported mailhog https port
# - port: 8026
# onOpen: ignore
# # Currently un-notified and unsupported phpmyadmin http port
# - 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
# onOpen: ignore
# # router https port that we're ignoring.
# - port: 8889
# onOpen: ignore
# # xdebug port
# - port: 9000
# onOpen: ignore

github:
prebuilds:
# enable for the master/default branch (defaults to true)
master: true
# enable for all branches in this repo (defaults to false)
branches: true
# enable for pull requests coming from this repo (defaults to true)
pullRequests: true
# enable for pull requests coming from forks (defaults to false)
pullRequestsFromForks: true
# add a check to pull requests (defaults to true)
addCheck: true
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
addComment: false
# add a "Review in Gitpod" button to the pull request's description (defaults to false)
addBadge: true
# add a label once the prebuild is ready to pull requests (defaults to false)
addLabel: true
9 changes: 1 addition & 8 deletions .gitpod/.gitpod.Dockerfile → .gitpod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@ RUN sudo apt-get -qq update
# Install ddev
RUN brew update && brew install drud/ddev/ddev

# Install GitUI (terminal-ui for git)
RUN brew install gitui

# Install latest composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
RUN php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
RUN sudo php composer-setup.php --install-dir /usr/bin --filename composer
RUN php -r "unlink('composer-setup.php');"

###
### Initiate a rebuild of Gitpod's image by updating this comment #1
###
18 changes: 18 additions & 0 deletions .gitpod/WELCOME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

██████╗ ██████╗ ██╗ ██╗██╗ ██╗████████╗ ██╗███████╗
██╔══██╗██╔══██╗██║ ██║╚██╗██╔╝╚══██╔══╝ ██║██╔════╝
██║ ██║██████╔╝██║ ██║ ╚███╔╝ ██║ ██║███████╗
██║ ██║██╔══██╗██║ ██║ ██╔██╗ ██║ ██ ██║╚════██║
██████╔╝██║ ██║╚██████╔╝██╔╝ ██╗ ██║██╗╚█████╔╝███████║
╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚════╝ ╚══════╝

# Welcome to the DruxtJS Gitpod development environment

To get started you can do one of the following tasks:
- Run the Druxt build tools: `yarn build --watch`
- Run the Druxt test suite: `yarn test --watch`
- Generate Druxt documetation: `yarn build:docs`
- Start the DruxtJS.org website: `cd docs && yarn dev`

Happy contributing.

Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#!/usr/bin/env bash
if [ -n "$DEBUG_DRUPALPOD" ]; then
set -x
fi

ddev version | awk '/(drud|phpmyadmin)/ {print $2;}' >/tmp/images.txt
while IFS= read -r item
do
docker pull "$item"
done < <(cat /tmp/images.txt)
done < <(cat /tmp/images.txt)
38 changes: 38 additions & 0 deletions .gitpod/scripts/ddev-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
if [ -n "$DEBUG_DRUXTJS" ]; then
set -x
fi

# Set up ddev for use on gitpod

set -eu -o pipefail

DDEV_DIR="${GITPOD_REPO_ROOT}/examples/drupal/drupal-9/.ddev"
shortgpurl="${GITPOD_WORKSPACE_URL#'https://'}"

# Generate a config.gitpod.yaml that adds the gitpod
# proxied ports so they're known to ddev.

cat <<CONFIGEND > "${DDEV_DIR}"/config.gitpod.yaml
#ddev-gitpod-generated
bind_all_interfaces: true
host_webserver_port: 8080
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
5 changes: 3 additions & 2 deletions .gitpod/setup-drupal.sh → .gitpod/scripts/drupal-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ set -eu -o pipefail
DRUPAL_DIR="${GITPOD_REPO_ROOT}/examples/drupal/drupal-9"

# Set up DDEV
cd "$GITPOD_REPO_ROOT" && .gitpod/setup-ddev.sh
cd "$GITPOD_REPO_ROOT" && .gitpod/scripts/ddev-setup.sh

# Set up Drupal website
cd "$DRUPAL_DIR" && ddev start
cd "$DRUPAL_DIR" && ddev composer install
cd "$DRUPAL_DIR" && ddev drush si -y --account-pass=admin demo_umami
cd "$DRUPAL_DIR" && ddev drush -y en druxt
cd "$DRUPAL_DIR" && ddev drush "rap anonymous 'access druxt resources'"
cd "$DRUPAL_DIR" && ddev drush -y config:set jsonapi.settings read_only 0

cd "$DRUPAL_DIR" && ddev stop
75 changes: 0 additions & 75 deletions .gitpod/setup-ddev.sh

This file was deleted.

Loading

0 comments on commit b51dd16

Please sign in to comment.