Skip to content

Commit

Permalink
Merge branch 'v0.2.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
rimusz committed Oct 21, 2015
2 parents 99a6d4b + 0ed29f8 commit 39732f6
Show file tree
Hide file tree
Showing 20 changed files with 215 additions and 35 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ 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).

**New:** includes Go based Docker Registry v2 running on `192.168.64.1:5000`, which gets started/stopped on each VM Up/Halt. It is based on Kelsey Hightower [Docker Registry OS X Setup Guide](https://github.com/kelseyhightower/docker-registry-osx-setup-guide), thanks to Kelsey to sharing it with us.


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

Expand All @@ -22,10 +24,10 @@ 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) to be installed on the OS X
* [iTerm 2](http://www.iterm2.com/#/section/downloads) must be installed on the OS X for the App to be able to work.

####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.
* 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.

###Install:

Expand Down Expand Up @@ -77,8 +79,9 @@ Also under 'Up" local webserver `python -m SimpleHTTPServer 18000` serves custom
* `Updates/Fetch latest CoreOS ISO` will download the lasted CoreOS ISO file for the currently set release channel.
* [Fleet-UI](http://fleetui.com) dashboard will show running `fleet` units and etc
* [DockerUI](https://github.com/crosbymichael/dockerui) will show all running containers and etc
* Put your fleet units into `~/coreos-xhyve-ui/fleet` and they will be automaticly deployed on each VM boot.
* This App has as much automation as possible to make easier to use CoreOS on OS X, e.g. you can change CoreOS release channel and reload VM and your downloaded docker images will remain stored in an extra persistant disk.
* Put your fleet units into `~/coreos-xhyve-ui/my_fleet` folder and they will be automaticly started on each VM boot.
* You can upload your saved/exported docker images via `Upload docker images`
* This App has as much automation as possible to make easier to use CoreOS on OS X, e.g. you can change CoreOS release channel and reload VM as `root` persistant disk for VM will be created and mounted to `/` so data will survive VM reboots.

To-dos
-----------
Expand Down
Binary file modified coreos-xhyve-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/CoreOS-xhyve UI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
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 = (); }; };
134AB3351BD7D11400D55BC4 /* registry in Resources */ = {isa = PBXBuildFile; fileRef = 134AB3341BD7D11400D55BC4 /* registry */; settings = {ASSET_TAGS = (); }; };
134AB3371BD7ECAB00D55BC4 /* upload_docker_images.command in Resources */ = {isa = PBXBuildFile; fileRef = 134AB3361BD7ECAB00D55BC4 /* upload_docker_images.command */; settings = {ASSET_TAGS = (); }; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -80,6 +82,8 @@
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; };
134AB3341BD7D11400D55BC4 /* registry */ = {isa = PBXFileReference; lastKnownFileType = folder; path = registry; sourceTree = "<group>"; };
134AB3361BD7ECAB00D55BC4 /* upload_docker_images.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = upload_docker_images.command; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -175,6 +179,7 @@
isa = PBXGroup;
children = (
01663CBF1B667E13008D5D9F /* docker2aci */,
134AB3341BD7D11400D55BC4 /* registry */,
01D1B9881B60F2AD0059B73E /* xhyve */,
019662111B04C562005FA955 /* bin */,
01D1B9861B60D9A70059B73E /* start_VM.command */,
Expand All @@ -190,6 +195,7 @@
01CFC2DD1A2AA48300F251C2 /* reload.command */,
01AD94BE1A278C94009A400B /* fetch_latest_iso.command */,
01741B66190DB82100BB1F91 /* update_osx_clients_files.command */,
134AB3361BD7ECAB00D55BC4 /* upload_docker_images.command */,
);
name = Scripts;
sourceTree = "<group>";
Expand Down Expand Up @@ -266,6 +272,7 @@
buildActionMask = 2147483647;
files = (
019662121B04C562005FA955 /* bin in Resources */,
134AB3351BD7D11400D55BC4 /* registry in Resources */,
01E2854818A6C4E300BC630D /* InfoPlist.strings in Resources */,
01D3685918E5C184006510B5 /* icon.icns in Resources */,
01E285B818A6D7F400BC630D /* icon.png in Resources */,
Expand All @@ -280,6 +287,7 @@
0111FADB1A7FA2A20021F258 /* os_shell.command in Resources */,
019662141B04C598005FA955 /* settings in Resources */,
01E2855618A6C4E300BC630D /* Images.xcassets in Resources */,
134AB3371BD7ECAB00D55BC4 /* upload_docker_images.command in Resources */,
01D1B9871B60D9A70059B73E /* start_VM.command in Resources */,
019662181B04C6EA005FA955 /* files in Resources */,
01741B63190DB80500BB1F91 /* first-init.command in Resources */,
Expand Down
26 changes: 26 additions & 0 deletions src/CoreOS-xhyve UI/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,32 @@ - (IBAction)dockerUI:(id)sender {
}


- (IBAction)uploadDockerImages:(id)sender {
int vm_status=[self checkVMStatus];
//NSLog (@"VM status:\n%d", vm_status);

if (vm_status == 0) {
NSLog (@"VM is Off");
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"VM is Off !!!";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
}
else
{
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"Docker images upload window will be opened ...";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];

NSString *appName = [[NSString alloc] init];
NSString *arguments = [[NSString alloc] init];
[self runApp:appName = @"iTerm" arguments:arguments = [_resoucesPathFromApp stringByAppendingPathComponent:@"upload_docker_images.command"]];
}
}


