diff --git a/.github/workflows/ce-dev-build-dev.yml b/.github/workflows/ce-dev-build-dev.yml new file mode 100644 index 0000000..952190b --- /dev/null +++ b/.github/workflows/ce-dev-build-dev.yml @@ -0,0 +1,42 @@ +name: Build the devel ce-dev base and controller images + +# Run this workflow only on a push/merged PR to branch devel +on: + push: + branches: + - devel + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install modules + run: yarn + # Uses https://oclif.io/ + - name: Pack the JS + run: yarn oclif-dev pack + # We build mkcert from source because releases are broken + # The last step sets ce-dev config to NOT use sudo because this causes docker image push problems + - name: Install build and publish dependencies + run: | + sudo apt-get update + sudo apt-get install -y p7zip-full libnss3-tools wget + cd /tmp + wget https://golang.org/dl/go1.16.3.linux-amd64.tar.gz + sudo tar -C /usr/local -xzf go1.16.3.linux-amd64.tar.gz + export PATH=$PATH:/usr/local/go/bin + git clone https://github.com/FiloSottile/mkcert && cd mkcert + go build -ldflags "-X main.Version=$(git describe --tags)" + sudo mv ./mkcert /usr/local/bin && cd ../ + sudo chmod +x /usr/local/bin/mkcert + rm -Rf mkcert + mkdir -p ~/.config/ce-dev + touch ~/.config/ce-dev/preferences-1.x.yml + echo 'docker_bin: docker' > ~/.config/ce-dev/preferences-1.x.yml + echo 'docker_compose_bin: docker compose' >> ~/.config/ce-dev/preferences-1.x.yml + echo 'mkcert_bin: mkcert' >> ~/.config/ce-dev/preferences-1.x.yml + - name: Build and push Docker images + run: | + echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + /bin/sh docker-images/export.sh devel --push diff --git a/docker-images/export.sh b/docker-images/export.sh index 7204c30..80f1ea6 100755 --- a/docker-images/export.sh +++ b/docker-images/export.sh @@ -27,7 +27,7 @@ fi OWN_DIR=$( cd "$( dirname "$OWN" )" && pwd -P) # Ensure we have a fresh image to start with. -docker image pull debian:buster +docker image pull debian:bullseye-slim # Build base image. echo "Building base image." @@ -45,8 +45,8 @@ if [ "$2" = "--push" ]; then docker image push "codeenigma/ce-dev-controller-1.x:$1" fi -# Build dind image. -# echo "Building dind image" +# Build DinD (Docker in Docker) image. +# echo "Building DinD image" # sudo docker image build --compress "--label=ce-dev-dind-1.x:$1" --no-cache=true -t "codeenigma/ce-dev-dind-1.x:$1" "$OWN_DIR/dind" || exit 1 # if [ "$2" = "--push" ]; then # echo "Publishing the image with docker image push codeenigma/ce-dev-dind-1.x:$1" diff --git a/docs/Troubleshooting.md b/docs/Troubleshooting.md index df36cfd..ded8021 100644 --- a/docs/Troubleshooting.md +++ b/docs/Troubleshooting.md @@ -7,44 +7,97 @@ If your files are not updating you should check the [maximum permitted `inotify` The way some editors behave on save means the inumber of the file does not change, so unison does not pick up a difference and the files in your containers do not update. Notable culprits are `vim` and `Atom`. In both cases there are fixes - for example the `local-history` plugin for `Atom` forces it to behave as we need. If you have mysterious issues with files not changing in your containers and it isn't the `inotify` watcher limit above, check how your editor behaves. ## Cgroup Issues + If your ce-dev is failing to even start the controller then you'll see a response that looks like this. -``` + +```bash Creating ce_dev_controller ... done Ensure user UID match those on the host... Ensure user UID match those on the host... ! Error: Command failed: sudo docker exec ce_dev_controller /bin/sh /opt/ce-dev-ownership.sh 1000 1000 ``` + There will be very little in the way of logs or errors from this. Just an indication of a problem. +### Ubuntu 21.x + It turns out that if you are using Ubuntu 21.10 (or POP! OS) then it will be using kernelstub and not grub. This might create incompatabilities between docker and cgroup version 2. To fix this you need to run the following commands. -``` -sudo kernelstub -a "systemd.unified_cgroup_hierarchy=0" +```bash +sudo kernelstub -a "systemd.unified_cgroup_hierarchy=0" sudo update-initramfs -c -k all ``` They will take a while to run (about 10 minutes), but once complete reboot your machine and delete any created containers that velong to the ce_dev image. When you rebuild the ce-dev controller (by running any command) it should create fine. Another way for changing the system settings for cgroups is addind the option to the boot loader. In case you use grub with a distribution that uses the new cgroups version you can add this line into the file */etc/default/grub* -``` + +```bash GRUB_CMDLINE_LINUX="systemd.unified_cgroup_hierarchy=0" ``` + More information about adding parameters to the kernel if you're using other boot loader can be found at https://wiki.archlinux.org/title/kernel_parameters +### Ubuntu 22.x + +The resolution steps are similar to the ones above for `Ubuntu:21.x`, except that `Ubuntu:22.x` doesn't use `kernelstub`, so the changes have to be made in the grub file instead: + +1 - Edit the grub file in your editor of choice. + +```bash +sudo vi /etc/default/grub +``` + +2 - Modify the line for `GRUB_CMDLINE_LINUX_DEFAULT`, with the following value: + +```bash +GRUB_CMDLINE_LINUX_DEFAULT="systemd.unified_cgroup_hierarchy=0 quiet splash" +``` + +3 - Force a refresh of the system grub and an update of `initramfs` images: + +```bash +sudo update-grub +sudo update-initramfs -c -k all +``` + +4 - Lastly, ensure all existing containers are removed: + +```bash +docker rm $(docker ps -aq) +``` + +### Cgroup On Older Projects + +ce-dev does allow for the use of Cgroup 2, but some older projects will need upgrading to allow this to work. This means that the ce-dev controller will work fine, but some projects may fail to start some containers. This error will become apparent if you see the "unreachable" error when running the `ce-dev provision` step. + +If this is the case then make sure that the cgroup option is set in your ce-dev.compose.prebuilt.yml file for the services that aren't starting. + +```yaml +services: + web: + cgroup: host + image: 'codeenigma/drupal9-web:latest' + expose: +``` + ## VM Networking issue If you're running ce-dev from within a Virtual Machine (eg. KVM/qemu), Docker container network ports are only 'exposed' to the hypervisor (ie the VM), and are not published for external access. In order to access sites/files deployed by ce-dev, the ports needs to be published so that the Docker containers can be accessed from your workstation. After running ```ce-dev init``` (before ```ce-dev start```) edit the ~/project/ce-dev/docker-compose.yml Replace; -``` + +```yaml expose: - 443 - 80 - '22' ``` + With; -``` + +```yaml ports: - '443:443' - '80:80' diff --git a/yarn.lock b/yarn.lock index 0eadd05..728ca4e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -648,11 +648,11 @@ cross-spawn@^7.0.2: which "^2.0.1" debug@^4.0.0, debug@^4.0.1, debug@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: - ms "^2.1.1" + ms "2.1.2" deep-is@^0.1.3: version "0.1.3" @@ -1614,7 +1614,7 @@ moment@^2.22.1: resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== -ms@^2.1.1: +ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== @@ -2369,9 +2369,9 @@ widest-line@^3.1.0: string-width "^4.0.0" word-wrap@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + version "1.2.4" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.4.tgz#cb4b50ec9aca570abd1f52f33cd45b6c61739a9f" + integrity sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA== wrap-ansi@^4.0.0: version "4.0.0"