├── config ├── blobs.yml └── dev.yml ├── packages ├── java │ ├── spec │ └── packaging ├── mariadb │ ├── spec │ └── packaging └── web-ide-broker │ ├── spec │ └── packaging ├── delete.sh ├── create.sh ├── jobs ├── web-ide-broker │ ├── templates │ │ ├── data │ │ │ ├── properties.sh │ │ │ └── application.yml.erb │ │ ├── bin │ │ │ ├── monit_debugger │ │ │ └── service_ctl.erb │ │ └── helpers │ │ │ ├── ctl_setup.sh │ │ │ └── ctl_utils.sh │ ├── monit │ └── spec └── mariadb │ ├── monit │ ├── templates │ ├── bin │ │ ├── post-start │ │ ├── mariadb_ctl.erb │ │ └── pre-start │ └── conf │ │ ├── init.sql │ │ └── mariadb.cnf │ └── spec ├── deployments ├── deploy-vsphere.sh └── paasta_web_ide_sevcie_broker.yml ├── .gitignore ├── README.md └── LICENSE /config/blobs.yml: -------------------------------------------------------------------------------- 1 | --- {} 2 | -------------------------------------------------------------------------------- /packages/java/spec: -------------------------------------------------------------------------------- 1 | --- 2 | name: java 3 | files: 4 | - java/jre-8u77-linux-x64.tar.gz 5 | -------------------------------------------------------------------------------- /packages/mariadb/spec: -------------------------------------------------------------------------------- 1 | --- 2 | name: mariadb 3 | 4 | dependencies: 5 | 6 | files: 7 | - mariadb/mariadb-10.1.22-linux-x86_64.tar.gz 8 | -------------------------------------------------------------------------------- /packages/web-ide-broker/spec: -------------------------------------------------------------------------------- 1 | --- 2 | name: web-ide-broker 3 | 4 | dependencies: [] 5 | 6 | files: 7 | - web-ide-broker/web-ide-broker.jar 8 | -------------------------------------------------------------------------------- /delete.sh: -------------------------------------------------------------------------------- 1 | bosh delete-deployment -d webide-broker-service 2 | bosh delete-release webide-broker-release 3 | 4 | rm -r dev_releases 5 | rm -r webide-broker-release.tgz 6 | -------------------------------------------------------------------------------- /packages/web-ide-broker/packaging: -------------------------------------------------------------------------------- 1 | set -e 2 | 3 | JAR_DIR_NAME=web-ide-broker 4 | JAR_NAME=web-ide-broker 5 | 6 | cp $JAR_DIR_NAME/$JAR_NAME.jar ${BOSH_INSTALL_TARGET} 7 | -------------------------------------------------------------------------------- /create.sh: -------------------------------------------------------------------------------- 1 | bosh create-release --force --tarball webide-broker-release.tgz --name webide-broker-release --version 2.0 2 | 3 | bosh upload-release webide-broker-release.tgz 4 | -------------------------------------------------------------------------------- /jobs/web-ide-broker/templates/data/properties.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export NAME='<%= name%>' 4 | export JOB_INDEX=<%= name %> 5 | export JOB_FULL="$NAME/$JOB_INDEX" 6 | -------------------------------------------------------------------------------- /config/dev.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dev_name: eclipse-che-release 3 | latest_release_filename: /home/inception/bosh-space/release/eclipse-che-release/dev_releases/eclipse-che-release/eclipse-che-release-0+dev.125.yml 4 | -------------------------------------------------------------------------------- /packages/mariadb/packaging: -------------------------------------------------------------------------------- 1 | # abort script on any command that exits with a non zero value 2 | set -e 3 | 4 | SRC_NAME=mariadb-10.1.22 5 | 6 | cp -r ${BOSH_COMPILE_TARGET}/mariadb/$SRC_NAME-linux-x86_64.tar.gz ${BOSH_INSTALL_TARGET} 7 | -------------------------------------------------------------------------------- /jobs/mariadb/monit: -------------------------------------------------------------------------------- 1 | check process mariadb 2 | with pidfile /var/vcap/sys/run/mysqld.pid 3 | start program "/var/vcap/jobs/mariadb/bin/mariadb_ctl start" with timeout 20 seconds 4 | stop program "/var/vcap/jobs/mariadb/bin/mariadb_ctl stop" with timeout 20 seconds 5 | group vcap 6 | 7 | -------------------------------------------------------------------------------- /jobs/mariadb/templates/bin/post-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | DATA_DIR=/var/vcap/store/mariadb-data 6 | 7 | if [ ! -d "$DATA_DIR/keystone" ]; then 8 | JOB_NAME=mariadb 9 | JOB_PATH=/var/vcap/jobs/$JOB_NAME 10 | BASE_DIR=/var/vcap/store/$JOB_NAME 11 | 12 | $BASE_DIR/bin/mysql -u root < $JOB_PATH/conf/init.sql 13 | fi 14 | -------------------------------------------------------------------------------- /jobs/web-ide-broker/templates/bin/monit_debugger: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | mkdir -p /var/vcap/sys/log/monit 4 | { 5 | echo "MONIT-DEBUG date" 6 | date 7 | echo "MONIT-DEBUG env" 8 | env 9 | echo "MONIT-DEBUG $@" 10 | $2 $3 $4 $5 $6 $7 11 | R=$? 12 | echo "MONIT-DEBUG exit code $R" 13 | } > /var/vcap/sys/log/monit/monit_debugger.$1.log 2>&1 14 | -------------------------------------------------------------------------------- /jobs/web-ide-broker/monit: -------------------------------------------------------------------------------- 1 | check process web-ide-broker 2 | with pidfile /var/vcap/sys/run/web-ide-broker/web-ide-broker.pid 3 | start program "/var/vcap/jobs/web-ide-broker/bin/monit_debugger service_ctl '/var/vcap/jobs/web-ide-broker/bin/service_ctl start'" 4 | stop program "/var/vcap/jobs/web-ide-broker/bin/monit_debugger service_ctl '/var/vcap/jobs/web-ide-broker/bin/service_ctl stop'" 5 | group vcap 6 | -------------------------------------------------------------------------------- /jobs/mariadb/templates/bin/mariadb_ctl.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | BASE_DIR=/var/vcap/store/mariadb 5 | CONF_FILE=$BASE_DIR/mariadb.cnf 6 | PID_FILE=/var/vcap/sys/run/mysqld.pid 7 | 8 | 9 | case $1 in 10 | 11 | start) 12 | echo "start" 13 | 14 | $BASE_DIR/bin/mysqld --defaults-file=$CONF_FILE --user=vcap 15 | 16 | RETVAL=$? 17 | 18 | [ $RETVAL -ne 0 ] && exit $RETVAL 19 | 20 | ;; 21 | 22 | stop) 23 | echo "stop" 24 | sudo kill $(cat $PID_FILE) 25 | ;; 26 | 27 | *) 28 | echo "Usage: cubrid_ctl {start|stop}" ;; 29 | 30 | esac 31 | -------------------------------------------------------------------------------- /deployments/deploy-vsphere.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | bosh -e micro-bosh -d webide-broker-service deploy paasta_web_ide_sevcie_broker.yml \ 4 | -v stemcell_os="ubuntu-trusty"\ 5 | -v stemcell_version="3445.2"\ 6 | -v stemcell_alias="default"\ 7 | -v internal_networks_name="service_private"\ 8 | -v external_networks_name="portal_service_public"\ 9 | -v mariadb_disk_type="10GB"\ 10 | -v mariadb_port="3306"\ 11 | -v mariadb_user_password="Paasta@2018"\ 12 | -v server_port="8080"\ 13 | -v webide_servers=["http://115.68.47.184:8080/dashboard","http://115.68.47.185:8080/dashboard"]\ 14 | -v serviceDefinition_id="af86588c-6212-11e7-907b-b6006ad3webide0"\ 15 | -v serviceDefinition_plan1_id="a5930564-6212-11e7-907b-b6006ad3webide1"\ 16 | -------------------------------------------------------------------------------- /packages/java/packaging: -------------------------------------------------------------------------------- 1 | # abort script on any command that exits with a non zero value 2 | set -e 3 | 4 | if [[ `uname -a` =~ "x86_64" ]] ; then 5 | archive="java/jre-8u77-linux-x64.tar.gz" 6 | echo "Using 64-bit version" 7 | else 8 | echo "Only 64-bit architectures are supported." 9 | exit 1 10 | fi 11 | 12 | if [[ -f $archive ]] ; then 13 | echo "Archive found" 14 | echo "Extracting archive..." 15 | tar xzf $archive 16 | else 17 | echo "Archive not found" 18 | exit 1 19 | fi 20 | 21 | if [[ -d jre1.8.0_77/bin && `jre1.8.0_77/bin/java -version 2>&1` =~ "Java HotSpot" && $? == 0 ]]; then 22 | echo "Copying JDK..." 23 | cp -a jre1.8.0_77/* ${BOSH_INSTALL_TARGET} 24 | else 25 | echo "JVM is not properly packaged" 26 | exit 1 27 | fi 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # ignore output and build directories 14 | build/** 15 | bin/** 16 | out/** 17 | 18 | # Package Files # 19 | *.jar 20 | *.war 21 | *.ear 22 | *.zip 23 | *.tar.gz 24 | *.rar 25 | 26 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 27 | hs_err_pid* 28 | 29 | # generated gradle directories and files 30 | .gradle 31 | .settings 32 | 33 | # eclise settings 34 | .classpath 35 | .project 36 | 37 | # idea settings 38 | *.iml 39 | *.idea 40 | .idea/** 41 | 42 | # remove spring bean configuration 43 | .spring* 44 | 45 | 46 | node_modules/** 47 | paas-ta-portal-webuser/** 48 | -------------------------------------------------------------------------------- /jobs/mariadb/spec: -------------------------------------------------------------------------------- 1 | --- 2 | name: mariadb 3 | templates: 4 | bin/mariadb_ctl.erb: bin/mariadb_ctl 5 | bin/pre-start: bin/pre-start 6 | bin/post-start: bin/post-start 7 | conf/init.sql: conf/init.sql 8 | conf/mariadb.cnf: conf/mariadb.cnf 9 | packages: 10 | - mariadb 11 | 12 | provides: 13 | - {name: mariadb-link, type: mariadb, properties: [mariadb.port, mariadb.admin_user.password, inspection.jdbc_username, inspection.jdbc_password]} 14 | 15 | properties: 16 | mariadb.port: 17 | description: MariaDB server port 18 | default: 3306 19 | mariadb.admin_user.password: 20 | description: MariaDB admin user password 21 | default: admin 22 | inspection.jdbc_username: 23 | description: MariaDB user for Inspection 24 | default: sonar 25 | inspection.jdbc_password: 26 | description: MariaDB user password for Inspection 27 | default: sonar 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PAAS-TA-WEB-IDE-BROKER-RELEASE Guide 2 | bosh 2.0 PAAS-TA-WEB-IDE-BROKER-RELEASE 3 | 4 | 1.WebIde Configuration 5 | ------------------------ 6 | - mysql :: 1 machine 7 | - web-ide-broker :: 1 machine 8 | 9 | 2.Deploy 10 | -------- 11 | >`$ sh deploy-vsphere.sh` 12 | 13 | 3.src 14 | ------ 15 | src 폴더에 각 package의 설치파일이 위치해야 한다. 16 | 17 | src
18 | ├── java
19 | │     └── jre-8u77-linux-x64.tar.gz
20 | ├── mariadb
21 | │     └── mariadb-10.1.22-linux-x86_64.tar.gz
22 | ├── web-ide-broker
23 | │      └── web-ide-broker.jar
24 | └── README.md
25 |
26 | 27 | ``` 28 | $ cd ~/ 29 | $ git clone https://github.com/PaaS-TA/PAAS-TA-WEB-IDE-BROKER-RELEASE.git 30 | $ cd ~/PAAS-TA-WEB-IDE-BROKER-RELEASE 31 | $ wget -O src.zip http://45.248.73.44/index.php/s/Pf6fk3AGea3mgYn/download 32 | $ unzip src.zip 33 | $ rm -rf src.zip 34 | ``` 35 | -------------------------------------------------------------------------------- /jobs/mariadb/templates/bin/pre-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | DATA_DIR=/var/vcap/store/mariadb-data 6 | 7 | if [ ! -d "$DATA_DIR" ]; then 8 | 9 | JOB_NAME=mariadb 10 | BASE_DIR=/var/vcap/store/$JOB_NAME 11 | PKG_NAME=mariadb 12 | CONF_FILE=$BASE_DIR/mariadb.cnf 13 | 14 | tar zxvf /var/vcap/packages/$PKG_NAME/mariadb-10.1.22-linux-x86_64.tar.gz -C /var/vcap/store/ 15 | 16 | ln -s /var/vcap/store/mariadb-10.1.22-linux-x86_64 $BASE_DIR 17 | sudo chmod 777 /tmp 18 | sudo chown vcap:vcap /var/vcap/sys/log/mariadb 19 | 20 | mkdir -p /var/vcap/store/mariadb-data 21 | sudo chown -R vcap /var/vcap/store/mariadb-data 22 | 23 | cd $BASE_DIR 24 | cp /var/vcap/jobs/$JOB_NAME/conf/mariadb.cnf mariadb.cnf 25 | sudo chown -R root . 26 | sudo ./scripts/mysql_install_db --defaults-file=$CONF_FILE --user=vcap 27 | echo 'export PATH=$PATH:/'$BASE_DIR'/bin/' >> /home/vcap/.bashrc 28 | 29 | fi 30 | -------------------------------------------------------------------------------- /jobs/web-ide-broker/templates/data/application.yml.erb: -------------------------------------------------------------------------------- 1 | server: 2 | port: <%= p('server.port')%> 3 | 4 | spring: 5 | application: 6 | name: paasta-web-ide 7 | datasource: 8 | driver-class-name: com.mysql.jdbc.Driver 9 | url: "jdbc:mysql://<%= link('mariadb-link').instances[0].address%>:<%= link('mariadb-link').p('mariadb.port')%>/webide?autoReconnect=true&useUnicode=true&characterEncoding=utf8" 10 | username: root 11 | password: <%= p('datasource.password')%> 12 | jpa: 13 | hibernate: 14 | ddl-auto: none 15 | database: mysql 16 | show-sql: true 17 | 18 | logging: 19 | level: 20 | root: 21 | org: 22 | openpaas: 23 | servicebroker: 24 | controller: INFO 25 | 26 | webide: 27 | servers: '<%= p('webide.servers')%>' 28 | 29 | serviceDefinition: 30 | id: <%= p('serviceDefinition.id')%> 31 | name: webide 32 | desc: "A paasta web ide service for application development.provision parameters" 33 | bindable: false 34 | planupdatable: false 35 | plan1: 36 | id: <%= p('serviceDefinition.plan1.id')%> 37 | name: webide-shared 38 | desc: "This is service plan. All services are created equally." 39 | type: A 40 | 41 | -------------------------------------------------------------------------------- /jobs/web-ide-broker/templates/bin/service_ctl.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | JOB_NAME="web-ide-broker" 5 | 6 | JOB_DIR="/var/vcap/jobs/${JOB_NAME}" 7 | JOB_CONFIG="${JOB_DIR}/data/application.yml" 8 | PKG_DIR="/var/vcap/packages/${JOB_NAME}" 9 | JAVA_DIR="/var/vcap/packages/java" 10 | ACTIVE="dev" 11 | 12 | export JOB_NAME 13 | source /var/vcap/jobs/${JOB_NAME}/helpers/ctl_setup.sh $JOB_NAME 14 | 15 | export JOB_DIR 16 | export PKG_DIR 17 | export JAVA_DIR 18 | 19 | case $1 in 20 | 21 | start) 22 | echo "starting :: ${JOB_NAME}" 23 | pid_guard $PIDFILE $JOB_NAME 24 | 25 | 26 | echo "starting 1 :: PIDFILE :: $PIDFILE" 27 | echo "starting 2 :: JOB_NAME :: $JOB_NAME" 28 | echo "starting 3 :: JOB_DIR :: $JOB_DIR" 29 | echo "starting 5 :: PKG_DIR :: $PKG_DIR" 30 | echo "starting 6 :: JAVA_DIR :: $JAVA_DIR" 31 | 32 | exec $JAVA_DIR/bin/java -cp "${PKG_DIR}/${JOB_NAME}.jar" <%= p('java_opts')%> -Dspring.config.location=${JOB_CONFIG} org.springframework.boot.loader.JarLauncher \ 33 | >>$LOG_DIR/$JOB_NAME.stdout.log \ 34 | 2>>$LOG_DIR/$JOB_NAME.stderr.log & 35 | 36 | echo $! > $PIDFILE 37 | 38 | echo "starting 6 :: PIDFILE :: $PIDFILE" 39 | 40 | echo "SUCCESS :: starting :: ${JOB_NAME}" 41 | ;; 42 | stop) 43 | 44 | kill_and_wait $PIDFILE 45 | 46 | ;; 47 | 48 | *) 49 | echo "usage: service_ctl {start|stop}" 50 | ;; 51 | 52 | esac 53 | exit 0 54 | -------------------------------------------------------------------------------- /jobs/mariadb/templates/conf/init.sql: -------------------------------------------------------------------------------- 1 | UPDATE mysql.user SET password=PASSWORD('<%= p("mariadb.admin_user.password") %>') WHERE user='root'; 2 | GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '<%= p("mariadb.admin_user.password") %>' WITH GRANT OPTION; 3 | FLUSH PRIVILEGES; 4 | 5 | 6 | CREATE DATABASE /*!32312 IF NOT EXISTS*/`webide` /*!40100 DEFAULT CHARACTER SET utf8 */; 7 | 8 | USE `webide`; 9 | 10 | SET NAMES utf8mb4; 11 | SET FOREIGN_KEY_CHECKS = 0; 12 | 13 | -- ---------------------------- 14 | -- Table structure for web_ide_info 15 | -- ---------------------------- 16 | DROP TABLE IF EXISTS `web_ide_info`; 17 | CREATE TABLE `web_ide_info` ( 18 | `service_instance_id` varchar(128) NOT NULL, 19 | `dashboard_url` varchar(128) NOT NULL, 20 | `user_id` varchar(128) DEFAULT NULL, 21 | `use_yn` varchar(1) DEFAULT 'Y', 22 | `plan_id` varchar(128) NOT NULL, 23 | `service_id` varchar(128) NOT NULL, 24 | `space_guid` varchar(128) NOT NULL, 25 | `organization_guid` varchar(128) NOT NULL, 26 | PRIMARY KEY (`service_instance_id`) 27 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 28 | 29 | 30 | -- ---------------------------- 31 | -- Table structure for web_ide_service_list 32 | -- ---------------------------- 33 | DROP TABLE IF EXISTS `web_ide_service_list`; 34 | CREATE TABLE `web_ide_service_list` ( 35 | `no` int(11) NOT NULL AUTO_INCREMENT, 36 | `web_ide_service` varchar(128) NOT NULL, 37 | PRIMARY KEY (`no`) 38 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 39 | -------------------------------------------------------------------------------- /jobs/mariadb/templates/conf/mariadb.cnf: -------------------------------------------------------------------------------- 1 | # For advice on how to change settings please see 2 | # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html 3 | # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the 4 | # *** default location during install, and will be replaced if you 5 | # *** upgrade to a newer version of MySQL. 6 | 7 | [mysqld] 8 | 9 | # Remove leading # and set to the amount of RAM for the most important data 10 | # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. 11 | # innodb_buffer_pool_size = 128M 12 | 13 | # Remove leading # to turn on a very important data integrity option: logging 14 | # changes to the binary log between backups. 15 | # log_bin 16 | 17 | # These are commonly set, remove the # and set as required. 18 | basedir = /var/vcap/store/mariadb 19 | datadir = /var/vcap/store/mariadb-data 20 | port = <%= p('mariadb.port') %> 21 | # server_id = ..... 22 | socket = /tmp/mysql.sock 23 | log-error = /var/vcap/sys/log/mariadb/mariadb-error.log 24 | pid-file = /var/vcap/sys/run/mysqld.pid 25 | character_set_server = utf8 26 | max_allowed_packet = 32M 27 | general_log = 1 28 | general_log_file = /var/vcap/sys/log/mariadb/mariadb-general.log 29 | 30 | # Remove leading # to set options mainly useful for reporting servers. 31 | # The server defaults are faster for transactions and fast SELECTs. 32 | # Adjust sizes as needed, experiment to find the optimal values. 33 | # join_buffer_size = 128M 34 | # sort_buffer_size = 2M 35 | # read_rnd_buffer_size = 2M 36 | 37 | sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 38 | -------------------------------------------------------------------------------- /jobs/web-ide-broker/spec: -------------------------------------------------------------------------------- 1 | --- 2 | name: web-ide-broker 3 | 4 | templates: 5 | bin/service_ctl.erb: bin/service_ctl 6 | bin/monit_debugger: bin/monit_debugger 7 | data/application.yml.erb: data/application.yml 8 | data/properties.sh: data/properties.sh 9 | helpers/ctl_setup.sh: helpers/ctl_setup.sh 10 | helpers/ctl_utils.sh: helpers/ctl_utils.sh 11 | 12 | packages: 13 | - java 14 | - web-ide-broker 15 | 16 | provides: 17 | - {name: web-ide-broker-link, type: web-ide-broker, properties: [server.port, datasource.drive_class_name, datasource.url, datasource.password, logging.level.root.org.openpaas.servicebroker.controller, webide.servers, serviceDefinition.id, serviceDefinition.id, serviceDefinition.plan1.id]} 18 | 19 | consumes: 20 | - name: mariadb-link 21 | type: mariadb 22 | 23 | properties: 24 | java_opts: 25 | description: 'Luncher Java option' 26 | default: '-Xms512m -Xmx1024m -XX:ReservedCodeCacheSize=240m -XX:+UseCompressedOops -Dfile.encoding=UTF-8 -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Xverify:none -XX:ErrorFile=/var/vcap/sys/log/java_error_in_idea_%p.log -XX:HeapDumpPath=/var/vcap/sys/log/java_error_in_idea.hprof' 27 | server.port: 28 | default: 8080 29 | description: 'Server Port' 30 | datasource.drive_class_name: 31 | description: 'driver class name for broker DB' 32 | datasource.url: 33 | description: 'url to access broker DB' 34 | datasource.password: 35 | description: 'password to access broker DB' 36 | logging.level.root.org.openpaas.servicebroker.controller: 37 | description: 'INFO' 38 | default: 'INFO' 39 | webide.servers: 40 | description: 'Web ide service list' 41 | default: '["10.0.0.1"]' 42 | serviceDefinition.id: 43 | description: 'service broker id' 44 | default: 'af86588c-6212-11e7-907b-b6006ad3webide0' 45 | serviceDefinition.plan1.id: 46 | description: 'service broker plan1 id' 47 | default: 'af86588c-6212-11e7-907b-b6006ad3webide1' 48 | -------------------------------------------------------------------------------- /deployments/paasta_web_ide_sevcie_broker.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: webide-broker-service #서비스 배포이름(필수) bosh deployments 로 확인 가능한 이름 3 | # director_uuid: <%= `bosh status --uuid` %> # Director UUID을 입력(필수) bosh status 명령으로 확인 가능 4 | 5 | stemcells: 6 | - alias: default 7 | os: ((stemcell_os)) 8 | version: "((stemcell_version))" 9 | 10 | releases: 11 | - name: webide-broker-release # 서비스 릴리즈 이름(필수) bosh releases로 확인 가능 12 | version: "1.1" # 서비스 릴리즈 버전(필수):latest 시 업로드된 서비스 릴리즈 최신버전 13 | 14 | update: 15 | canaries: 1 # canary 인스턴스 수(필수) 16 | canary_watch_time: 5000-120000 # canary 인스턴스가 수행하기 위한 대기 시간(필수) 17 | update_watch_time: 5000-120000 # non-canary 인스턴스가 수행하기 위한 대기 시간(필수) 18 | max_in_flight: 1 # non-canary 인스턴스가 병렬로 update 하는 최대 개수(필수) 19 | serial: false 20 | 21 | instance_groups: 22 | ########## INFRA ########## 23 | - name: mariadb 24 | azs: 25 | - z3 26 | instances: 1 27 | vm_type: small 28 | stemcell: "((stemcell_alias))" 29 | persistent_disk_type: "((mariadb_disk_type))" 30 | networks: 31 | - name: ((internal_networks_name)) 32 | templates: 33 | - name: mariadb 34 | release: webide-broker-release 35 | syslog_aggregator: null 36 | 37 | 38 | ######## BROKER ######## 39 | 40 | - name: webide-broker 41 | azs: 42 | - z3 43 | instances: 1 44 | vm_type: medium 45 | stemcell: "((stemcell_alias))" 46 | networks: 47 | - name: ((internal_networks_name)) 48 | templates: 49 | - name: web-ide-broker 50 | release: webide-broker-release 51 | syslog_aggregator: null 52 | properties: 53 | server: 54 | port: ((server_port)) 55 | datasource: 56 | password: "((mariadb_user_password))" 57 | webide: 58 | servers: ((webide_servers)) 59 | serviceDefinition: 60 | id: ((serviceDefinition_id)) 61 | plan1: 62 | id: ((serviceDefinition_plan1_id)) 63 | 64 | ######### COMMON PROPERTIES ########## 65 | properties: 66 | mariadb: # MARIA DB SERVER 설정 정보 67 | port: ((mariadb_port)) # MARIA DB PORT 번호 68 | admin_user: 69 | password: '((mariadb_user_password))' # MARIA DB ROOT 계정 비밀번호 70 | host_names: 71 | - mariadb0 72 | -------------------------------------------------------------------------------- /jobs/web-ide-broker/templates/helpers/ctl_setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This helps keep the ctl script as readable 4 | # as possible 5 | 6 | # Usage options: 7 | # source /var/vcap/jobs/foobar/helpers/ctl_setup.sh JOB_NAME OUTPUT_LABEL 8 | # source /var/vcap/jobs/foobar/helpers/ctl_setup.sh foobar 9 | # source /var/vcap/jobs/foobar/helpers/ctl_setup.sh foobar foobar 10 | # source /var/vcap/jobs/foobar/helpers/ctl_setup.sh foobar nginx 11 | 12 | set -e # exit immediately if a simple command exits with a non-zero status 13 | set -u # report the usage of uninitialized variables 14 | 15 | echo "echo 1" 16 | JOB_NAME=$1 17 | echo "echo 2" 18 | output_label=${1:-JOB_NAME} 19 | 20 | echo "echo 3" 21 | export JOB_DIR=/var/vcap/jobs/$JOB_NAME 22 | echo "echo 4" 23 | chmod 755 $JOB_DIR # to access file via symlink 24 | echo "echo 5" 25 | # Load some bosh deployment properties into env vars 26 | # Try to put all ERb into data/properties.sh.erb 27 | # incl $NAME, $JOB_INDEX, $WEBAPP_DIR 28 | 29 | source $JOB_DIR/data/properties.sh 30 | echo "echo 5" 31 | source $JOB_DIR/helpers/ctl_utils.sh 32 | redirect_output ${output_label} 33 | echo "echo 6" 34 | export HOME=${HOME:-/home/vcap} 35 | 36 | # Add all packages' /bin & /sbin into $PATH 37 | echo "echo 7" 38 | for package_bin_dir in $(ls -d /var/vcap/packages/*/*bin) 39 | do 40 | export PATH=${package_bin_dir}:$PATH 41 | done 42 | 43 | echo "echo 8" 44 | export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-''} # default to empty 45 | echo "echo 9" 46 | for package_bin_dir in $(ls -d /var/vcap/packages/*/lib) 47 | do 48 | export LD_LIBRARY_PATH=${package_bin_dir}:$LD_LIBRARY_PATH 49 | done 50 | 51 | # Setup log, run and tmp folders 52 | 53 | echo "echo 10" 54 | export RUN_DIR=/var/vcap/sys/run/$JOB_NAME 55 | export LOG_DIR=/var/vcap/sys/log/$JOB_NAME 56 | export TMP_DIR=/var/vcap/sys/tmp/$JOB_NAME 57 | export STORE_DIR=/var/vcap/store/$JOB_NAME 58 | echo "echo 11" 59 | for dir in $RUN_DIR $LOG_DIR $TMP_DIR $STORE_DIR 60 | do 61 | echo "echo 12" 62 | mkdir -p ${dir} 63 | chown vcap:vcap ${dir} 64 | chmod 775 ${dir} 65 | done 66 | echo "echo 13" 67 | export TMPDIR=$TMP_DIR 68 | 69 | if [[ -d /var/vcap/packages/java ]] 70 | then 71 | echo "echo 14" 72 | export JAVA_HOME="/var/vcap/packages/java" 73 | fi 74 | 75 | # setup CLASSPATH for all jars/ folders within packages 76 | #export CLASSPATH=${CLASSPATH:-''} # default to empty 77 | #for java_jar in $(ls -d /var/vcap/packages/*/*/*.jar) 78 | #do 79 | # export CLASSPATH=${java_jar}:$CLASSPATH 80 | #done 81 | 82 | echo "echo 15" 83 | PIDFILE=$RUN_DIR/$JOB_NAME.pid 84 | 85 | echo "echo 16" 86 | echo '$PATH' $PATH 87 | 88 | echo "echo 17" 89 | chown vcap:vcap ${JOB_DIR}/data 90 | echo "echo 18" 91 | chmod 755 ${JOB_DIR}/data 92 | -------------------------------------------------------------------------------- /jobs/web-ide-broker/templates/helpers/ctl_utils.sh: -------------------------------------------------------------------------------- 1 | # links a job file (probably a config file) into a package 2 | # Example usage: 3 | # link_job_file_to_package config/redis.yml [config/redis.yml] 4 | # link_job_file_to_package config/wp-config.php wp-config.php 5 | echo "echo 19" 6 | link_job_file_to_package() { 7 | echo "echo 19-1" 8 | source_job_file=$1 9 | target_package_file=${2:-$source_job_file} 10 | full_package_file=$WEBAPP_DIR/${target_package_file} 11 | 12 | link_job_file ${source_job_file} ${full_package_file} 13 | } 14 | 15 | # links a job file (probably a config file) somewhere 16 | # Example usage: 17 | # link_job_file config/bashrc /home/vcap/.bashrc 18 | echo "echo 20" 19 | link_job_file() { 20 | source_job_file=$1 21 | target_file=$2 22 | full_job_file=$JOB_DIR/${source_job_file} 23 | echo "echo 21" 24 | echo link_job_file ${full_job_file} ${target_file} 25 | if [[ ! -f ${full_job_file} ]] 26 | then 27 | echo "echo 22" 28 | echo "file to link ${full_job_file} does not exist" 29 | else 30 | echo "echo 23" 31 | # Create/recreate the symlink to current job file 32 | # If another process is using the file, it won't be 33 | # deleted, so don't attempt to create the symlink 34 | mkdir -p $(dirname ${target_file}) 35 | ln -nfs ${full_job_file} ${target_file} 36 | fi 37 | } 38 | 39 | # If loaded within monit ctl scripts then pipe output 40 | # If loaded from 'source ../utils.sh' then normal STDOUT 41 | echo "echo 24" 42 | redirect_output() { 43 | echo "echo 25" 44 | SCRIPT=$1 45 | mkdir -p /var/vcap/sys/log/monit 46 | exec 1>> /var/vcap/sys/log/monit/$SCRIPT.log 47 | exec 2>> /var/vcap/sys/log/monit/$SCRIPT.err.log 48 | } 49 | 50 | echo "echo 26" 51 | pid_guard() { 52 | echo "echo 427" 53 | pidfile=$1 54 | name=$2 55 | echo "echo 27" 56 | if [ -f "$pidfile" ]; then 57 | pid=$(head -1 "$pidfile") 58 | echo "echo 28" 59 | if [ -n "$pid" ] && [ -e /proc/$pid ]; then 60 | echo "$name is already running, please stop it first" 61 | exit 1 62 | fi 63 | 64 | echo "Removing stale pidfile..." 65 | rm $pidfile 66 | fi 67 | } 68 | echo "echo 29" 69 | wait_pid() { 70 | pid=$1 71 | try_kill=$2 72 | timeout=${3:-0} 73 | force=${4:-0} 74 | countdown=$(( $timeout * 10 )) 75 | echo "echo 30" 76 | echo wait_pid $pid $try_kill $timeout $force $countdown 77 | if [ -e /proc/$pid ]; then 78 | if [ "$try_kill" = "1" ]; then 79 | echo "Killing $pidfile: $pid " 80 | kill $pid 81 | echo "echo 31" 82 | fi 83 | while [ -e /proc/$pid ]; do 84 | sleep 0.1 85 | echo "echo 32" 86 | [ "$countdown" != '0' -a $(( $countdown % 10 )) = '0' ] && echo -n . 87 | if [ $timeout -gt 0 ]; then 88 | echo "echo 33" 89 | if [ $countdown -eq 0 ]; then 90 | echo "echo 34" 91 | if [ "$force" = "1" ]; then 92 | echo -ne "\nKill timed out, using kill -9 on $pid... " 93 | kill -9 $pid 94 | sleep 0.5 95 | fi 96 | break 97 | else 98 | countdown=$(( $countdown - 1 )) 99 | fi 100 | fi 101 | done 102 | if [ -e /proc/$pid ]; then 103 | echo "Timed Out" 104 | echo "echo 35" 105 | else 106 | echo "Stopped" 107 | fi 108 | else 109 | echo "Process $pid is not running" 110 | echo "Attempting to kill pid anyway..." 111 | kill $pid 112 | fi 113 | } 114 | 115 | echo "echo 36" 116 | wait_pidfile() { 117 | pidfile=$1 118 | try_kill=$2 119 | timeout=${3:-0} 120 | force=${4:-0} 121 | countdown=$(( $timeout * 10 )) 122 | 123 | if [ -f "$pidfile" ]; then 124 | echo "echo 37" 125 | pid=$(head -1 "$pidfile") 126 | if [ -z "$pid" ]; then 127 | echo "Unable to get pid from $pidfile" 128 | exit 1 129 | fi 130 | echo "echo 38" 131 | wait_pid $pid $try_kill $timeout $force 132 | 133 | rm -f $pidfile 134 | else 135 | echo "Pidfile $pidfile doesn't exist" 136 | fi 137 | } 138 | 139 | echo "echo 39" 140 | kill_and_wait() { 141 | pidfile=$1 142 | echo "echo 40" 143 | # Monit default timeout for start/stop is 30s 144 | # Append 'with timeout {n} seconds' to monit start/stop program configs 145 | timeout=${2:-25} 146 | force=${3:-1} 147 | if [[ -f ${pidfile} ]] 148 | then 149 | echo "echo 41" 150 | wait_pidfile $pidfile 1 $timeout $force 151 | else 152 | echo "echo 42" 153 | # TODO assume $1 is something to grep from 'ps ax' 154 | pid="$(ps auwwx | grep "$1" | awk '{print $2}')" 155 | wait_pid $pid 1 $timeout $force 156 | fi 157 | } 158 | echo "echo 43" 159 | check_nfs_mount() { 160 | opts=$1 161 | exports=$2 162 | mount_point=$3 163 | 164 | if grep -qs $mount_point /proc/mounts; then 165 | echo "echo 44" 166 | echo "Found NFS mount $mount_point" 167 | else 168 | echo "echo 45" 169 | echo "Mounting NFS..." 170 | mount $opts $exports $mount_point 171 | if [ $? != 0 ]; then 172 | echo "Cannot mount NFS from $exports to $mount_point, exiting..." 173 | exit 1 174 | fi 175 | fi 176 | } 177 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------