// helping functions
- (void)runScript:(NSString*)scriptName arguments:(NSString*)arguments
{
Expand Down
7 changes: 7 additions & 0 deletions src/CoreOS-xhyve UI/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@
<action selector="dockerUI:" target="494" id="KoG-12-koe"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="mOo-Gt-R7Y"/>
<menuItem title="Upload docker images" id="78F-Ma-der">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="uploadDockerImages:" target="494" id="TpT-N3-aUr"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="Gmy-Y5-bmI"/>
<menuItem title="Updates" id="VT6-tu-oxP" userLabel="Menu Item - Updates">
<modifierMask key="keyEquivalentModifierMask"/>
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.5</string>
<string>0.2.6</string>
<key>CFBundleVersion</key>
<string>69</string>
<string>71</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
31 changes: 31 additions & 0 deletions src/bin/docker_registry
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# docker registry for coreos-xhyve

# get App's Resources folder
res_folder=$(cat ~/coreos-xhyve-ui/.env/resouces_path)

start() {
echo "Starting docker registry on 192.168.64.1:5000 ..."
nohup "${res_folder}"/bin/registry "${res_folder}"/registry/config.yml >/dev/null 2>&1 &
}

stop() {
kill $(ps aux | grep "[r]egistry" | awk {'print $2'}) >/dev/null 2>&1 &
}

usage() {
echo "Usage: docker_registry start|stop"
}

case "$1" in
start)
start
;;
stop)
stop
;;
*)
usage
;;
esac

Binary file added src/bin/registry
Binary file not shown.
4 changes: 3 additions & 1 deletion src/coreos-xhyve-install.command
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
mkdir ~/coreos-xhyve-ui/bin
mkdir ~/coreos-xhyve-ui/cloud-init
mkdir ~/coreos-xhyve-ui/fleet
###mkdir ~/coreos-xhyve-ui/docker_images
mkdir ~/coreos-xhyve-ui/my_fleet
mkdir ~/coreos-xhyve-ui/registry
mkdir ~/coreos-xhyve-ui/docker_images
###mkdir ~/coreos-xhyve-ui/rkt_images

# cd to App's Resources folder
Expand Down
16 changes: 0 additions & 16 deletions src/create_extra_disk.command

This file was deleted.

3 changes: 3 additions & 0 deletions src/destroy.command
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ do
# delete root image
rm -f ~/coreos-xhyve-ui/root.img

# Stop docker registry
"${res_folder}"/bin/docker_registry stop

echo "-"
echo "Done, please start VM with 'Up' and the VM will be recreated ..."
echo " "
Expand Down
12 changes: 12 additions & 0 deletions src/first-init.command
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ echo " "
# create ROOT disk
create_root_disk

# Start docker registry
cd ~/coreos-xhyve-ui
# stop first just in case it was running
"${res_folder}"/bin/docker_registry stop
# start
"${res_folder}"/bin/docker_registry start
#

echo " "
# Start VM
echo "Starting VM ..."
Expand Down Expand Up @@ -85,6 +93,10 @@ echo " "
download_osx_clients
#

# Set the environment variables
# docker daemon
export DOCKER_HOST=tcp://$vm_ip:2375

