Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
rimusz committed Nov 30, 2014
2 parents 4f80045 + 0f536ed commit dfb4e7d
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 45 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ Required software
* Start the `CoreOS Cluster GUI` and from menu `Setup` choose `Initial setup of CoreOS-Vagrant Cluster`
* The install will do the following:
````
1) All dependent files/folders will be put under "coreos-osx-cluster" folder in the user's home folder e.g /Users/someuser/coreos-osx-cluster
1) All dependent files/folders will be put under 'coreos-osx-cluster' folder in the user's
home folder e.g '/Users/someuser/coreos-osx-cluster'
2) Will clone latest coreos-vagrant from git
3) user-data file will have fleet and etcd set
4) 3 cluster nodes will be set with IPs: '172.17.8.100, 172.17.8.101 and 172.17.8.102'
4) 3 cluster nodes will be set with IPs: '172.17.9.100, 172.17.9.101 and 172.17.9.102'
5) Will download and install fleetctl and etcdctl clients to ~/coreos-osx-cluster/bin/
6) Will download latest vagrant VBox and run vagrant up to initialise VM
8) Will forward port 2322 from localhost to core-01 ssh port 22.
8) Will forward port 2322 from localhost to corec-01 ssh port 22.
````

How it works
Expand All @@ -40,13 +41,15 @@ Just start `CoreOS Cluster GUI` application and you will find a small icon with
* There you can `Up`, `Suspend`, `Halt`, `Reload` CoreOS vagrant VMs
* Under `Up & OS shell` OS Shell will be opened when `vagrant up` finishes and it will have such environment set:
````
1) Path to ~/coreos-osx-cluster/bin where etcdclt and fleetctl binaries are stored
2) FLEETCTL_TUNNEL=127.0.0.1:2322 for the fleetctl tunnel to work properly
1) etcd discovery token will be automaticly replaced from 'https://discovery.etcd.io/new'
on each 'vagrant up'
2) Path to ~/coreos-osx-cluster/bin where etcdclt and fleetctl binaries are stored
3) FLEETCTL_TUNNEL=127.0.0.1:2322 for the fleetctl tunnel to work properly
````

* `Updates/Force CoreOS update` will run `sudo update_engine_client -update` on CoreOS VMs.
* `Updates/Force CoreOS update` will be run `sudo update_engine_client -update` on each CoreOS VM.
* `Updates/Check for updates` will update etcdclt and fleetctl OS X clients to the same versions as CoreOS VMs run. It will store downloads from github `coreos-vagrant` in `~/coreos-osx-cluster/github` folder, it will not overwrite user's `Vagrantfile, config.rb and users-data` files.
* `SSH to core1/2/3` menu options will open VM shell
* `SSH to corec-01/02/03` menu options will open VM shells


Other links
Expand Down
Binary file modified coreos-vagrant-cluster-gui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 47 additions & 13 deletions src/CoreOS Cluster GUI/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,29 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
}
else
{
NSString *msg = [NSString stringWithFormat:@"%@ ", @"CoreOS-Vagrant Cluster was not set, run from menu 'Setup' - 'Initial setup of CoreOS-Vagrant Cluster' to do that !!! "];
[self displayWithMessage:@"CoreOS-Vagrant Cluster" infoText:msg];
// NSString *msg = [NSString stringWithFormat:@"%@ ", @"CoreOS-Vagrant Cluster was not set, run from menu 'Setup' - 'Initial setup of CoreOS-Vagrant Cluster' !!! "];
// [self displayWithMessage:@"CoreOS-Vagrant Cluster" infoText:msg];

NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:@"OK"];
[alert addButtonWithTitle:@"Cancel"];
[alert setMessageText:@"CoreOS-Vagrant Cluster was not set."];
[alert setInformativeText:@"Do you want to set it up?"];
[alert setAlertStyle:NSWarningAlertStyle];

if ([alert runModal] == NSAlertFirstButtonReturn) {
// OK clicked
[self initialInstall:self];
}
else
{
// Cancel clicked
NSString *msg = [NSString stringWithFormat:@"%@ ", @" 'Initial setup of CoreOS-Vagrant Cluster' at any time later one !!! "];
[self displayWithMessage:@"You can set Cluster from menu 'Setup':" infoText:msg];
}

}
}
};


