Browse Source

Update monasca-transform devstack plugin

* set "publish_region" config value from
  variable "$REGION_NAME"
* set default "publish_kafka_project_id"
  to "mini-mon" instead of "admin"
* update the systemd service unit file
  since that file is created by devstack's
  "run_process" function
  - set KillMode to 'control-group', since
    monasca-tranform generates several
    child process
* remove monasca-transform.service file
  since its now being generated by devstack
  plugin.

Change-Id: I6654b7973f8502d4805d25c96b2038291e398552
Story: 2001815
Task: 14328
Ashwin Agate 1 year ago
parent
commit
f43d3498c4

+ 1
- 0
devstack/files/monasca-transform/monasca-transform.conf View File

@@ -16,6 +16,7 @@ password = password
16 16
 adapter = monasca_transform.messaging.adapter:KafkaMessageAdapter
17 17
 topic = metrics
18 18
 brokers=192.168.15.6:9092
19
+publish_region = useast
19 20
 publish_kafka_project_id=d2cb21079930415a9f2a33588b9f2bb6
20 21
 adapter_pre_hourly = monasca_transform.messaging.adapter:KafkaMessageAdapterPreHourly
21 22
 topic_pre_hourly = metrics_pre_hourly

+ 0
- 10
devstack/files/monasca-transform/monasca-transform.service View File

@@ -1,10 +0,0 @@
1
-[Unit]
2
-Description=Monasca Transform Daemon
3
-After=zookeeper.service spark-master.service spark-worker.service
4
-
5
-[Service]
6
-Type=simple
7
-LimitNOFILE=32768
8
-ExecStart=/etc/monasca/transform/init/start-monasca-transform.sh
9
-[Install]
10
-WantedBy=multi-user.target

+ 16
- 6
devstack/plugin.sh View File

@@ -275,7 +275,6 @@ function install_monasca_transform {
275 275
     copy_monasca_transform_files
276 276
     create_monasca_transform_venv
277 277
 
278
-    sudo cp -f "${MONASCA_TRANSFORM_FILES}"/monasca-transform/monasca-transform.service /etc/systemd/system/.
279 278
     sudo cp -f "${MONASCA_TRANSFORM_FILES}"/monasca-transform/start-monasca-transform.sh /etc/monasca/transform/init/.
280 279
     sudo chmod +x /etc/monasca/transform/init/start-monasca-transform.sh
281 280
     sudo cp -f "${MONASCA_TRANSFORM_FILES}"/monasca-transform/service_runner.py /etc/monasca/transform/init/.
@@ -303,8 +302,7 @@ function get_id () {
303 302
 function ascertain_admin_project_id {
304 303
 
305 304
     source ~/devstack/openrc admin admin
306
-    export ADMIN_PROJECT_ID=$(get_id openstack project show admin)
307
-
305
+    export ADMIN_PROJECT_ID=$(get_id openstack project show mini-mon)
308 306
 }
309 307
 
310 308
 function copy_monasca_transform_files {
@@ -319,9 +317,12 @@ function copy_monasca_transform_files {
319 317
     cp -f "${MONASCA_TRANSFORM_FILES}"/monasca-transform/transform_specs.sql /opt/monasca/transform/lib/.
320 318
     cp -f "${MONASCA_TRANSFORM_FILES}"/monasca-transform/pre_transform_specs.sql /opt/monasca/transform/lib/.
321 319
     touch /var/log/monasca/transform/monasca-transform.log
322
-    # set passwords and other variables in configuration files
323
-    sudo sudo sed -i "s/brokers=192\.168\.15\.6:9092/brokers=${SERVICE_HOST}:9092/g" /etc/monasca-transform.conf
324
-    sudo sudo sed -i "s/password\s=\spassword/password = ${MONASCA_TRANSFORM_DB_PASSWORD}/g" /etc/monasca-transform.conf
320
+
321
+    # set variables in configuration files
322
+    iniset -sudo /etc/monasca-transform.conf database password "$MONASCA_TRANSFORM_DB_PASSWORD"
323
+
324
+    iniset -sudo /etc/monasca-transform.conf messaging brokers "$SERVICE_HOST:9092"
325
+    iniset -sudo /etc/monasca-transform.conf messaging publish_region "$REGION_NAME"
325 326
 }
326 327
 
327 328
 function create_monasca_transform_venv {
@@ -414,6 +415,15 @@ function extra_monasca_transform {
414 415
 
415 416
 function start_monasca_transform {
416 417
     run_process "monasca-transform" "/etc/monasca/transform/init/start-monasca-transform.sh"
418
+    # systemd unit file updates
419
+    local unitfile="$SYSTEMD_DIR/devstack@monasca-transform.service"
420
+    local after_service="devstack@zookeeper.service devstack@spark-master.service devstack@spark-worker.service"
421
+    iniset -sudo "$unitfile" "Unit" "After" "$after_service"
422
+    iniset -sudo "$unitfile" "Service" "Type" "simple"
423
+    iniset -sudo "$unitfile" "Service" "LimitNOFILE" "32768"
424
+    # reset  KillMode for monasca-transform, as spawns several child processes
425
+    iniset -sudo "$unitfile" "Service" "KillMode" "control-group"
426
+    sudo systemctl daemon-reload
417 427
 }
418 428
 
419 429
 # check for service enabled

Loading…
Cancel
Save