Skip to content

Commit

Permalink
Merge pull request #1 from rimusz/v0.2.1
Browse files Browse the repository at this point in the history
V0.2.1
  • Loading branch information
rimusz committed Jul 27, 2015
2 parents 4ce3565 + ae46a6f commit ec27e18
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 282 deletions.
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,32 @@ How to install CoreOS-xhyve UI

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

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

###Install:
* Start the `CoreOS-xhyve UI` and from menu `Setup` choose `Initial setup of CoreOS-xhyve UI`
* The install will do the following:

````
1) All dependent files/folders will be put under "coreos-xhyve-ui" folder in the user's home
folder e.g /Users/someuser/coreos-xhyve-ui
2) user-data file will have fleet, etcd, and Docker Socket for the API enabled
3) Will download latest vagrant VBox and run "vagrant up" to initialise VM with docker 2375 port pre-set for docker OS X client
4) Will download and install fleet, etcd and docker OS X clients to ~/coreos-xhyve-ui/bin/
5) A small shell script "rkt" will be installed to ~/coreos-xhyve-ui/bin/ which allows to call remote rkt binary on CoreOS VM with e.g rkt help
6) docker-exec script (docker exec -it $1 bash -c 'export TERM=xterm && bash') is installed
Start the `CoreOS-xhyve UI` and from menu `Setup` choose `Initial setup of CoreOS-xhyve UI`
and the install will do the following:


- All dependent files/folders will be put under "coreos-xhyve-ui" folder in the user's home folder e.g /Users/someuser/coreos-xhyve-ui
- user-data file will have fleet, etcd, and Docker Socket for the API enabled
- Will download latest vagrant VBox and run "vagrant up" to initialise VM with docker 2375 port pre-set for docker OS X client
- Will download and install fleet, etcd and docker OS X clients to ~/coreos-xhyve-ui/bin/
- A small shell script "rkt" will be installed to ~/coreos-xhyve-ui/bin/ which allows to call remote rkt binary on CoreOS VM with e.g rkt help
- 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
7) Will install DockerUI and Fleet-UI via unit files
8) 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
9) user-data file enables docker flag `--insecure-registry` to access insecure registries.
10) Extra persistant disk will be created and mounted to /var/lib/docker
11) ISO images are stored under ~/.coreos-xhyve/imgs and symlinked from ~/coreos-xhyve-ui/imgs.
- 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.
- Extra persistant disk will be created and mounted to /var/lib/docker
- ISO images are stored under ~/.coreos-xhyve/imgs and symlinked from ~/coreos-xhyve-ui/imgs.
That allows to share the same images between different coreos-xhyve Apps and also speeds ups this Apps reinstall.
````