- (IBAction)Start:(id)sender {
Expand All @@ -60,16 +79,31 @@ - (IBAction)Start:(id)sender {
}
else
{
NSString *msg = [NSString stringWithFormat:@"%@ ", @"App was not installed, run from menu 'Setup/Update' - 'Initial setup of CoreOS-Vagrant Cluster' !!! "];
[self displayWithMessage:@"CoreOS-Vagrant Cluster" infoText:msg];
NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:@"OK"];
[alert addButtonWithTitle:@"Cancel"];
[alert setMessageText:@"CoreOS-Vagrant Cluster was not set."];
[alert setInformativeText:@"Do you want to set it up?"];
[alert setAlertStyle:NSWarningAlertStyle];

if ([alert runModal] == NSAlertFirstButtonReturn) {
// OK clicked
[self initialInstall:self];
}
else
{
// Cancel clicked
NSString *msg = [NSString stringWithFormat:@"%@ ", @" 'Initial setup of CoreOS-Vagrant Cluster' at any time later one !!! "];
[self displayWithMessage:@"You can set Cluster from menu 'Setup':" infoText:msg];
}
}
}


- (IBAction)Pause:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.informativeText = @"coreos-vagrant cluster will be suspended";
notification.informativeText = @"CoreOS-Vagrant Cluster will be suspended";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];

NSString *scriptName = [[NSString alloc] init];
Expand All @@ -82,7 +116,7 @@ - (IBAction)Pause:(id)sender {
- (IBAction)Stop:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.informativeText = @"coreos-vagrant cluster will be stopped";
notification.informativeText = @"CoreOS-Vagrant Cluster will be stopped";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];

NSString *scriptName = [[NSString alloc] init];
Expand All @@ -95,7 +129,7 @@ - (IBAction)Stop:(id)sender {
- (IBAction)Restart:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.informativeText = @"coreos-vagrant cluster will be reloaded";
notification.informativeText = @"CoreOS-Vagrant Cluster will be reloaded";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];

NSString *appName = [[NSString alloc] init];
Expand Down Expand Up @@ -136,7 +170,7 @@ - (IBAction)force_coreos_update:(id)sender {
- (IBAction)changeReleaseChannel:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.informativeText = @"coreos-vagrant release channel change";
notification.informativeText = @"CoreOS-Vagrant Cluster release channel change";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];

NSString *appName = [[NSString alloc] init];
Expand All @@ -149,7 +183,7 @@ - (IBAction)changeReleaseChannel:(id)sender {
- (IBAction)destroy:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.informativeText = @"coreos-vagrant cluster will be destroyed";
notification.informativeText = @"CoreOS-Vagrant Cluster will be destroyed";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];

NSString *appName = [[NSString alloc] init];
Expand Down Expand Up @@ -195,7 +229,7 @@ - (IBAction)About:(id)sender {
- (IBAction)runSsh1:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.informativeText = @"vagrant ssh shell to core-01 will be opened";
notification.informativeText = @"vagrant ssh shell to corec-01 will be opened";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];

NSString *appName = [[NSString alloc] init];
Expand All @@ -206,7 +240,7 @@ - (IBAction)runSsh1:(id)sender {
- (IBAction)runSsh2:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.informativeText = @"vagrant ssh shell to core-02 will be opened";
notification.informativeText = @"vagrant ssh shell to corec-02 will be opened";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];

