Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ops / Docker / SystemD Crash: Address crashing hosts when developing docker containers. #481

Merged
merged 5 commits into from
Jan 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ devmaster_id_rsa.pub
bin/*
~bin/devshop
!bin/branch-or-tag
!bin/docker-entrypoint
!bin/docker*
!bin/hosting-queue-runner
!bin/mysql-wait

Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ RUN chmod 766 $DEVSHOP_TESTS_ASSETS_PATH

RUN ansible --version

# Cleanup unwanted systemd files. See bin/docker-systemd-clean.
RUN docker-systemd-clean

# Remove Home Directory if desired so that devshop code is reinstalled.
RUN if [ $DEVSHOP_REBUILD_HOME ]; then rm -rf /var/aegir; fi

Expand Down
21 changes: 21 additions & 0 deletions bin/devshop-logo
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
DEVSHOP_PATH="$( cd "$(dirname "$0")"/.. ; pwd -P )"
PATH="$DEVSHOP_PATH/bin:$PATH"
VERSION=`branch-or-tag || cat $DEVSHOP_PATH/.git/HEAD`
echo '
____ ____ _
| _ \ _____ __/ ___|| |__ ___ _ __
| | | |/ _ \ \ / /\___ \| _ \ / _ \| _ \
| |_| | __/\ V / ___) | | | | (_) | |_) |
|____/ \___| \_/ |____/|_| |_|\___/| .__/
http://getdevshop.com |_|'
echo " Version $VERSION "
echo " Path $DEVSHOP_PATH "

if [ -z "$1" ]; then exit; fi

echo "__________________________________________________"
echo ""
echo " $1 "
echo "__________________________________________________"

22 changes: 22 additions & 0 deletions bin/docker-systemd-clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PATH="$DIR:$PATH"

devshop-logo "Cleaning up SystemD"
echo "This should only be run inside a container with SystemD."
echo "See https://github.com/geerlingguy/docker-ubuntu1804-ansible/pull/12"

# @TODO: Make this multi-os, and determine if there are any unwanted side effects.
# The "ls" command should fail, breaking any build without this path.

ls /lib/systemd/system

find /lib/systemd/system/sysinit.target.wants/* ! -name systemd-tmpfiles-setup.service -delete;
rm -f /lib/systemd/system/multi-user.target.wants/*;
rm -f /etc/systemd/system/*.wants/*;
rm -f /lib/systemd/system/local-fs.target.wants/*;
rm -f /lib/systemd/system/sockets.target.wants/*udev*;
rm -f /lib/systemd/system/sockets.target.wants/*initctl*;
rm -f /lib/systemd/system/basic.target.wants/*;
rm -f /lib/systemd/system/anaconda.target.wants/*;find /lib/systemd/system/sysinit.target.wants/* ! -name systemd-tmpfiles-setup.service -delete;