# set fleetctl endpoint and install fleet units
export FLEETCTL_ENDPOINT=http://$vm_ip:2379
export FLEETCTL_DRIVER=etcd
Expand Down
14 changes: 11 additions & 3 deletions src/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,20 @@ function deploy_fleet_units() {
if [ "$(ls ~/coreos-xhyve-ui/fleet | grep -o -m 1 service)" = "service" ]
then
cd ~/coreos-xhyve-ui/fleet
echo "Starting all fleet units in ~/kube-solo/fleet:"
echo "Starting all fleet units in ~/coreos-xhyve-ui/fleet:"
fleetctl submit *.service
fleetctl start *.service
echo " "
echo "fleetctl list-units:"
fleetctl list-units
fi
}

function deploy_my_fleet_units() {
# deploy fleet units from ~/coreos-xhyve-ui/fleet
if [ "$(ls ~/coreos-xhyve-ui/my_fleet | grep -o -m 1 service)" = "service" ]
then
cd ~/coreos-xhyve-ui/my_fleet
echo "Starting all fleet units in ~/coreos-xhyve-ui/my_fleet:"
fleetctl start *.service
echo " "
fi
}
Expand Down
4 changes: 4 additions & 0 deletions src/halt.command
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
# get App's Resources folder
res_folder=$(cat ~/coreos-xhyve-ui/.env/resouces_path)

# Stop docker registry
"${res_folder}"/bin/docker_registry stop

# get VM IP
#vm_ip=$( ~/coreos-xhyve-ui/mac2ip.sh $(cat ~/coreos-xhyve-ui/.env/mac_address))
vm_ip=$(cat ~/coreos-xhyve-ui/.env/ip_address)

# send halt to VM
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no core@$vm_ip sudo halt

16 changes: 16 additions & 0 deletions src/registry/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 0.1
log:
level: info
fields:
service: registry
environment: mac
storage:
cache:
layerinfo: inmemory
filesystem:
rootdirectory: registry
http:
addr: 0.0.0.0:5000
secret: mytokensecret
debug:
addr: localhost:5001
21 changes: 21 additions & 0 deletions src/registry/get_it.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# compile docker registry binary

current_folder=$(pwd)

# clean up go folder
rm -fr mkdir -p $GOPATH/src/github.com/docker
# Checkout the Docker Distribution source tree
mkdir -p $GOPATH/src/github.com/docker
git clone https://github.com/docker/distribution.git $GOPATH/src/github.com/docker/distribution
cd $GOPATH/src/github.com/docker/distribution

# build
GOPATH=$(PWD)/Godeps/_workspace:$GOPATH make binaries

cd $current_folder
cp -f $GOPATH/src/github.com/docker/distribution/bin/registry ../files

# clean up go folder
rm -fr mkdir -p $GOPATH/src/github.com/docker
4 changes: 2 additions & 2 deletions src/reload.command
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ echo "fleetctl list-machines:"
fleetctl list-machines
echo ""

# deploy fleet units from ~/coreos-xhyve-ui/fleet
deploy_fleet_units
# deploy fleet units from ~/coreos-xhyve-ui/my_fleet
deploy_my_fleet_units
#

echo "CoreOS VM was reloaded !!!"
Expand Down
2 changes: 2 additions & 0 deletions src/start_VM.command
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ export XHYVE=~/coreos-xhyve-ui/bin/xhyve

# Stop webserver
"${res_folder}"/bin/webserver stop


24 changes: 17 additions & 7 deletions src/up.command
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,20 @@ check_for_images

new_vm=0
# check if root disk exists, if not create it
if [ ! -f $HOME/kube-solo/root.img ]; then
if [ ! -f $HOME/coreos-xhyve-ui/root.img ]; then
echo " "
echo "ROOT disk does not exits, it will be created now ..."
create_root_disk
new_vm=1
fi

# Start docker registry
cd ~/coreos-xhyve-ui
# stop first just in case it was running
"${res_folder}"/bin/docker_registry stop
# start
"${res_folder}"/bin/docker_registry start

# Start VM
rm -f ~/coreos-xhyve-ui/.env/.console
echo " "
Expand Down Expand Up @@ -88,15 +95,18 @@ echo " "
# deploy fleet units
if [ $new_vm = 1 ]
then
echo " "
deploy_fleet_units
else
echo " "
echo "fleetctl list-units:"
fleetctl list-units
echo " "
fi

# deploy fleet units from my_fleet folder
deploy_my_fleet_units

#
echo "fleetctl list-units:"
fleetctl list-units
echo " "

#
cd ~/coreos-xhyve-ui

# open bash shell
Expand Down
Loading

0 comments on commit 39732f6

Please sign in to comment.