Changes from merging Ryan's changes in. Now auto migrates and runs system setup
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/839f817f Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/839f817f Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/839f817f Branch: refs/heads/key-row-sharding Commit: 839f817f7d723d387c47672ea241b8a4d3b2cc04 Parents: 179bc18 Author: Todd Nine <[email protected]> Authored: Tue Nov 4 15:58:48 2014 -0700 Committer: Todd Nine <[email protected]> Committed: Tue Nov 4 15:58:48 2014 -0700 ---------------------------------------------------------------------- stack/awscluster/pom.xml | 405 +++++++++++-------- .../main/dist/init_instance/init_rest_server.sh | 12 + .../groovy/configure_opscenter_usergrid.groovy | 6 +- stack/awscluster/ugcluster-cf.json | 18 +- 4 files changed, 249 insertions(+), 192 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/839f817f/stack/awscluster/pom.xml ---------------------------------------------------------------------- diff --git a/stack/awscluster/pom.xml b/stack/awscluster/pom.xml index 9af3da6..4a8f4d6 100644 --- a/stack/awscluster/pom.xml +++ b/stack/awscluster/pom.xml @@ -1,186 +1,237 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> -<!-- - 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. ---> - <modelVersion>4.0.0</modelVersion> - - <artifactId>awscluster</artifactId> - <groupId>org.usergrid</groupId> - <version>1.0-SNAPSHOT</version> - - <name>awscluster</name> - - <description> - Creates bundle for initializing a Tomcat and Cassandra Usergrid cluster via CloudFormation - </description> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <aws.s3.release-bucket>usergrid-jenkins-builds</aws.s3.release-bucket> - <stack.war>../rest/target/ROOT.war</stack.war> - <portal.dir>../../portal/dist/usergrid-portal</portal.dir> - </properties> - - <build> - - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>make-assembly</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - <configuration> - <descriptors> - <descriptor>assembly.xml</descriptor> - </descriptors> - <tarLongFileMode>gnu</tarLongFileMode> - </configuration> - </plugin> - - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <version>1.2</version> - <executions> - <execution> - <phase>deploy</phase> - <goals> - <goal>java</goal> - </goals> - <id>upload-scripts</id> - <configuration> - <includeProjectDependencies>true</includeProjectDependencies> - <includePluginDependencies>true</includePluginDependencies> - <classpathScope>runtime</classpathScope> - <executableDependency> - <groupId>net.java.dev.jets3t</groupId> - <artifactId>jets3t</artifactId> - </executableDependency> - <mainClass>org.jets3t.apps.synchronize.Synchronize</mainClass> - <arguments> - <argument>--nodelete</argument> - <argument>--properties</argument> - <argument>${project.basedir}/aws.properties</argument> - <argument>UP</argument> - <argument>${aws.s3.release-bucket}</argument> - <argument>${project.build.directory}/${project.build.finalName}-any.tar.gz</argument> - </arguments> - </configuration> - </execution> - <execution> - <phase>deploy</phase> - <goals> - <goal>java</goal> - </goals> - <id>upload-war</id> - <configuration> - <includeProjectDependencies>true</includeProjectDependencies> - <includePluginDependencies>true</includePluginDependencies> - <classpathScope>runtime</classpathScope> - <executableDependency> - <groupId>net.java.dev.jets3t</groupId> - <artifactId>jets3t</artifactId> - </executableDependency> - <mainClass>org.jets3t.apps.synchronize.Synchronize</mainClass> - <arguments> - <argument>--nodelete</argument> - <argument>--properties</argument> - <argument>${project.basedir}/aws.properties</argument> - <argument>UP</argument> - <argument>${aws.s3.release-bucket}</argument> - <argument>${stack.war}</argument> - </arguments> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>net.java.dev.jets3t</groupId> - <artifactId>jets3t</artifactId> - <version>0.8.0</version> - </dependency> - </dependencies> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-deploy-plugin</artifactId> - <version>2.8.1</version> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.3.2</version> - <dependencies> - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy-eclipse-compiler</artifactId> - <version>2.6.0-01</version> - </dependency> - </dependencies> - <configuration> - <compilerId>groovy-eclipse-compiler</compilerId> - </configuration> - </plugin> - <plugin> - <artifactId>groovy-eclipse-compiler</artifactId> - <groupId>org.codehaus.groovy</groupId> - <version>2.6.0-01</version> - <extensions>true</extensions> - </plugin> - </plugins> - - </build> - - <dependencies> - - <dependency> - <groupId>net.java.dev.jets3t</groupId> - <artifactId>synchronize</artifactId> - <version>0.8.0</version> - </dependency> - - <dependency> + <!-- + 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. + --> + <modelVersion>4.0.0</modelVersion> + + <artifactId>awscluster</artifactId> + <groupId>org.usergrid</groupId> + <version>1.0-SNAPSHOT</version> + + <name>awscluster</name> + + <description> + Creates bundle for initializing a Tomcat and Cassandra Usergrid cluster via CloudFormation + </description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <aws.s3.release-bucket>ug-cloudformation</aws.s3.release-bucket> + <!-- Pulls the file path from maven when using the dependency plugin. This doesn't work b/c it doesn't name the file properly to ROOT.war. Solve that to use the latest from the repo--> + <!--<stack.war>${org.apache.usergrid:usergrid-rest:war}</stack.war>--> + <stack.war>../rest/target/ROOT.war</stack.war> + <portal.dir>../../portal/dist/usergrid-portal</portal.dir> + </properties> + + <build> + + <plugins> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + <configuration> + <descriptors> + <descriptor>assembly.xml</descriptor> + </descriptors> + <tarLongFileMode>gnu</tarLongFileMode> + </configuration> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2</version> + <executions> + + <!-- upload the tar file--> + <execution> + <phase>deploy</phase> + <goals> + <goal>java</goal> + </goals> + <id>upload-scripts</id> + <configuration> + <includeProjectDependencies>true</includeProjectDependencies> + <includePluginDependencies>true</includePluginDependencies> + <classpathScope>runtime</classpathScope> + <executableDependency> + <groupId>net.java.dev.jets3t</groupId> + <artifactId>jets3t</artifactId> + </executableDependency> + <mainClass>org.jets3t.apps.synchronize.Synchronize</mainClass> + <arguments> + <argument>--nodelete</argument> + <argument>--properties</argument> + <argument>${project.basedir}/aws.properties</argument> + <argument>UP</argument> + <argument>${aws.s3.release-bucket}</argument> + <argument>${project.build.directory}/${project.build.finalName}-any.tar.gz</argument> + </arguments> + </configuration> + </execution> + + <!-- upload the war file from our repository --> + <execution> + <phase>deploy</phase> + <goals> + <goal>java</goal> + </goals> + <id>upload-war</id> + <configuration> + <includeProjectDependencies>true</includeProjectDependencies> + <includePluginDependencies>true</includePluginDependencies> + <classpathScope>runtime</classpathScope> + <executableDependency> + <groupId>net.java.dev.jets3t</groupId> + <artifactId>jets3t</artifactId> + </executableDependency> + <mainClass>org.jets3t.apps.synchronize.Synchronize</mainClass> + <arguments> + <argument>--nodelete</argument> + <argument>--properties</argument> + <argument>${project.basedir}/aws.properties</argument> + <argument>UP</argument> + <argument>${aws.s3.release-bucket}</argument> + <argument>${stack.war}</argument> + </arguments> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> <groupId>net.java.dev.jets3t</groupId> <artifactId>jets3t</artifactId> <version>0.8.0</version> - </dependency> - - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk</artifactId> - <version>1.6.7</version> - </dependency> - <dependency> - <artifactId>groovy-all</artifactId> + </dependency> + </dependencies> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.8.1</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.3.2</version> + <dependencies> + <dependency> <groupId>org.codehaus.groovy</groupId> - <version>2.0.5</version> - </dependency> - </dependencies> + <artifactId>groovy-eclipse-compiler</artifactId> + <version>2.6.0-01</version> + </dependency> + </dependencies> + <configuration> + <compilerId>groovy-eclipse-compiler</compilerId> + </configuration> + </plugin> + <plugin> + <artifactId>groovy-eclipse-compiler</artifactId> + <groupId>org.codehaus.groovy</groupId> + <version>2.6.0-01</version> + <extensions>true</extensions> + </plugin> + + <!-- Set the dependency path in the lifecycle for the property --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.9</version> + <executions> + <execution> + <goals> + <goal>properties</goal> + </goals> + </execution> + </executions> + </plugin> + + <!-- echo out the stack war --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2</version> + <executions> + <execution> + <goals> + <goal>exec</goal> + </goals> + <phase>generate-sources</phase> + </execution> + </executions> + <configuration> + <executable>echo</executable> + <arguments> + <argument>stack.war=</argument> + <argument>${stack.war}</argument> + </arguments> + </configuration> + </plugin> + </plugins> + + </build> + + <dependencies> + + <dependency> + <groupId>net.java.dev.jets3t</groupId> + <artifactId>synchronize</artifactId> + <version>0.8.0</version> + </dependency> + + <dependency> + <groupId>net.java.dev.jets3t</groupId> + <artifactId>jets3t</artifactId> + <version>0.8.0</version> + </dependency> + + <dependency> + <groupId>com.amazonaws</groupId> + <artifactId>aws-java-sdk</artifactId> + <version>1.6.7</version> + </dependency> + <dependency> + <artifactId>groovy-all</artifactId> + <groupId>org.codehaus.groovy</groupId> + <version>2.0.5</version> + </dependency> + + <!-- This dependency is used for deployment --> + <dependency> + <groupId>org.apache.usergrid</groupId> + <artifactId>usergrid-rest</artifactId> + <!-- Change this if you want to deploy a specific version, otherwise the latest in the repository will be used--> + <version>2.0.0-SNAPSHOT</version> + <type>war</type> + </dependency> + </dependencies> </project> http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/839f817f/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh b/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh index 0e65c9a..a255d31 100644 --- a/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh +++ b/stack/awscluster/src/main/dist/init_instance/init_rest_server.sh @@ -200,6 +200,18 @@ apt-get install -y postfix # Go sh /etc/init.d/tomcat7 start +#Wait for tomcat to start, then run our migrations + + +#Wait until tomcat starts and we can hit our status page +until curl -m 1 -I -X GET http://localhost:8080/status | grep "200 OK"; do sleep 5; done + +#Run the migration +curl -X PUT http://ugtest.usergrid.com/system/migrate/run -u superuser:test + +#Run the system database setup +curl -X GET http://localhost:8080/system/database/setup -u superuser:test + # tag last so we can see in the console that the script ran to completion cd /usr/share/usergrid/scripts groovy tag_instance.groovy http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/839f817f/stack/awscluster/src/main/groovy/configure_opscenter_usergrid.groovy ---------------------------------------------------------------------- diff --git a/stack/awscluster/src/main/groovy/configure_opscenter_usergrid.groovy b/stack/awscluster/src/main/groovy/configure_opscenter_usergrid.groovy index 150018c..df4dcae 100644 --- a/stack/awscluster/src/main/groovy/configure_opscenter_usergrid.groovy +++ b/stack/awscluster/src/main/groovy/configure_opscenter_usergrid.groovy @@ -48,9 +48,9 @@ def usergridConfig = """ seed_hosts = ${seeds} #TODO, this doesn't seem to work, I think opscenter is broken. Try this again at a later time and remove opscenter exclusion below -[storage_cassandra] -seed_hosts = ${hostName} -api_port = 9160 +#[storage_cassandra] +#seed_hosts = ${hostName} +#api_port = 9160 """ http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/839f817f/stack/awscluster/ugcluster-cf.json ---------------------------------------------------------------------- diff --git a/stack/awscluster/ugcluster-cf.json b/stack/awscluster/ugcluster-cf.json index 087c67a..c8b96ee 100644 --- a/stack/awscluster/ugcluster-cf.json +++ b/stack/awscluster/ugcluster-cf.json @@ -15,7 +15,7 @@ "ReleaseBucket": { "Description": "S3 Bucket where Usergrid assembly is to be found.", "Type": "String", - "Default": "usergrid-jenkins-builds" + "Default": "ug-cloudformation" }, "RestMinServers": { "Description": "Minimum number of REST servers.", @@ -49,7 +49,7 @@ "KeyPair": { "Description": "EC2 key pair to be use for SSH access", "Type": "String", - "Default": "jenkins-east" + "Default": "ug-cloudformation" }, "CassClusterName": { "Description": "Name to be used for Cassandra cluster.", @@ -144,7 +144,7 @@ "OpsCenterInstanceType": { "Description": "Instance type for Opscenter server", "Type": "String", - "Default": "c3.xlarge", + "Default": "c3.large", "AllowedValues": [ "c3.large", "c3.xlarge", @@ -319,11 +319,9 @@ "apt-get update\n", "apt-get -y install s3cmd\n", "cd /usr/share/usergrid\n", - "s3cmd --config=/etc/s3cfg get s3://", {"Ref": "ReleaseBucket"}, "/awscluster-1.0-SNAPSHOT-any.tar.gz\n", - "s3cmd --config=/etc/s3cfg get s3://", {"Ref": "ReleaseBucket"}, "/ROOT.war\n", + "s3cmd --config=/etc/s3cfg get s3://", { "Ref":"ReleaseBucket" }, "/awscluster-1.0-SNAPSHOT-any.tar.gz\n", "tar xvf awscluster-1.0-SNAPSHOT-any.tar.gz\n", "rm -fr awscluster-1.0-SNAPSHOT-any.tar.gz\n", - "mv ROOT.war webapps/ROOT.war\n", "chmod 755 ./init_instance/*.sh\n", "cd ./init_instance\n", "# Init as a REST intance \n", @@ -767,11 +765,9 @@ "apt-get update\n", "apt-get -y install s3cmd\n", "cd /usr/share/usergrid\n", - "s3cmd --config=/etc/s3cfg get s3://", {"Ref": "ReleaseBucket"}, "/awscluster-1.0-SNAPSHOT-any.tar.gz\n", - "s3cmd --config=/etc/s3cfg get s3://", {"Ref": "ReleaseBucket"}, "/ROOT.war\n", + "s3cmd --config=/etc/s3cfg get s3://", { "Ref":"ReleaseBucket" }, "/awscluster-1.0-SNAPSHOT-any.tar.gz\n", "tar xvf awscluster-1.0-SNAPSHOT-any.tar.gz\n", "rm -fr awscluster-1.0-SNAPSHOT-any.tar.gz\n", - "mv ROOT.war webapps/ROOT.war\n", "chmod 755 ./init_instance/*.sh\n", "cd ./init_instance\n", "# init as a Cassandra node \n", @@ -930,11 +926,9 @@ "apt-get update\n", "apt-get -y install s3cmd\n", "cd /usr/share/usergrid\n", - "s3cmd --config=/etc/s3cfg get s3://", {"Ref": "ReleaseBucket"}, "/awscluster-1.0-SNAPSHOT-any.tar.gz\n", - "s3cmd --config=/etc/s3cfg get s3://", {"Ref": "ReleaseBucket"}, "/ROOT.war\n", + "s3cmd --config=/etc/s3cfg get s3://", { "Ref":"ReleaseBucket" }, "/awscluster-1.0-SNAPSHOT-any.tar.gz\n", "tar xvf awscluster-1.0-SNAPSHOT-any.tar.gz\n", "rm -fr awscluster-1.0-SNAPSHOT-any.tar.gz\n", - "mv ROOT.war webapps/ROOT.war\n", "chmod 755 ./init_instance/*.sh\n", "cd ./init_instance\n", "# init as an ES node \n",