How it works
------------
Expand Down Expand Up @@ -78,7 +78,7 @@ Also under 'Up" local webserver `python -m SimpleHTTPServer 18000` serves custom
To-dos
-----------
* 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 @@ -10,6 +10,7 @@
0106B34A1B65277F001709E0 /* functions.sh in Resources */ = {isa = PBXBuildFile; fileRef = 0106B3491B65277F001709E0 /* functions.sh */; };
0111FADB1A7FA2A20021F258 /* os_shell.command in Resources */ = {isa = PBXBuildFile; fileRef = 0111FADA1A7FA2A10021F258 /* os_shell.command */; };
0145318418FF209D007F9C95 /* coreos-xhyve.command in Resources */ = {isa = PBXBuildFile; fileRef = 0145318318FF209D007F9C95 /* coreos-xhyve.command */; };
01663CC01B667E13008D5D9F /* docker2aci in Resources */ = {isa = PBXBuildFile; fileRef = 01663CBF1B667E13008D5D9F /* docker2aci */; };
01741B57190DB7B800BB1F91 /* coreos-xhyve-install.command in Resources */ = {isa = PBXBuildFile; fileRef = 01741B56190DB7B800BB1F91 /* coreos-xhyve-install.command */; };
01741B63190DB80500BB1F91 /* first-init.command in Resources */ = {isa = PBXBuildFile; fileRef = 01741B62190DB80500BB1F91 /* first-init.command */; };
01741B65190DB81400BB1F91 /* up.command in Resources */ = {isa = PBXBuildFile; fileRef = 01741B64190DB81400BB1F91 /* up.command */; };
Expand Down Expand Up @@ -43,6 +44,7 @@
0111FADA1A7FA2A10021F258 /* os_shell.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = os_shell.command; sourceTree = "<group>"; };
0133608F18A70E0C0024B1CB /* CoreOS-xhyve UI.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "CoreOS-xhyve UI.entitlements"; sourceTree = "<group>"; };
0145318318FF209D007F9C95 /* coreos-xhyve.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "coreos-xhyve.command"; sourceTree = "<group>"; };
01663CBF1B667E13008D5D9F /* docker2aci */ = {isa = PBXFileReference; lastKnownFileType = folder; path = docker2aci; sourceTree = "<group>"; };
01741B56190DB7B800BB1F91 /* coreos-xhyve-install.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "coreos-xhyve-install.command"; sourceTree = SOURCE_ROOT; };
01741B62190DB80500BB1F91 /* first-init.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "first-init.command"; sourceTree = SOURCE_ROOT; };
01741B64190DB81400BB1F91 /* up.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = up.command; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -169,6 +171,7 @@
01E285B918A6E23C00BC630D /* Scripts */ = {
isa = PBXGroup;
children = (
01663CBF1B667E13008D5D9F /* docker2aci */,
01D1B9881B60F2AD0059B73E /* xhyve */,
019662111B04C562005FA955 /* bin */,
01D1B9861B60D9A70059B73E /* CoreOS-xhyve_UI_VM.command */,
Expand Down Expand Up @@ -284,6 +287,7 @@
01E2854E18A6C4E300BC630D /* Credits.rtf in Resources */,
01E2855418A6C4E300BC630D /* MainMenu.xib in Resources */,
01741B67190DB82100BB1F91 /* update_osx_clients_files.command in Resources */,
01663CC01B667E13008D5D9F /* docker2aci in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
176 changes: 126 additions & 50 deletions src/CoreOS-xhyve UI/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ - (IBAction)Start:(id)sender {


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

if (vm_status == 0) {
Expand All @@ -154,6 +154,17 @@ - (IBAction)Stop:(id)sender {
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"VM is stopping !!!";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];

int vm_status_check = 1;
while (vm_status_check == 1 ) {
vm_status_check = [self checkVMStatus];
if (vm_status_check == 0) {
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"VM is OFF !!!";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
break;
}
}
}
}

Expand Down Expand Up @@ -302,9 +313,9 @@ - (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:@"%@.%@", 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:@"%@", 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 !!!";
Expand All @@ -314,75 +325,140 @@ - (IBAction)About:(id)sender {
//

- (IBAction)attachConsole:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"VM's console will be opened";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
int vm_status=[self checkVMStatus];
//NSLog (@"VM status:\n%d", vm_status);

NSString *appName = [[NSString alloc] init];
NSString *arguments = [[NSString alloc] init];
[self runApp:appName = @"iTerm" arguments:arguments = [_resoucesPathFromApp stringByAppendingPathComponent:@"console.command"]];
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
{
NSLog (@"VM is On");
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"VM's console 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:@"console.command"]];
}
}


- (IBAction)runShell:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"OS X shell will be opened";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
int vm_status=[self checkVMStatus];
//NSLog (@"VM status:\n%d", vm_status);

NSString *appName = [[NSString alloc] init];
NSString *arguments = [[NSString alloc] init];
[self runApp:appName = @"iTerm" arguments:arguments = [_resoucesPathFromApp stringByAppendingPathComponent:@"os_shell.command"]];
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
{
NSLog (@"VM is On");
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"OS X shell 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:@"os_shell.command"]];
}
}

- (IBAction)runSsh:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"VM ssh shell will be opened";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
int vm_status=[self checkVMStatus];
//NSLog (@"VM status:\n%d", vm_status);

NSString *appName = [[NSString alloc] init];
NSString *arguments = [[NSString alloc] init];
[self runApp:appName = @"iTerm" arguments:arguments = [_resoucesPathFromApp stringByAppendingPathComponent:@"coreos-xhyve.command"]];
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
{
NSLog (@"VM is On");
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"VM ssh shell 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:@"coreos-xhyve.command"]];
}
}


- (IBAction)fleetUI:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"Fleet UI dashboard will be opened";
int vm_status=[self checkVMStatus];
//NSLog (@"VM status:\n%d", vm_status);

[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
NSString *file_path = [NSHomeDirectory() stringByAppendingPathComponent:@"coreos-xhyve-ui/.env/ip_address"];
// read IP from file
NSString *vm_ip = [NSString stringWithContentsOfFile:file_path
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
{
NSLog (@"VM is On");
NSString *file_path = [NSHomeDirectory() stringByAppendingPathComponent:@"coreos-xhyve-ui/.env/ip_address"];
// read IP from file
NSString *vm_ip = [NSString stringWithContentsOfFile:file_path
encoding:NSUTF8StringEncoding
error:NULL];
NSString *url = [@[@"http://",vm_ip,@":3000"] componentsJoinedByString:@""];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]];
NSString *url = [@[@"http://",vm_ip,@":3000"] componentsJoinedByString:@""];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]];
}
}

- (IBAction)dockerUI:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"CoreOS-xhyve UI";
notification.informativeText = @"DockerUI dashboard wiil opened";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
int vm_status=[self checkVMStatus];
//NSLog (@"VM status:\n%d", vm_status);

NSString *file_path = [NSHomeDirectory() stringByAppendingPathComponent:@"coreos-xhyve-ui/.env/ip_address"];
// read IP from file
NSString *vm_ip = [NSString stringWithContentsOfFile:file_path
encoding:NSUTF8StringEncoding
error:NULL];
NSString *url = [@[@"http://",vm_ip,@":9000"] componentsJoinedByString:@""];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]];
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
{
NSLog (@"VM is On");
NSString *file_path = [NSHomeDirectory() stringByAppendingPathComponent:@"coreos-xhyve-ui/.env/ip_address"];
// read IP from file
NSString *vm_ip = [NSString stringWithContentsOfFile:file_path
encoding:NSUTF8StringEncoding
error:NULL];
NSString *url = [@[@"http://",vm_ip,@":9000"] componentsJoinedByString:@""];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]];
}
}


// helping functions
- (void)runScript:(NSString*)scriptName arguments:(NSString*)arguments
{
NSTask *task = [[NSTask alloc] init];
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.0</string>
<string>0.2.1</string>
<key>CFBundleVersion</key>
<string>51</string>
<string>55</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
Binary file modified src/bin/xhyve
Binary file not shown.
7 changes: 7 additions & 0 deletions src/docker2aci/get_it.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# get go binary of docker2aci

rm -f ~/golang/bin/docker2aci
go get github.com/appc/docker2aci
cp -f ~/golang/bin/docker2aci ../files
Binary file modified src/files/docker2aci
Binary file not shown.
Loading

0 comments on commit ec27e18

Please sign in to comment.