NSString *appName = [[NSString alloc] init];
Expand All @@ -217,7 +251,7 @@ - (IBAction)runSsh2:(id)sender {
- (IBAction)runSsh3:(id)sender {
// send a notification on to the screen
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.informativeText = @"vagrant ssh shell to core-03 will be opened";
notification.informativeText = @"vagrant ssh shell to corec-03 will be opened";
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];

NSString *appName = [[NSString alloc] init];
Expand Down
6 changes: 3 additions & 3 deletions src/CoreOS Cluster GUI/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -685,19 +685,19 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="jV7-Ne-Ped"/>
<menuItem title="SSH to core-01" id="dvF-TI-XNx">
<menuItem title="SSH to corec-01" id="dvF-TI-XNx">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runSsh1:" target="494" id="MQP-2q-QP0"/>
</connections>
</menuItem>
<menuItem title="SSH to core-02" id="93Y-3j-w7s">
<menuItem title="SSH to corec-02" id="93Y-3j-w7s">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runSsh2:" target="494" id="kdd-B4-CSh"/>
</connections>
</menuItem>
<menuItem title="SSH to core-03" id="hQV-nK-suP">
<menuItem title="SSH to corec-03" id="hQV-nK-suP">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runSsh3:" target="494" id="deR-gE-bQ0"/>
Expand Down
4 changes: 2 additions & 2 deletions src/CoreOS Cluster GUI/CoreOS Cluster GUI-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.5</string>
<string>0.2.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>43</string>
<string>57</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 2 additions & 2 deletions src/config.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Start - Inserted by CoreOS-Vagrant GUI App
## Start - Inserted by CoreOS-Vagrant Cluster GUI App
# Automatically set the discovery token on 'vagrant up'
#
if File.exists?('user-data') && ARGV[0].eql?('up')
Expand All @@ -14,4 +14,4 @@
File.open('user-data', 'w') { |file| file.write("#cloud-config\n\n#{yaml}") }
end
#
## End - Inserted by CoreOS-Vagrant GUI App
## End - Inserted by CoreOS-Vagrant Cluster GUI App
6 changes: 5 additions & 1 deletion src/coreos-vagrant-install.command
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@

# Vagrantfile
cp ~/coreos-osx-cluster/github/Vagrantfile ~/coreos-osx-cluster/coreos-vagrant/Vagrantfile
# change core-01 host ssh port forward
# chnage VM names to corec-..
sed -i "" 's/core-%02d/corec-%02d/' ~/coreos-osx-cluster/coreos-vagrant/Vagrantfile
# change network subnet
sed -i "" 's/172.17.8.#{i+100}/172.17.9.#{i+100}/g' ~/coreos-osx-cluster/coreos-vagrant/Vagrantfile
# change corec-01 host ssh port forward
cp "$1"/Vagrantfile ~/coreos-osx-cluster/tmp/Vagrantfile
"$1"/gsed -i "/#config.vm.synced_folder/r $HOME/coreos-osx-cluster/tmp/Vagrantfile" ~/coreos-osx-cluster/coreos-vagrant/Vagrantfile
rm -f ~/coreos-osx-cluster/tmp/Vagrantfile
Expand Down
8 changes: 4 additions & 4 deletions src/first-init.command
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ vagrant box update
vagrant up

# Add vagrant ssh key to ssh-agent
###ssh-add ~/.vagrant.d/insecure_private_key
vagrant ssh-config core-01 | sed -n "s/IdentityFile//gp" | xargs ssh-add
###vagrant ssh-config core-01 | sed -n "s/IdentityFile//gp" | xargs ssh-add
ssh-add ~/.vagrant.d/insecure_private_key

# download etcdctl and fleetctl
#
cd ~/coreos-osx-cluster/coreos-vagrant
LATEST_RELEASE=$(vagrant ssh core-01 -c "etcdctl --version" | cut -d " " -f 3- | tr -d '\r' )
LATEST_RELEASE=$(vagrant ssh corec-01 -c "etcdctl --version" | cut -d " " -f 3- | tr -d '\r' )
cd ~/coreos-osx-cluster/bin
echo "Downloading etcdctl $LATEST_RELEASE for OS X"
curl -L -o etcd.zip "https://github.com/coreos/etcd/releases/download/v$LATEST_RELEASE/etcd-v$LATEST_RELEASE-darwin-amd64.zip"
unzip -j -o "etcd.zip" "etcd-v$LATEST_RELEASE-darwin-amd64/etcdctl"
rm -f etcd.zip
#
cd ~/coreos-osx-cluster/coreos-vagrant
LATEST_RELEASE=$(vagrant ssh core-01 -c 'fleetctl version' | cut -d " " -f 3- | tr -d '\r')
LATEST_RELEASE=$(vagrant ssh corec-01 -c 'fleetctl version' | cut -d " " -f 3- | tr -d '\r')
cd ~/coreos-osx-cluster/bin
echo "Downloading fleetctl v$LATEST_RELEASE for OS X"
curl -L -o fleet.zip "https://github.com/coreos/fleet/releases/download/v$LATEST_RELEASE/fleet-v$LATEST_RELEASE-darwin-amd64.zip"
Expand Down
12 changes: 6 additions & 6 deletions src/force_coreos_update.command
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ read -p "$*"

cd ~/coreos-osx-cluster/coreos-vagrant
vagrant up
vagrant ssh core-01 -c "sudo update_engine_client -update"
echo "Done with core-01 "
vagrant ssh corec-01 -c "sudo update_engine_client -update"
echo "Done with corec-01 "
echo " "
vagrant ssh core-02 -c "sudo update_engine_client -update"
echo "Done with core-02 "
vagrant ssh corec-02 -c "sudo update_engine_client -update"
echo "Done with corec-02 "
echo " "
vagrant ssh core-03 -c "sudo update_engine_client -update"
echo "Done with core-03 "
vagrant ssh corec-03 -c "sudo update_engine_client -update"
echo "Done with corec-03 "
echo " "

echo "Update has finished !!!"
Expand Down
4 changes: 2 additions & 2 deletions src/update.command
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ echo " "

# download latest versions of etcdctl and fleetctl
cd ~/coreos-osx-cluster/coreos-vagrant
LATEST_RELEASE=$(vagrant ssh core-01 -c "etcdctl --version" | cut -d " " -f 3- | tr -d '\r' )
LATEST_RELEASE=$(vagrant ssh corec-01 -c "etcdctl --version" | cut -d " " -f 3- | tr -d '\r' )
cd ~/coreos-osx-cluster/bin
echo "Downloading etcdctl $LATEST_RELEASE for OS X"
curl -L -o etcd.zip "https://github.com/coreos/etcd/releases/download/v$LATEST_RELEASE/etcd-v$LATEST_RELEASE-darwin-amd64.zip"
Expand All @@ -31,7 +31,7 @@ rm -f etcd.zip
echo "etcdctl was copied to ~/coreos-osx-cluster/bin "
#
cd ~/coreos-osx-cluster/coreos-vagrant
LATEST_RELEASE=$(vagrant ssh core-01 -c 'fleetctl version' | cut -d " " -f 3- | tr -d '\r')
LATEST_RELEASE=$(vagrant ssh corec-01 -c 'fleetctl version' | cut -d " " -f 3- | tr -d '\r')
cd ~/coreos-osx-cluster/bin
echo "Downloading fleetctl v$LATEST_RELEASE for OS X"
curl -L -o fleet.zip "https://github.com/coreos/fleet/releases/download/v$LATEST_RELEASE/fleet-v$LATEST_RELEASE-darwin-amd64.zip"
Expand Down
4 changes: 3 additions & 1 deletion src/vagrant_reload.command
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export PATH=$PATH:${HOME}/coreos-osx-cluster/bin

# set fleetctl tunnel
# Add vagrant ssh key to ssh-agent
vagrant ssh-config core-01 | sed -n "s/IdentityFile//gp" | xargs ssh-add
###vagrant ssh-config corec-01 | sed -n "s/IdentityFile//gp" | xargs ssh-add
ssh-add ~/.vagrant.d/insecure_private_key

export FLEETCTL_TUNNEL=127.0.0.1:2322
export FLEETCTL_STRICT_HOST_KEY_CHECKING=false
echo "fleetctl list-machines :"
Expand Down
2 changes: 1 addition & 1 deletion src/vagrant_ssh1.command
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
# Copyright (c) 2014 Rimantas Mocevicius. All rights reserved.

cd ~/coreos-osx-cluster/coreos-vagrant
vagrant ssh core-01
vagrant ssh corec-01 -- -A

2 changes: 1 addition & 1 deletion src/vagrant_ssh2.command
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
# Copyright (c) 2014 Rimantas Mocevicius. All rights reserved.

cd ~/coreos-osx-cluster/coreos-vagrant
vagrant ssh core-02
vagrant ssh corec-02 -- -A

2 changes: 1 addition & 1 deletion src/vagrant_ssh3.command
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
# Copyright (c) 2014 Rimantas Mocevicius. All rights reserved.

cd ~/coreos-osx-cluster/coreos-vagrant
vagrant ssh core-03
vagrant ssh corec-03 -- -A

4 changes: 3 additions & 1 deletion src/vagrant_up.command
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export PATH=$PATH:${HOME}/coreos-osx-cluster/bin

# set fleetctl tunnel
# Add vagrant ssh key to ssh-agent
vagrant ssh-config core-01 | sed -n "s/IdentityFile//gp" | xargs ssh-add
###vagrant ssh-config core-01 | sed -n "s/IdentityFile//gp" | xargs ssh-add
ssh-add ~/.vagrant.d/insecure_private_key

export FLEETCTL_TUNNEL=127.0.0.1:2322
export FLEETCTL_STRICT_HOST_KEY_CHECKING=false
echo "fleetctl list-machines :"
Expand Down

0 comments on commit dfb4e7d

Please sign in to comment.