- run
sudo apt-get install squashfs-tools kexec-tools
- copy "update.sh" to
/usr/sbin/update-coreos
, and make it executable - copy "create-docker-store.sh" to
/usr/sbin/create-coreos-docker-store
, and make it executable - copy "cloud-config.yml" to
/etc/default/coreos
, modifying it to suit your preferences - run
sudo update-coreos -d
- reboot
-
-
Save SatWiz/19418716f7b38066cbeb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#cloud-config | |
hostname: <<your chosen hostname>> | |
users: | |
- name: <<your chosen user name>> | |
groups: | |
- sudo | |
- docker | |
ssh-authorized-keys: | |
- <<your ssh key (should start with "ssh-rsa ...")>> | |
coreos: | |
units: | |
- name: static.network | |
content: | | |
[Match] | |
Name=ens3 | |
[Network] | |
Address=<<your host's static IP, assigned by DO>>/24 | |
Gateway=<<your host's gateway's static IP>> | |
DNS=8.8.8.8 | |
DNS=8.8.4.4 | |
- name: media-doroot.mount | |
command: start | |
content: | | |
[Mount] | |
What=/dev/vda | |
Where=/media/doroot | |
Type=ext4 | |
- name: format-docker-store.service | |
command: start | |
content: | | |
[Unit] | |
Requires=media-doroot.mount | |
[Service] | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStart=/media/doroot/usr/sbin/create-coreos-docker-store | |
- name: var-lib-docker.mount | |
command: start | |
content: | | |
[Unit] | |
Requires=format-docker-store.service | |
Before=docker.service | |
[Mount] | |
What=/dev/disk/by-label/docker | |
Where=/var/lib/docker | |
Type=btrfs |
This file contains hidden or 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
#!/bin/sh | |
mkdir -p /media/doroot/var/lib/coreos | |
if [ ! -f "/media/doroot/var/lib/coreos/docker.img" ]; then | |
DOFORMAT=1 | |
fi | |
truncate -s 10G /media/doroot/var/lib/coreos/docker.img | |
LODEV=`losetup -f --show /media/doroot/var/lib/coreos/docker.img` | |
if [ -n "$DOFORMAT" ]; then | |
mkfs.btrfs -L docker "$LODEV" | |
fi |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
BASE_URL="http://storage.core-os.net/coreos/amd64-usr/alpha" | |
KERNEL="/boot/coreos/vmlinuz" | |
INITRD_IMAGE="/boot/coreos/initrd.cpio.gz" | |
INITRD_TEMPLATE="/boot/coreos/initrd.template" | |
CONFIG="/etc/default/coreos" | |
CONFIG_LINK_DIR="/boot/coreos/initrd.template/usr/share/oem" | |
if [ ! -f "$CONFIG" ]; then | |
echo "cannot proceed without a valid cloud-config in $CONFIG; aborting" | |
exit 1 | |
fi | |
mkdir -p "$CONFIG_LINK_DIR" | |
if [ "$1" = "-d" -o "$1" = "--download" ]; then | |
shift | |
REDOWNLOAD_KERNEL=1 | |
REDOWNLOAD_INITRD=1 | |
fi | |
if [ ! -f "$CONFIG_LINK_DIR/cloud-config.yml" ]; then | |
ln -s "$CONFIG" "$CONFIG_LINK_DIR/cloud-config.yml" | |
fi | |
if [ ! -f "$KERNEL" ]; then | |
REDOWNLOAD_KERNEL=1 | |
fi | |
if [ "$(find "$INITRD_TEMPLATE" -name "*.squashfs" -type f | wc -l)" -eq 0 ]; then | |
REDOWNLOAD_INITRD=1 | |
fi | |
if [ -n "$REDOWNLOAD_KERNEL" ]; then | |
curl "$BASE_URL/coreos_production_pxe.vmlinuz" > "$KERNEL" | |
fi | |
if [ -n "$REDOWNLOAD_INITRD" ]; then | |
find "$INITRD_TEMPLATE" -name "*.squashfs" -type f -delete | |
TMP=`mktemp -d` | |
pushd "$TMP" >/dev/null | |
curl "$BASE_URL/coreos_production_pxe_image.cpio.gz" | zcat | cpio -id | |
find "$TMP" -name "*.squashfs" -type f -exec 'mv' '{}' "${INITRD_TEMPLATE}/" ';' | |
popd >/dev/null | |
rm -rf "$TMP" | |
fi | |
rm -f "$INITRD_IMAGE" | |
pushd "$INITRD_TEMPLATE" >/dev/null | |
rm -f ./manifest | |
find . -name "*.squashfs" >> ./manifest | |
find ./usr >> ./manifest | |
cat ./manifest | cpio -o -H newc -L | gzip -nc - > "$INITRD_IMAGE" | |
popd >/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment