Skip to content

Commit

Permalink
Improve apt packages and docs, fixes ddev#4112, fixes ddev#4113, fixes
Browse files Browse the repository at this point in the history
…ddev#4125 (ddev#4133)

* [docs] Remove dependencies on certutils/libnss3-tools etc, fixes ddev#4112
* Make sure to use apt for installation in wsl2, fixes ddev#4113
* Explain how to download completion scripts, fixes ddev#4125
* Add goreleaser instructions to place bash/zsh/fish completions properly
  • Loading branch information
rfay authored Aug 22, 2022
1 parent 1388638 commit e7ba6a4
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .gitpod/images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
RUN curl https://apt.fury.io/drud/gpg.key | sudo apt-key add -
RUN echo "deb https://apt.fury.io/drud/ * *" | sudo tee -a /etc/apt/sources.list.d/ddev.list

RUN apt-get update >/dev/null && sudo apt-get install -y aspell autojump ddev file mysql-client netcat nodejs python3-pip telnet xdg-utils >/dev/null
RUN apt-get update >/dev/null && sudo apt-get install -y aspell autojump ddev file mysql-client netcat nodejs python3-pip telnet >/dev/null

RUN pip3 install mkdocs pyspelling pymdown-extensions
RUN npm install -g markdownlint-cli
Expand Down
13 changes: 13 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,19 @@ nfpms:
formats:
- deb
- rpm
contents:
- src: .gotmp/bin/completions/ddev_bash_completion.sh
dst: /usr/share/bash-completion/completions/ddev
file_info:
mode: 0644
- src: .gotmp/bin/completions/ddev_fish_completion.sh
dst: /usr/share/fish/completions/ddev.fish
file_info:
mode: 0644
- src: .gotmp/bin/completions/ddev_zsh_completion.sh
dst: /usr/share/zsh/vendor-completions/_ddev
file_info:
mode: 0644
overrides:
deb:
dependencies:
Expand Down
15 changes: 10 additions & 5 deletions docs/content/users/install/ddev-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Docker or an alternative is required before anything will work with DDEV. This i
sudo apt update && sudo apt install -y ddev
```

In the future you can update as usual, with `sudo apt update && sudo apt upgrade`.
To update use the normal update commands `sudo apt update && sudo apt upgrade`.

If you previously used `install_ddev.sh` to install DDEV, you can just `sudo rm -f /usr/local/bin/ddev /usr/local/bin/mkcert /usr/local/bin/*ddev_nfs_setup.sh` to remove the previous version. If you previously used homebrew to install DDEV, you can just `brew unlink ddev` to get rid of the homebrew version.

Expand Down Expand Up @@ -106,9 +106,15 @@ Docker or an alternative is required before anything will work with DDEV. This i
10. Check that docker is working inside Ubuntu (or your distro): `docker ps`
11. Optional: If you prefer to use the *traditional Windows* ddev instead of working inside WSL2, install it with `choco install -y ddev`. The Windows ddev works fine with the WSL2-based Docker engine. However, the WSL2 ddev setup is vastly preferable and at least 10 times as fast. Support for the traditional Windows approach will eventually be dropped.
12. Open the WSL2 terminal, for example `Ubuntu` from the Windows start menu.
13. Install `ddev` with `curl -fsSL https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh | bash`
14. `sudo apt-get update && sudo apt-get install -y certutil xdg-utils` to install the `xdg-utils` package that allows `ddev launch` to work.
15. In WSL2 run `mkcert -install`.
13. Install DDEV using

```bash
curl https://apt.fury.io/drud/gpg.key | sudo apt-key add -
echo "deb https://apt.fury.io/drud/ * *" | sudo tee -a /etc/apt/sources.list.d/ddev.list
sudo apt update && sudo apt install -y ddev
```

14. In WSL2 run `mkcert -install`.

That's it! You have now installed DDEV on WSL2. If you're using WSL2 for DDEV (recommended), remember to run all `ddev` commands inside the WSL2 distro.
Follow the instructions in the `Linux apt/yum` section.
Expand Down Expand Up @@ -157,7 +163,6 @@ Docker or an alternative is required before anything will work with DDEV. This i
DDEV is fully supported in Gitpod.io, and there are many ways to use it. You don't have to install *anything* to use it, not Docker, and not DDEV, it's all done for you.

1. Just [open any repository](https://www.gitpod.io/docs/getting-started) using gitpod and `brew install drud/ddev/ddev` and use ddev as you would normally use it.
* To use `ddev launch` you'll need to `sudo apt-get update && sudo apt-get install -y xdg-utils`.
* You can just install your web app there, or import a database.
* You may want to implement one of the `ddev pull` provider integrations to pull from a hosting provider or an upstream source.
2. Use [ddev-gitpod-launcher](https://drud.github.io/ddev-gitpod-launcher/) form to launch a repository. See the actual instructions on the [repository](https://github.com/drud/ddev-gitpod-launcher). You just click the button and it opens a fully-set-up environment. If a companion artifacts repository with the suffix `-artifacts` is available, then the `db.sql.gz` and `files.tgz` from it will be automatically loaded.
Expand Down
45 changes: 15 additions & 30 deletions docs/content/users/install/shell-completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Most people like to have shell completion on the command line. In other words, w

Shells like bash and zsh need help to do this though, they have to know what the options are. DDEV-Local provides the necessary hint scripts, and if you use homebrew, they get installed automatically. But if you use oh-my-zsh, for example, you may have to manually install the hint script.

=== "Bash with Homebrew"
The easiest way to use bash completion on either macOS or Linux is to install with homebrew. `brew install bash-completion`. When you install it though, it will warn you with something like this, which may vary on your system.
=== "macOS Bash with Homebrew"
The easiest way to use bash completion on macOS is install it with homebrew. `brew install bash-completion`. When you install it though, it will warn you with something like this, which may vary on your system.

Add the following line to your `~/.bash_profile`:

Expand All @@ -18,38 +18,23 @@ Shells like bash and zsh need help to do this though, they have to know what the

* Link completions with `brew completions link`.

If you're installing DDEV via homebrew, each new release will automatically get a refreshed completions script.
When you install DDEV via homebrew, each new release will automatically get a refreshed completions script.

=== "Bash without Homebrew"
The completion script is exactly the same, it's just that you have to install it yourself. Each system may have a slightly different technique, and you'll need to figure it out. On Debian/Ubuntu, you would use [these instructions](https://www.cyberciti.biz/faq/add-bash-auto-completion-in-ubuntu-linux/) to enable bash-completion, and then `sudo mkdir -p /etc/bash_completion.d && sudo cp ddev_bash_completion.sh /etc/bash_completion.d`. This deploys the ddev_bash_completion.sh script where it needs to be. Again, every Linux distro has a different technique, and you may have to figure yours out.
=== "Bash/Zsh/Fish on Linux"

=== "Zsh Completion with Homebrew"
On Debian and Yum based systems, using `apt install ddev` you should find that bash, zsh, and fish completions are automatically installed.

This works exactly the same as bash completion. `brew install zsh-completions`. You'll get instructions something like this:
Manual installation is easy though, the completion script is exactly the same, it's just that you have to download and install it yourself. Each system may have a slightly different technique, and you'll need to figure it out. On Debian/Ubuntu, manually install like this:
1. Download the completion files and extract them with
```bash
VERSION=v1.21.1
curl -sSLf https://github.com/drud/ddev/releases/download/${VERSION}/ddev_shell_completion_scripts.${VERSION}.tar.gz
tar -zxf ddev_shell_completion_scripts.${VERSION}.tar.gz
```
2. Then `sudo mkdir -p /usr/share/bash-completion/completions && sudo cp ddev_bash_completion.sh /usr/share/bash-completion/completions/ddev`. This deploys the ddev_bash_completion.sh script where it needs to be. Again, every Linux distro has a different technique, and you may have to figure yours out.

```bash
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH

autoload -Uz compinit
compinit
fi
```

You may also need to force rebuild `zcompdump`:

```bash
rm -f ~/.zcompdump; compinit
```

Additionally, if you receive "zsh compinit: insecure directories" warnings when attempting
to load these completions, you may need to run this:

```bash
chmod go-w '/usr/local/share'
```

So follow those instructions and your zsh should be set up.
If you installed DDEV using `apt install` then the `ddev_bash_completion.sh` file is already available in `/usr/bin/ddev_bash_completion.sh`. Starting with DDEV v1.21.2 this will be automatically installed into `/usr/share/bash-completion/completions`.

=== "Oh-My-Zsh"

Expand Down
26 changes: 17 additions & 9 deletions docs/content/users/topics/phpstorm.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,23 @@ Set the PHPStorm terminal path (Settings→Tools→Terminal→Shell Path) to `C:
1. On Windows 11 you don't need to install an X11 server, because [WSLg](https://github.com/microsoft/wslg) is included by default. On older Windows 10, Install X410 from the Microsoft Store, launch it, configure in the system tray with “Windowed Apps”, “Allow public access”, “DPI Scaling”→”High quality”. Obviously you can any other X11 server, but this is the one I’ve used.
2. Temporarily disable your Windows firewall. You can re-enable it after you get everything working.
3. If you're on older Windows 10, in the WSL2 terminal `export DISPLAY=$(awk '/^nameserver/ {print $2; exit;}' </etc/resolv.conf):0.0` (You’ll want to add this to your .profile in WSL2). This sets the X11 DISPLAY variable to point to your Windows host side. On Windows 11 this "just works" and you don't need to do anything here.
4. On Windows 11, `sudo apt-get update && sudo apt-get install xdg-utils`. On older Windows 10, `sudo apt-get update && sudo apt-get install libatk1.0 libatk-bridge2.0 libxtst6 libxi6 libpangocairo-1.0 libcups2 libnss3 xdg-utils x11-apps`
5. On older Windows 10, run `xeyes` – you should see the classic X11 play app “xeyes” on the screen. <ctrl-c> to exit. This is just a test to make sure X11 is working.
6. Download and untar PHPStorm for Linux from [Jetbrains](https://www.jetbrains.com/phpstorm/download/#section=linux) – you need the Linux app.
7. Run `bin/phpstorm.sh &`
8. In PHPStorm, under Help→ Edit Custom VM Options, add an additional line: `-Djava.net.preferIPv4Stack=true` This makes PHPStorm listen for Xdebug using IPV4; for some reason the Linux version of PHPStorm defaults to using only IPV6, and Docker Desktop doesn't support IPV6.
9. Restart PHPStorm (`File→Exit` and then `bin/phpstorm.sh &` again.
10. Use `ddev start` and `ddev xdebug` on
4. Install the DDEV apt repository with

```bash
curl https://apt.fury.io/drud/gpg.key | sudo apt-key add -
echo "deb https://apt.fury.io/drud/ * *" | sudo tee -a /etc/apt/sources.list.d/ddev.list
sudo apt update && sudo apt install -y ddev
```

5. On Windows 11, `sudo apt-get update && sudo apt-get install ddev`. On older Windows 10, `sudo apt-get update && sudo apt-get install ddev libatk1.0 libatk-bridge2.0 libxtst6 libxi6 libpangocairo-1.0 libcups2 libnss3 xdg-utils x11-apps`
6. On older Windows 10, run `xeyes` – you should see the classic X11 play app “xeyes” on the screen. <ctrl-c> to exit. This is just a test to make sure X11 is working.
7. Download and untar PHPStorm for Linux from [Jetbrains](https://www.jetbrains.com/phpstorm/download/#section=linux) – you need the Linux app.
8. Run `bin/phpstorm.sh &`
9. In PHPStorm, under Help→ Edit Custom VM Options, add an additional line: `-Djava.net.preferIPv4Stack=true` This makes PHPStorm listen for Xdebug using IPV4; for some reason the Linux version of PHPStorm defaults to using only IPV6, and Docker Desktop doesn't support IPV6.
10. Restart PHPStorm (`File→Exit` and then `bin/phpstorm.sh &` again.
11. Use `ddev start` and `ddev xdebug` on
Click the Xdebug listen button in PHPStorm (the little phone icon) to make it start listening.
11. Set a breakpoint on or near the first line of your index.php
12. Visit the project with a web browser or curl. You should get a popup asking for mapping of the host-side files to the in-container files. You’ll want to make sure that `/home/<you>/.../<yourproject>` gets mapped to `/var/www/html`.
12. Set a breakpoint on or near the first line of your index.php
13. Visit the project with a web browser or curl. You should get a popup asking for mapping of the host-side files to the in-container files. You’ll want to make sure that `/home/<you>/.../<yourproject>` gets mapped to `/var/www/html`.
Debugging should be working! You can step through your code, set breakpoints, view variables, etc.

0 comments on commit e7ba6a4

Please sign in to comment.