Skip to content

Commit

Permalink
v0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
rimusz committed Oct 20, 2015
1 parent 8d9c3a0 commit cf7a9bf
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 103 deletions.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ CoreOS-xhyve UI for OS X

CoreOS-xhyve UI for Mac OS X is a Mac Status bar App which works like a wrapper around the [coreos-xhyve](https://github.com/coreos/coreos-xhyve) command line tool. It supports only a standalone CoreOS VM, cluster one (Vagrant based) is at [CoreOS-Vagrant Cluster GUI](https://github.com/rimusz/coreos-osx-gui-cluster).

Fully supports etcd2 in all CoresOS channels.


![CoreOS-xhyve-UI](coreos-xhyve-ui.png "CoreOS-xhyve-UI")

Expand All @@ -24,8 +22,7 @@ by [xhyve](https://github.com/mist64/xhyve). To get around this you either have


####Required software:
* The only required software is [iTerm 2](http://www.iterm2.com/#/section/downloads)
* As [xhyve](https://github.com/mist64/xhyve) comes with the App.
* The only required software is [iTerm 2](http://www.iterm2.com/#/section/downloads) to be installed on the OS X

####Download:
* Download `CoreOS-xhyve UI latest.dmg` from the [Releases Page](https://github.com/rimusz/coreos-xhyve-ui/releases), open it and drag the App e.g to your Desktop.
Expand All @@ -48,7 +45,7 @@ That allows to share the same images between different coreos-xhyve Apps and als
- `docker-exec `script (docker exec -it $1 bash -c 'export TERM=xterm && bash') is installed
into ~/coreos-xhyve-ui/bin/ too, which allows to enter container with just a simple command:
docker-exec container_name
- Also `docker2aci` binary will be installed to ~/coreos-xhyve-ui/bin/, which allows to convert docker images to rkt aci images
- Also `docker2aci` binary will be installed to ~/coreos-xhyve-ui/bin/, which allows to convert docker images to `rkt` aci images
- Will install DockerUI and Fleet-UI via unit files
- Via assigned static IP (it will be shown in first boot and will survive VM's reboots) you can access any port on CoreOS VM
- user-data file enables docker flag `--insecure-registry` to access insecure registries.
Expand Down Expand Up @@ -85,9 +82,7 @@ Also under 'Up" local webserver `python -m SimpleHTTPServer 18000` serves custom

To-dos
-----------
* Add Kubernetes solo cluster setup as an extra Add-on option
* Mount /Users folder via nfs to CoreOS VM
* Enable/disable menu option depending on VM's status

Credits
-----------
Expand Down
4 changes: 4 additions & 0 deletions src/CoreOS-xhyve UI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
01E2855418A6C4E300BC630D /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 01E2855218A6C4E300BC630D /* MainMenu.xib */; };
01E2855618A6C4E300BC630D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 01E2855518A6C4E300BC630D /* Images.xcassets */; };
01E285B818A6D7F400BC630D /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 01E285B718A6D7F400BC630D /* icon.png */; };
131C2B7F1BD686CB002FF9BE /* fleet in Resources */ = {isa = PBXBuildFile; fileRef = 131C2B7E1BD686CB002FF9BE /* fleet */; settings = {ASSET_TAGS = (); }; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -78,6 +79,7 @@
01E2855518A6C4E300BC630D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
01E2855C18A6C4E300BC630D /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
01E285B718A6D7F400BC630D /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
131C2B7E1BD686CB002FF9BE /* fleet */ = {isa = PBXFileReference; lastKnownFileType = folder; path = fleet; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -97,6 +99,7 @@
children = (
019662171B04C6EA005FA955 /* files */,
019662131B04C598005FA955 /* settings */,
131C2B7E1BD686CB002FF9BE /* fleet */,
01741B56190DB7B800BB1F91 /* coreos-xhyve-install.command */,
01741B62190DB80500BB1F91 /* first-init.command */,
);
Expand Down Expand Up @@ -283,6 +286,7 @@
01B675D61B602FC2004349CC /* check_vm_status.command in Resources */,
0106B34A1B65277F001709E0 /* functions.sh in Resources */,
01741B57190DB7B800BB1F91 /* coreos-xhyve-install.command in Resources */,
131C2B7F1BD686CB002FF9BE /* fleet in Resources */,
01CFC2DE1A2AA48300F251C2 /* change_release_channel.command in Resources */,
01E2854E18A6C4E300BC630D /* Credits.rtf in Resources */,
01E2855418A6C4E300BC630D /* MainMenu.xib in Resources */,
Expand Down
8 changes: 4 additions & 4 deletions src/CoreOS-xhyve UI/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,12 @@ - (IBAction)initialInstall:(id)sender
- (IBAction)About:(id)sender {

NSString *version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
NSString *build = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
NSString *app_version = [NSString stringWithFormat:@"%@%@.%@", @"v", version, build];
//NSString *app_version = [NSString stringWithFormat:@"%@", version];
// NSString *build = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
// NSString *app_version = [NSString stringWithFormat:@"%@%@.%@", @"v", version, build];
NSString *app_version = [NSString stringWithFormat:@"%@%@", @"v", version];

NSString *mText = [NSString stringWithFormat:@"%@ %@", @"CoreOS-xhyve UI for OS X", app_version];
NSString *infoText = @"It is a simple wrapper around the CoreOS-xhyve, which allows to control it via the Status Bar !!!";
NSString *infoText = @"It is a simple wrapper around the xhyve + CoreOS VM, which allows to control VM via the Status Bar App !!!";
[self displayWithMessage:mText infoText:infoText];
}

Expand Down
4 changes: 2 additions & 2 deletions src/CoreOS-xhyve UI/CoreOS-xhyve UI-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.2.4</string>
<string>0.2.5</string>
<key>CFBundleVersion</key>
<string>67</string>
<string>69</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion src/bin/coreos-xhyve-fetch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -e -o pipefail
#set -e -o pipefail

OPTIND=1
while getopts ":f:" opt; do
Expand Down
Binary file added src/bin/wget
Binary file not shown.
11 changes: 6 additions & 5 deletions src/coreos-xhyve-install.command
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
# create in "coreos-xhyve-ui" all required folders and files at user's home folder where all the data will be stored
mkdir -p ~/.coreos-xhyve/imgs
mkdir ~/coreos-xhyve-ui
ln -s ~/.coreos-xhyve/imgs ~/coreos-xhyve-ui/imgs
mkdir ~/coreos-xhyve-ui/tmp
mkdir ~/coreos-xhyve-ui/bin
mkdir ~/coreos-xhyve-ui/cloud-init
mkdir ~/coreos-xhyve-ui/fleet
ln -s ~/.coreos-xhyve/imgs ~/coreos-xhyve-ui/imgs
###mkdir ~/coreos-xhyve-ui/docker_images
###mkdir ~/coreos-xhyve-ui/rkt_images
###mkdir ~/coreos-xhyve-ui/share
###chmod -R 777 ~/coreos-xhyve-ui/share

# cd to App's Resources folder
cd "$1"
Expand All @@ -31,7 +29,10 @@

# copy custom.conf
cp -f "$1"/settings/custom.conf ~/coreos-xhyve-ui
cp -f "$1"/settings/custom-format-root.conf ~/coreos-xhyve-ui

# copy fleet units
cp -R "$1"/fleet/ ~/coreos-xhyve-ui/fleet
#

# initial init
open -a "$1"/iTerm.app "$1"/first-init.command
open -a iTerm.app "$1"/first-init.command
2 changes: 1 addition & 1 deletion src/destroy.command
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ do
status=$(ps aux | grep "[c]oreos-xhyve-ui/bin/xhyve" | awk '{print $2}')
if [[ $status = *[!\ ]* ]]; then
echo " "
echo "CoreOS VM is running, it will be stopped !!!"
echo "CoreOS VM is running, it will be stopped !!!"

# Stop VM
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no core@$vm_ip sudo halt
Expand Down
15 changes: 7 additions & 8 deletions src/first-init.command
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ res_folder=$(cat ~/coreos-xhyve-ui/.env/resouces_path)
export PATH=${HOME}/coreos-xhyve-ui/bin:$PATH

echo " "
echo "Setting up CoreOS-xhyve VM on OS X"
echo "Setting up xhyve + CoreOS VM on OS X"

# add ssh key to custom.conf
echo " "
Expand All @@ -33,12 +33,7 @@ fi
#

# save user password to file
echo " "
echo "Your Mac user password will be saved to '~/coreos-xhyve-ui/.env/password' "
echo "and later one used for 'sudo' commnand to start VM !!!"
echo "Please type your Mac user's password followed by [ENTER]:"
read -s password
echo -n ${password} | base64 > ~/coreos-xhyve-ui/.env/password
save_password
#

# Set release channel
Expand Down Expand Up @@ -97,7 +92,9 @@ export FLEETCTL_STRICT_HOST_KEY_CHECKING=false
echo "fleetctl list-machines:"
fleetctl list-machines
echo " "

#
deploy_fleet_units
echo " "
#

echo "Installation has finished, CoreOS VM is up and running !!!"
Expand All @@ -108,7 +105,9 @@ echo "Enjoy CoreOS-xhyve VM on your Mac !!!"
echo " "
echo "Run from menu 'OS Shell' to open a terninal window with rkt, docker, fleetctl and etcdctl pre-set !!!"
echo " "

pause 'Press [Enter] key to continue...'

sleep 50


21 changes: 21 additions & 0 deletions src/fleet/dockerui.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[Unit]
Description=DockerUI Service
After=docker.service
Requires=docker.service

[Service]
User=core
TimeoutStartSec=0
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker pull dockerui/dockerui:latest
ExecStartPre=-/usr/bin/docker rm dockerui
ExecStart=/usr/bin/docker run --rm --name dockerui --memory="128m" \
-p 9000:9000 \
-v /var/run/docker.sock:/docker.sock \
dockerui/dockerui -e /docker.sock
#
ExecStop=/usr/bin/docker stop dockerui
ExecStopPost=-/usr/bin/docker rm dockerui

Restart=always
RestartSec=10s
23 changes: 23 additions & 0 deletions src/fleet/fleet-ui.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[Unit]
Description=fleet-ui
After=docker.service
Requires=docker.service

[Service]
User=core
TimeoutStartSec=0
EnvironmentFile=/etc/network-environment
ExecStartPre=-/usr/bin/docker pull purpleworks/fleet-ui:latest
ExecStartPre=-/usr/bin/docker rm fleet_ui
ExecStart=/usr/bin/docker run --rm --name fleet_ui --memory="128m" \
-p 3000:3000 -e ETCD_PEER=http://172.17.42.1:2379 \
-v /home/core/.ssh/id_rsa:/root/id_rsa \
purpleworks/fleet-ui
#
ExecStop=/usr/bin/docker stop fleet_ui
ExecStopPost=-/usr/bin/docker rm fleet_ui

TimeoutStartSec=900s
Restart=always
RestartSec=10s

47 changes: 33 additions & 14 deletions src/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ do
VALID_MAIN=1
sed -i "" "s/CHANNEL=stable/CHANNEL=alpha/" ~/coreos-xhyve-ui/custom.conf
sed -i "" "s/CHANNEL=beta/CHANNEL=alpha/" ~/coreos-xhyve-ui/custom.conf
sed -i "" "s/CHANNEL=stable/CHANNEL=alpha/" ~/coreos-xhyve-ui/custom-format-root.conf
sed -i "" "s/CHANNEL=beta/CHANNEL=alpha/" ~/coreos-xhyve-ui/custom-format-root.conf
channel="Alpha"
LOOP=0
fi
Expand All @@ -54,8 +52,6 @@ do
VALID_MAIN=1
sed -i "" "s/CHANNEL=alpha/CHANNEL=beta/" ~/coreos-xhyve-ui/custom.conf
sed -i "" "s/CHANNEL=stable/CHANNEL=beta/" ~/coreos-xhyve-ui/custom.conf
sed -i "" "s/CHANNEL=alpha/CHANNEL=beta/" ~/coreos-xhyve-ui/custom-format-root.conf
sed -i "" "s/CHANNEL=stable/CHANNEL=beta/" ~/coreos-xhyve-ui/custom-format-root.conf
channel="Beta"
LOOP=0
fi
Expand All @@ -65,8 +61,6 @@ do
VALID_MAIN=1
sed -i "" "s/CHANNEL=alpha/CHANNEL=stable/" ~/coreos-xhyve-ui/custom.conf
sed -i "" "s/CHANNEL=beta/CHANNEL=stable/" ~/coreos-xhyve-ui/custom.conf
sed -i "" "s/CHANNEL=alpha/CHANNEL=stable/" ~/coreos-xhyve-ui/custom-format-root.conf
sed -i "" "s/CHANNEL=beta/CHANNEL=stable/" ~/coreos-xhyve-ui/custom-format-root.conf
channel="Stable"
LOOP=0
fi
Expand All @@ -83,17 +77,18 @@ create_root_disk() {
# create persistent disk
cd ~/coreos-xhyve-ui/
echo " "
echo "Please type ROOT disk size in GB followed by [ENTER]:"
echo "Please type ROOT disk size in GBs followed by [ENTER]:"
echo -n [default is 5]:
read disk_size
if [ -z "$disk_size" ]
then
echo "Creating 5GB disk ..."
dd if=/dev/zero of=root.img bs=1024 count=0 seek=$[1024*5120]
echo "Creating 5GB disk ..."
dd if=/dev/zero of=root.img bs=1024 count=0 seek=$[1024*5120]
else
echo "Creating "$disk_size"GB disk ..."
dd if=/dev/zero of=root.img bs=1024 count=0 seek=$[1024*$disk_size*1024]
echo "Creating "$disk_size"GB disk ..."
dd if=/dev/zero of=root.img bs=1024 count=0 seek=$[1024*$disk_size*1024]
fi
echo " "
#

### format ROOT disk
Expand All @@ -109,8 +104,21 @@ echo -e "$my_password\n" | sudo -S ls > /dev/null 2>&1
echo "Waiting for VM to boot up for ROOT disk to be formated ... "
cd ~/coreos-xhyve-ui
export XHYVE=~/coreos-xhyve-ui/bin/xhyve
"${res_folder}"/bin/coreos-xhyve-run -f custom-format-root.conf coreos-xhyve-ui

# enable format mode
sed -i "" "s/user-data/user-data-format-root/" ~/coreos-xhyve-ui/custom.conf
sed -i "" "s/ROOT_HDD=/#ROOT_HDD=/" ~/coreos-xhyve-ui/custom.conf
sed -i "" "s/#IMG_HDD=/IMG_HDD=/" ~/coreos-xhyve-ui/custom.conf
#
"${res_folder}"/bin/coreos-xhyve-run -f custom.conf coreos-xhyve-ui
#
# disable format mode
sed -i "" "s/user-data-format-root/user-data/" ~/coreos-xhyve-ui/custom.conf
sed -i "" "s/IMG_HDD=/#IMG_HDD=/" ~/coreos-xhyve-ui/custom.conf
sed -i "" "s/#ROOT_HDD=/ROOT_HDD=/" ~/coreos-xhyve-ui/custom.conf
#

echo " "
echo "ROOT disk got created and formated... "
echo " "

Expand Down Expand Up @@ -185,8 +193,8 @@ function deploy_fleet_units() {
if [ "$(ls ~/coreos-xhyve-ui/fleet | grep -o -m 1 service)" = "service" ]
then
cd ~/coreos-xhyve-ui/fleet
echo " "
echo "Starting all fleet units in ~/coreos-xhyve-ui/fleet:"
echo "Starting all fleet units in ~/kube-solo/fleet:"
fleetctl submit *.service
fleetctl start *.service
echo " "
echo "fleetctl list-units:"
Expand All @@ -196,3 +204,14 @@ fi
}


function save_password {
# save user password to file
echo " "
echo "Your Mac user password will be saved to '~/coreos-xhyve-ui/.env/password' "
echo "and later one used for 'sudo' commnand to start VM !!!"
echo "Please type your Mac user's password followed by [ENTER]:"
read -s password
echo -n ${password} | base64 > ~/coreos-xhyve-ui/.env/password
echo " "
}

7 changes: 0 additions & 7 deletions src/settings/custom-format-root.conf

This file was deleted.

1 change: 1 addition & 0 deletions src/settings/custom.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ MEMORY=2048
CHANNEL=beta
CLOUD_CONFIG=http://192.168.64.1:18000/user-data
UUID=4420CA07-3C45-4110-86D7-D999D9FB6E2E
#IMG_HDD="-s 4,virtio-blk,root.img"
ROOT_HDD="root.img"
Loading

0 comments on commit cf7a9bf

Please sign in to comment.