-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from mandrasch/feat-add-gitpod
Feat add gitpod
- Loading branch information
Showing
12 changed files
with
260 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ wait_for_docker() { | |
|
||
wait_for_docker | ||
|
||
# TODO: remove, might not be needed (auto-detected) | ||
# https://github.com/ddev/ddev/pull/5290#issuecomment-1689024764 | ||
ddev config global --omit-containers=ddev-router | ||
|
||
|
@@ -30,35 +31,17 @@ ddev debug download-images | |
# avoid errors on rebuilds | ||
ddev poweroff | ||
|
||
# Workaround for vite: | ||
# We expose port 5174 for vite on codespaces, because ddev-router is not used on codespace instances. | ||
# Routing is handled by codespaces itself. This will create an additional config file for DDEV | ||
# which will expose port 5174. This port needs to be set to public + HTTPS manually in ports tab, | ||
# otherwise CORS errors will occur. See config/vite.php and vite.config.js as well. | ||
|
||
if [ ! -f ".ddev/docker-compose.codespaces-vite.yaml" ]; then | ||
echo "Creating vite port workaround file for port exposing ..." | ||
# create workaround file for port exposing (if it does not exist yet) | ||
# info: this file should not be commited to git since it shouldn't be used on local DDEV | ||
cat >.ddev/docker-compose.codespaces-vite.yaml <<EOL | ||
services: | ||
web: | ||
ports: | ||
- 5174:5174 | ||
EOL | ||
|
||
fi | ||
|
||
# start ddev project | ||
ddev start -y | ||
|
||
# DDEV will automatically set the codespaces preview URL in .env. | ||
# If this is not working in future, you can use this snippet for replacement: | ||
# ddev exec 'sed -i "/PRIMARY_SITE_URL=/c APP_URL=$DDEV_PRIMARY_URL" .env' | ||
# Workaround for Vite: | ||
# Normally expose port 5173 for Vite in .ddev/config.yaml, but ddev-router | ||
# is not used on Gitpod / Codespaces, etc. The Routing is handled by Gitpod / | ||
# Codespaces itself. Therefore we will create an additional config file for | ||
# DDEV which will expose port 5173 without ddev-router. | ||
cp .devcontainer/templates/docker-compose.vite-workaround.yaml .ddev/. | ||
|
||
# Current workaround for https://github.com/ddev/ddev/issues/5256, | ||
# can be removed later if PR is merged in next ddev version | ||
ddev exec 'sed -i "s/preview.app.github.dev/app.github.dev/g" .env' | ||
# Start the DDEV project | ||
# (will automatically get URL from env, adds db connection to .env) | ||
export DDEV_NONINTERACTIVE=true | ||
ddev start -y | ||
|
||
# normal project setup | ||
ddev composer install | ||
|
@@ -76,10 +59,10 @@ ddev craft install/craft \ | |
[email protected] \ | ||
--site-name=Testsite | ||
|
||
# You could also remove it here and run this in codespaces terminal, it will just prompt for your password: | ||
# You could also remove it here and run this in terminal, it will just prompt for your password: | ||
# ddev craft install/craft --username=admin [email protected] --site-name=Testsite | ||
|
||
# If craft was also installed (e.g. when you do a codespaces rebuild/full rebuild), this command | ||
# If craft was also installed (e.g. when you do a rebuild/full rebuild), this command | ||
# will just state "craft already installed". | ||
|
||
# install the vite plugin by nystudio107 after fresh install | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# See postCreateCommand.sh for more information - expose the Vite port without using | ||
# ddev router (disabled on Gitpod/Codespaces,etc.). This file should not be committed | ||
# to git since it conflicts with local DDEV usage (with ddev router) | ||
services: | ||
web: | ||
ports: | ||
- 5173:5173 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# ddev v1.23.1 | ||
# https://github.com/ddev/ddev-gitpod-launcher | ||
# https://hub.docker.com/r/ddev/ddev-gitpod-base | ||
image: ddev/ddev-gitpod-base:20240516 | ||
|
||
# Based on | ||
# https://github.com/ddev/ddev-gitpod-launcher/blob/main/.gitpod.yml | ||
# https://github.com/shaal/DrupalPod/blob/main/.gitpod.yml | ||
|
||
# ddev and composer are running as part of the prebuild | ||
# when starting a Gitpod workspace all docker images are ready | ||
tasks: | ||
- name: prepare | ||
init: | | ||
ddev debug download-images | ||
command: | | ||
chmod +x .gitpod/project-setup.sh | ||
.gitpod/project-setup.sh | ||
gp ports await 8080 && sleep 1 && gp preview $(gp url 8080) | ||
echo "The system is ready, happy developing!" | ||
code src/scss/app.scss | ||
ddev npm run dev | ||
vscode: | ||
extensions: | ||
# PHP extensions. | ||
- felixfbecker.php-debug | ||
- bmewburn.vscode-intelephense-client | ||
|
||
# Prettier | ||
- esbenp.prettier-vscode | ||
|
||
# Twig | ||
- mblode.twig-language-2 | ||
# - moetelo.twiggy | ||
# or use https://github.com/zackad/prettier-plugin-twig-melody | ||
|
||
# Bash extensions. | ||
- timonwong.shellcheck | ||
- rogalmic.bash-debug | ||
|
||
ports: | ||
# Vite port | ||
- port: 5173 | ||
onOpen: ignore | ||
visibility: public | ||
# Used by ddev - local db clients | ||
- port: 3306 | ||
onOpen: ignore | ||
# Used by projector | ||
- port: 6942 | ||
onOpen: ignore | ||
# Used by Mailpit | ||
- port: 8025 | ||
onOpen: ignore | ||
# Mailpit web UI | ||
- port: 8027 | ||
onOpen: ignore | ||
# Direct-connect ddev-webserver port that is the main port | ||
- port: 8080 | ||
onOpen: ignore | ||
# Ignore host https port | ||
- port: 8443 | ||
onOpen: ignore | ||
# xdebug port | ||
- port: 9003 | ||
onOpen: ignore | ||
# projector port | ||
- port: 9999 | ||
onOpen: open-browser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Prepare vscode-xdebug setup | ||
mkdir -p .vscode | ||
cp .gitpod/templates/launch.json .vscode/. | ||
|
||
# Workaround for Vite: | ||
# Normally expose port 5173 for Vite in .ddev/config.yaml, but ddev-router | ||
# is not used on Gitpod / Codespaces, etc. The Routing is handled by Gitpod / | ||
# Codespaces itself. Therefore we will create an additional config file for | ||
# DDEV which will expose port 5173 without ddev-router. | ||
cp .gitpod/templates/docker-compose.vite-workaround.yaml .ddev/. | ||
|
||
# Start the DDEV project | ||
# (will automatically get URL from env, adds db connection to .env) | ||
export DDEV_NONINTERACTIVE=true | ||
ddev start -y | ||
|
||
# Prepare Laravel website | ||
ddev composer install | ||
ddev npm install | ||
|
||
ddev craft install/craft \ | ||
--interactive=0 \ | ||
--username=admin \ | ||
--password=newPassword \ | ||
[email protected] \ | ||
--site-name=Testsite | ||
|
||
# You could also remove it here and run this in terminal, it will just prompt for your password: | ||
# ddev craft install/craft --username=admin [email protected] --site-name=Testsite | ||
|
||
# If craft was also installed (e.g. when you do a rebuild/full rebuild), this command | ||
# will just state "craft already installed". | ||
|
||
# install the vite plugin by nystudio107 after fresh install | ||
ddev craft plugin/install vite | ||
|
||
# Further steps - you could also import a database here: | ||
# ddev import-db --file=dump.sql.gz | ||
# if you import a dump, you might need: | ||
# ddev craft setup/keys | ||
# or use 'ddev pull' to get latest db / files from remote | ||
# https://ddev.readthedocs.io/en/stable/users/providers/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# See postCreateCommand.sh for more information - expose the Vite port without using | ||
# ddev router (disabled on Gitpod/Codespaces,etc.). This file should not be committed | ||
# to git since it conflicts with local DDEV usage (with ddev router) | ||
services: | ||
web: | ||
ports: | ||
- 5173:5173 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"label": "Auto-open css file", | ||
"type": "shell", | ||
"command": "code resources/css/app.css", | ||
"runOptions": { | ||
"runOn": "folderOpen" | ||
}, | ||
"presentation": { | ||
"echo": true, | ||
"reveal": "silent", | ||
"focus": false, | ||
"panel": "shared", | ||
"showReuseMessage": false, | ||
"clear": false | ||
} | ||
}, | ||
{ | ||
"name": "Listen for XDebug", | ||
"type": "php", | ||
"request": "launch", | ||
"hostname": "0.0.0.0", | ||
"port": 9003, | ||
"pathMappings": { | ||
"/var/www/html": "${workspaceRoot}" | ||
} | ||
}, | ||
{ | ||
"type": "bashdb", | ||
"request": "launch", | ||
"name": "Bash-Debug (select script from list of sh files)", | ||
"cwd": "${workspaceFolder}", | ||
"program": "${command:SelectScriptName}", | ||
"args": [] | ||
} | ||
] | ||
} |
Oops, something went wrong.