Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 2f447fd19 -> db12b1776


MongoDB powershell blueprint for Windows

Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/b23295cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/b23295cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/b23295cc

Branch: refs/heads/master
Commit: b23295cc458119d5109d4943ce763c2c71fdb970
Parents: 8636eb3
Author: Yavor Yanchev <[email protected]>
Authored: Wed Oct 7 17:26:43 2015 +0300
Committer: Yavor Yanchev <[email protected]>
Committed: Wed Oct 7 17:26:43 2015 +0300

----------------------------------------------------------------------
 .../entity/nosql/mongodb/mongodb_win.yaml       | 46 ++++++++++++++++++++
 .../nosql/mongodb/win/checkrunning_mongodb.ps1  | 30 +++++++++++++
 .../nosql/mongodb/win/configure_mongodb.ps1     | 29 ++++++++++++
 .../nosql/mongodb/win/install_mongodb.ps1       | 30 +++++++++++++
 .../entity/nosql/mongodb/win/launch_mongodb.ps1 | 24 ++++++++++
 .../entity/nosql/mongodb/win/stop_mongodb.ps1   | 25 +++++++++++
 6 files changed, 184 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b23295cc/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/mongodb_win.yaml
----------------------------------------------------------------------
diff --git 
a/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/mongodb_win.yaml
 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/mongodb_win.yaml
new file mode 100644
index 0000000..3892eb6
--- /dev/null
+++ 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/mongodb_win.yaml
@@ -0,0 +1,46 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: mongodb
+location:
+  jclouds:aws-ec2:
+    region: us-west-2
+    imageNameRegex: Windows_Server-2012-R2_RTM-English-64Bit-Base-.*
+    imageOwner: 801119661308
+    hardwareId: m3.medium
+    useJcloudsSshInit: false
+    templateOptions: {mapNewVolumeToDeviceName: ["/dev/sda1", 100, true]}
+services:
+- type: org.apache.brooklyn.entity.software.base.VanillaWindowsProcess
+  id: mongodb
+  brooklyn.config:
+    templates.install:
+      
classpath://org/apache/brooklyn/entity/nosql/mongodb/win/install_mongodb.ps1: 
"C:\\install_mongodb.ps1"
+      
classpath://org/apache/brooklyn/entity/nosql/mongodb/win/configure_mongodb.ps1: 
"C:\\configure_mongodb.ps1"
+      
classpath://org/apache/brooklyn/entity/nosql/mongodb/win/launch_mongodb.ps1: 
"C:\\launch_mongodb.ps1"
+      
classpath://org/apache/brooklyn/entity/nosql/mongodb/win/stop_mongodb.ps1: 
"C:\\stop_mongodb.ps1"
+      
classpath://org/apache/brooklyn/entity/nosql/mongodb/win/checkrunning_mongodb.ps1:
 "C:\\checkrunning_mongodb.ps1"
+    install.command: powershell -command "C:\\install_mongodb.ps1"
+    customize.command: powershell -command "C:\\configure_mongodb.ps1"
+    launch.command: powershell -command "C:\\launch_mongodb.ps1"
+    stop.command: powershell -command "C:\\stop_mongodb.ps1"
+    checkRunning.command: powershell -command "C:\\checkrunning_mongodb.ps1"
+
+    mongodb.download.url: 
https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.0.6-signed.msi
+    mongodb.instance.name: Instance1
+  provisioning.properties:
+    required.ports: 27017

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b23295cc/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/checkrunning_mongodb.ps1
----------------------------------------------------------------------
diff --git 
a/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/checkrunning_mongodb.ps1
 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/checkrunning_mongodb.ps1
new file mode 100644
index 0000000..1157c0b
--- /dev/null
+++ 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/checkrunning_mongodb.ps1
@@ -0,0 +1,30 @@
+[#ftl]
+#!ps1
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+$ErrorActionPreference = "Stop"
+
+$serviceName = "MongoDB${config['mongodb.instance.name']}"
+
+$service = Get-Service -Name $serviceName
+if ($service.Status -ne "Running"){
+    Write-Host $ServiceName " service is not running"
+    exit 1
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b23295cc/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/configure_mongodb.ps1
----------------------------------------------------------------------
diff --git 
a/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/configure_mongodb.ps1
 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/configure_mongodb.ps1
new file mode 100644
index 0000000..06502b5
--- /dev/null
+++ 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/configure_mongodb.ps1
@@ -0,0 +1,29 @@
+[#ftl]
+#!ps1
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#netsh advfirewall firewall add rule name=MongoDB dir=in protocol=tcp 
action=allow localport=27017 remoteip=any profile=any
+#( Get-WmiObject -Namespace "root\Microsoft\SqlServer\ComputerManagement11" 
-Query "Select * from ServerNetworkProtocolProperty where ProtocolName='Tcp' 
and IPAddressName='IPAll' and PropertyName='TcpPort'" ).SetStringValue("27017")
+
+New-Item c:\data\db -type directory -force
+New-Item c:\data\log -type directory -force
+
+set serviceName=MongoDB${config['mongodb.instance.name']}
+
+& 'C:\Program Files\MongoDB\Server\3.0\bin\mongod' '--rest' 
'--dbpath=C:\data\db' '--logpath=c:\data\log\service.log' '--install' 
'--serviceName=MongoDB${config['mongodb.instance.name']}' 
'--serviceDisplayName=MongoDB${config['mongodb.instance.name']}'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b23295cc/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/install_mongodb.ps1
----------------------------------------------------------------------
diff --git 
a/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/install_mongodb.ps1
 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/install_mongodb.ps1
new file mode 100644
index 0000000..cc26200
--- /dev/null
+++ 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/install_mongodb.ps1
@@ -0,0 +1,30 @@
+[#ftl]
+#!ps1
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+$Path = "C:\InstallTemp"
+New-Item -ItemType Directory -Force -Path $Path
+
+$Url = "${config['mongodb.download.url']}"
+$Dl = [System.IO.Path]::Combine($Path, "installer.msi")
+$WebClient = New-Object System.Net.WebClient
+$WebClient.DownloadFile( $Url, $Dl )
+
+Start-Process "msiexec" -ArgumentList '/qn','/i',$Dl -RedirectStandardOutput ( 
[System.IO.Path]::Combine($Path, "stdout.txt") ) -RedirectStandardError ( 
[System.IO.Path]::Combine($Path, "stderr.txt") ) -Wait

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b23295cc/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/launch_mongodb.ps1
----------------------------------------------------------------------
diff --git 
a/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/launch_mongodb.ps1
 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/launch_mongodb.ps1
new file mode 100644
index 0000000..62d1bc4
--- /dev/null
+++ 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/launch_mongodb.ps1
@@ -0,0 +1,24 @@
+[#ftl]
+#!ps1
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+$serviceName = "MongoDB${config['mongodb.instance.name']}"
+
+Start-Service $serviceName

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b23295cc/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/stop_mongodb.ps1
----------------------------------------------------------------------
diff --git 
a/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/stop_mongodb.ps1
 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/stop_mongodb.ps1
new file mode 100644
index 0000000..3343f76
--- /dev/null
+++ 
b/software/nosql/src/main/resources/org/apache/brooklyn/entity/nosql/mongodb/win/stop_mongodb.ps1
@@ -0,0 +1,25 @@
+[#ftl]
+#!ps1
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+$serviceName = "MongoDB${config['mongodb.instance.name']}"
+
+Stop-Service $serviceName
+

Reply via email to