diff --git a/.gitpod.yml b/.gitpod.yml index 0a660359..fd120adc 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,10 +1,97 @@ -mainConfiguration: https://github.com/SU-SWS/ace-sulgryphon -github: - prebuilds: - master: true - branches: false - pullRequests: true - pullRequestsFromForks: false - addCheck: false - addComment: false - addBadge: true + +additionalRepositories: + - url: https://github.com/SU-SWS/ace-stanfordlagunita/ + checkoutLocation: back +checkoutLocation: front +ports: + - name: database + description: Mysql database + port: 3306 + onOpen: ignore + visibility: private + - port: 33060 + onOpen: ignore + visibility: private + - name: drupal + description: Drupal backend + port: 8001 + onOpen: ignore + visibility: public + - name: frontend + description: NextJS frontend + port: 3000 + onOpen: ignore + visibility: public + - port: 8002-9999 + onOpen: ignore +image: pookmish/drupal8ci:gitpod +tasks: + - name: Drupal Prep + init: > + eval $(gp env -e APACHE_DOCROOT_IN_REPO=../back/docroot) && + cd /workspace/back && + rm -rf config/default && + mkdir -p config/default && + touch config/default/core.extension.yml && + composer install --no-interaction && + mkdir -p blt && + cp .gitpod/blt.yml blt/local.blt.yml && + find docroot/sites/ -name 'local*' | xargs rm -rf && + cp .gitpod/global.settings.php docroot/sites/settings/global.settings.php && + cp .gitpod/default.local.services.yml docroot/sites/local.services.yml && + export NEXT_PUBLIC_DRUPAL_BASE_URL=`gp url 8001` && + export PREVIEW_URL=${NEXT_PUBLIC_DRUPAL_BASE_URL#"https://"} && + blt blt:telemetry:disable --no-interaction && + blt settings && + blt drupal:install -n && + drush cset system.theme default claro -y && + cd /workspace/front && + cp .env.example .env.local && + sed -i 's/#DRUPAL_REVALIDATE_SECRET/DRUPAL_REVALIDATE_SECRET/' .env.local && + sed -i 's/#DRUPAL_PREVIEW_SECRET/DRUPAL_PREVIEW_SECRET/' .env.local && + yarn install + command: | + cd /workspace/back && + echo 'Restarting Apache' && + eval $(gp env -e APACHE_DOCROOT_IN_REPO=../back/docroot) && + apache2ctl restart && + gp ports await 8001 && + find docroot -name 'local.drush.yml' | xargs rm && + export NEXT_PUBLIC_DRUPAL_BASE_URL=`gp url 8001` && + export PREVIEW_URL=${NEXT_PUBLIC_DRUPAL_BASE_URL#"https://"} && + blt blt:telemetry:disable --no-interaction && + echo 'Establishing Settings' && + blt settings && + echo 'Logging Into Drupal' && + drush uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL && + drush uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL | xargs gp preview --external && + git config core.fileMode false && + echo 'Connecting Drupal to Frontend' && + drush su-next-connect "$(gp url 3000)" --preview-secret=DRUPAL_PREVIEW_SECRET --revalidation-secret=DRUPAL_REVALIDATION_SECRET && + cd /workspace/front && + yarn install && + sed -i -r "s|NEXT_PUBLIC_DRUPAL_BASE_URL.*|NEXT_PUBLIC_DRUPAL_BASE_URL=$NEXT_PUBLIC_DRUPAL_BASE_URL|g" .env.local && + yarn dev & + gp ports await 3000 && + gp url 3000 | xargs gp preview --external + - name: SSH Keys + command: | + rm -rf ~/.ssh/id_rsa && + rm -rf ~/.ssh/id_rsa.pub && + eval $(command gp env -e) && + mkdir -p ~/.ssh && + [[ ! -z $SSH_PUBLIC_KEY ]] && + echo $SSH_PUBLIC_KEY | base64 -d > ~/.ssh/id_rsa.pub && + chmod 644 ~/.ssh/id_rsa.pub && + [[ ! -z $SSH_PRIVATE_KEY ]] && + echo $SSH_PRIVATE_KEY | base64 -d > ~/.ssh/id_rsa && + chmod 600 ~/.ssh/id_rsa && + cd /workspace/front && + [[ ! -z $GITCONFIG ]] && + echo $GITCONFIG | base64 -d > ~/.gitconfig && + chmod 644 ~/.gitconfig + git remote set-url origin $(echo $GITPOD_WORKSPACE_CONTEXT | jq -r .repository.cloneUrl | sed -E 's|^.*.com/(.*)$|git@github.com:\1|') + +vscode: + extensions: + - bradlc.vscode-tailwindcss \ No newline at end of file