# 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. # """ This scripts automates deployment of ws2kafka application (creates required service instances, pushes to TAP instance). """ from app_deployment_helpers import cf_cli from app_deployment_helpers import cf_helpers APP_NAME = "ws2kafka" PARSER = cf_helpers.get_parser(APP_NAME) ARGS = PARSER.parse_args() CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) cf_cli.create_service('kafka', 'shared', 'kafka-inst') PROJECT_DIR = ARGS.project_dir if ARGS.project_dir else \ cf_helpers.get_project_dir() cf_helpers.push(work_dir=PROJECT_DIR, options=ARGS.app_name)
# See the License for the specific language governing permissions and # limitations under the License. # """ This scripts automates deployment of hbase-reader application (creates required service instances, pushes to TAP instance). """ from app_deployment_helpers import cf_cli from app_deployment_helpers import cf_helpers APP_NAME = "hbase-reader" PARSER = cf_helpers.get_parser(APP_NAME) ARGS = PARSER.parse_args() CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) cf_cli.create_service('hbase', 'bare', 'hbase1') cf_cli.create_service('kerberos', 'shared', 'kerberos-instance') PROJECT_DIR = ARGS.project_dir if ARGS.project_dir else \ cf_helpers.get_project_dir() #running script to prepare deployable jar cf_cli.run_command(['./gradlew', 'clean', 'check', 'assemble'], work_dir=PROJECT_DIR) cf_helpers.push(work_dir=PROJECT_DIR, options=ARGS.app_name)
type=str, default="", help='https://dev.twitter.com/streaming/' 'overview/request-parameters#locations') PARSER.add_argument('-kt', '--kafka_topic', type=str, required=True, help='The name of the kafka topic for the ' 'application to received tweets') ARGS = PARSER.parse_args() CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) cf_cli.create_service('kafka', 'shared', 'kafka-twitter-instance') PROJECT_DIR = ARGS.project_dir if ARGS.project_dir else \ cf_helpers.get_project_dir() cf_helpers.prepare_package(work_dir=PROJECT_DIR) cf_helpers.push(work_dir=PROJECT_DIR, options="{0} -n {0} --no-start".format(ARGS.app_name)) cf_cli.set_env(APP_NAME, "TWITTER_CONSUMER_KEY", ARGS.twitter_consumer_key) cf_cli.set_env(APP_NAME, "TWITTER_CONSUMER_SECRET", ARGS.twitter_consumer_secret) cf_cli.set_env(APP_NAME, "TWITTER_TOKEN", ARGS.twitter_token) cf_cli.set_env(APP_NAME, "TWITTER_SECRET", ARGS.twitter_secret) cf_cli.set_env(APP_NAME, "TWITTER_TERMS", ARGS.twitter_terms) cf_cli.set_env(APP_NAME, "TWITTER_FOLLOWINGS", ARGS.twitter_followings) cf_cli.set_env(APP_NAME, "TWITTER_LOCATIONS", ARGS.twitter_locations)
# # 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. # """ This scripts automates deployment of mqtt-listener application (creates required service instances and pushes application to Cloud Foundry using manifest file). """ from app_deployment_helpers import cf_cli from app_deployment_helpers import cf_helpers PARSER = cf_helpers.get_parser("mqtt-listener") ARGS = PARSER.parse_args() CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) cf_cli.create_service('mosquitto14', 'free', 'mqtt-listener-messages') cf_cli.create_service('kafka', 'shared', 'kafka-mqtt-instance') PROJECT_DIR = ARGS.project_dir if ARGS.project_dir else \ cf_helpers.get_project_dir() cf_helpers.prepare_package(work_dir=PROJECT_DIR) cf_helpers.push(work_dir=PROJECT_DIR, options=ARGS.app_name)
# 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. # """ This scripts automates deployment of kafka-admin-api application (creates required service instances). """ from app_deployment_helpers import cf_cli from app_deployment_helpers import cf_helpers APP_NAME = "kafka-admin-api" PARSER = cf_helpers.get_parser(APP_NAME) ARGS = PARSER.parse_args() CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) cf_cli.create_service('kafka', 'shared', 'kafka-instance') PROJECT_DIR = ARGS.project_dir if ARGS.project_dir else \ cf_helpers.get_project_dir() cf_helpers.prepare_package(work_dir=PROJECT_DIR) cf_helpers.push(work_dir=PROJECT_DIR, options="{0} -n {0} --no-start".format(ARGS.app_name)) cf_cli.start(APP_NAME)
from app_deployment_helpers import cf_cli from app_deployment_helpers import cf_helpers APP_NAME = "kafka2hdfs" PARSER = cf_helpers.get_parser(APP_NAME) PARSER.add_argument('-t','--topics', type=str, required=True, help='Topics to listen on (separated with comas, without spaces)') PARSER.add_argument('-cg','--consumer_group', type=str, required=True, help='Unique Kafka consumer group') ARGS = PARSER.parse_args() CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) cf_cli.create_service('zookeeper', 'shared', 'zookeeper-inst') cf_cli.create_service('hdfs', 'shared', 'hdfs-inst') cf_cli.create_service('kerberos', 'shared', 'kerberos-inst') PROJECT_DIR = ARGS.project_dir if ARGS.project_dir else \ cf_helpers.get_project_dir() #running script to prepare deployable jar cf_cli.run_command(['./gradlew', 'check', 'assemble'], work_dir=PROJECT_DIR) cf_helpers.push(work_dir=PROJECT_DIR, options="{0} -n {0} --no-start".format(ARGS.app_name)) cf_cli.set_env(APP_NAME, "TOPICS", ARGS.topics) cf_cli.set_env(APP_NAME, "CONSUMER_GROUP", ARGS.consumer_group) cf_cli.start(APP_NAME)
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO) PARSER = cf_helpers.get_parser("gearpump-app") PARSER.add_argument('-n', '--gearpump_instance', type=str, required=True, help='Name of Gearpump instance to be created') ARGS = PARSER.parse_args() CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) logging.info("Creating Gearpump service instance") cf_cli.create_service('gearpump', '1 worker', ARGS.gearpump_instance) logging.info("Preparing package") PROJECT_DIR = cf_helpers.get_project_dir() cf_helpers.prepare_package(work_dir=PROJECT_DIR) logging.info('Getting Gearpump service credentials') SERVICE_CREDENTIALS = \ cf_api.get_temporary_key_data(ARGS.gearpump_instance)['entity']['credentials'] GEARPUMP_DASHBOARD_URL = SERVICE_CREDENTIALS['dashboardUrl'] USERNAME = SERVICE_CREDENTIALS['username'] PASSWORD = SERVICE_CREDENTIALS['password'] GEARPUMP_JAR_PATH = '../target/' + gearpump_helpers.get_jar_file_name()
'--topics', type=str, required=True, help='Topics to listen on (separated with comas, without spaces)') PARSER.add_argument('-cg', '--consumer_group', type=str, required=True, help='Unique Kafka consumer group') ARGS = PARSER.parse_args() CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) cf_cli.create_service('zookeeper', 'shared', 'zookeeper-inst') cf_cli.create_service('hdfs', 'shared', 'hdfs-inst') cf_cli.create_service('kerberos', 'shared', 'kerberos-inst') PROJECT_DIR = ARGS.project_dir if ARGS.project_dir else \ cf_helpers.get_project_dir() #running script to prepare deployable jar cf_cli.run_command(['./gradlew', 'check', 'assemble'], work_dir=PROJECT_DIR) cf_helpers.push(work_dir=PROJECT_DIR, options="{0} -n {0} --no-start".format(ARGS.app_name)) cf_cli.set_env(APP_NAME, "TOPICS", ARGS.topics) cf_cli.set_env(APP_NAME, "CONSUMER_GROUP", ARGS.consumer_group)
""" import logging from app_deployment_helpers import cf_cli from app_deployment_helpers import cf_helpers logging.basicConfig(level=logging.INFO) LOGGER = logging.getLogger(__name__) ARGS = cf_helpers.parse_args("dataset-reader-sample") CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) LOGGER.info('Creating hdfs service instance...') cf_cli.create_service('hdfs', 'shared', 'hdfs-instance') LOGGER.info('Creating kerberos service instance...') cf_cli.create_service('kerberos', 'shared', 'kerberos-service') PROJECT_DIR = cf_helpers.get_project_dir() LOGGER.info('Creating artifact package...') cf_helpers.prepare_package(work_dir=PROJECT_DIR) LOGGER.info('Pushing application to Cloud Foundry...') cf_helpers.push(options="{0} -n {0} --no-start".format(ARGS.app_name), work_dir=PROJECT_DIR) LOGGER.info('Binding hdfs-instance...') cf_cli.bind_service(ARGS.app_name, 'hdfs-instance')
# # 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. # """ This scripts automates deployment of mqtt-listener application (creates required service instances and pushes application to Cloud Foundry using manifest file). """ from app_deployment_helpers import cf_cli from app_deployment_helpers import cf_helpers PARSER = cf_helpers.get_parser("mqtt-listener") ARGS = PARSER.parse_args() CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) cf_cli.create_service('mosquitto14', 'free', 'mqtt-listener-messages') cf_cli.create_service('kafka', 'shared', 'kafka-mqtt-instance') PROJECT_DIR = ARGS.project_dir if ARGS.project_dir else \ cf_helpers.get_project_dir() cf_helpers.prepare_package(work_dir=PROJECT_DIR) cf_helpers.push(work_dir=PROJECT_DIR, options=ARGS.app_name)
'default path is "./model.tar"') PARSER.add_argument('--no_build', action='store_true', help='Do not build project package with Maven') ARGS = PARSER.parse_args() CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) LOGGER.info('Uploading model to HDFS...') LOCAL_MODEL_PATH = ARGS.path_to_model if ARGS.path_to_model else 'model.tar' HDFS_MODEL_PATH = cf_helpers.upload_to_hdfs(CF_INFO.api_url, CF_INFO.org, LOCAL_MODEL_PATH, 'model') LOGGER.info('Creating required service instances...') cf_cli.create_service('influxdb088', 'free', 'space-shuttle-db') cf_cli.create_service('zookeeper', 'shared', 'space-shuttle-zookeeper') cf_cli.create_service('gateway', 'Simple', 'space-shuttle-gateway') LOGGER.info('Creating scoring engine...') cf_cli.create_service('scoring-engine', 'Simple', 'space-shuttle-scoring-engine', json.dumps({"uri": HDFS_MODEL_PATH})) PROJECT_DIR = ARGS.project_dir if ARGS.project_dir else \ cf_helpers.get_project_dir() if not ARGS.no_build: LOGGER.info('Creating artifact package...') cf_helpers.prepare_package(work_dir=PROJECT_DIR)
import logging logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.INFO) PARSER = cf_helpers.get_parser("gearpump-app") PARSER.add_argument( "-n", "--gearpump_instance", type=str, required=True, help="Name of Gearpump instance to be created" ) ARGS = PARSER.parse_args() CF_INFO = cf_helpers.get_info(ARGS) cf_cli.login(CF_INFO) logging.info("Creating Gearpump service instance") cf_cli.create_service("gearpump", "1 worker", ARGS.gearpump_instance) logging.info("Preparing package") PROJECT_DIR = cf_helpers.get_project_dir() cf_helpers.prepare_package(work_dir=PROJECT_DIR) logging.info("Getting Gearpump service credentials") SERVICE_CREDENTIALS = cf_api.get_temporary_key_data(ARGS.gearpump_instance)["entity"]["credentials"] GEARPUMP_DASHBOARD_URL = SERVICE_CREDENTIALS["dashboardUrl"] USERNAME = SERVICE_CREDENTIALS["username"] PASSWORD = SERVICE_CREDENTIALS["password"] GEARPUMP_JAR_PATH = "../target/" + gearpump_helpers.get_jar_file_name() # getting login cookie for authorizing deploy request