You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2018/08/31 00:47:37 UTC

[incubator-openwhisk] branch master updated: Add an ansible variable to set the timezone for all of components. (#3955)

This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 0242a60  Add an ansible variable to set the timezone for all of components. (#3955)
0242a60 is described below

commit 0242a60aeb976d070abda76a8ac2aa7e3306e393
Author: jiangpch <ji...@navercorp.com>
AuthorDate: Fri Aug 31 08:47:32 2018 +0800

    Add an ansible variable to set the timezone for all of components. (#3955)
    
    This makes it easier to analyze logs when errors occur or during local development.
---
 ansible/README.md                         | 3 +++
 ansible/group_vars/all                    | 1 +
 ansible/roles/apigateway/tasks/deploy.yml | 1 +
 ansible/roles/controller/tasks/deploy.yml | 1 +
 ansible/roles/couchdb/tasks/deploy.yml    | 1 +
 ansible/roles/invoker/tasks/deploy.yml    | 1 +
 ansible/roles/kafka/tasks/deploy.yml      | 1 +
 ansible/roles/nginx/tasks/deploy.yml      | 2 ++
 ansible/roles/redis/tasks/deploy.yml      | 2 ++
 ansible/roles/zookeeper/tasks/deploy.yml  | 1 +
 10 files changed, 14 insertions(+)

diff --git a/ansible/README.md b/ansible/README.md
index d9e4a87..b1fd236 100644
--- a/ansible/README.md
+++ b/ansible/README.md
@@ -368,3 +368,6 @@ limits:
 - The `limits.concurrentInvocations` represents the maximum concurrent invocations allowed per namespace.
 - The `limits.firesPerMinute` represents the allowed namespace trigger firings per minute.
 - The `limits.sequenceMaxLength` represents the maximum length of a sequence action.
+
+#### Set the timezone for containers
+The default timezone for all system containers is UTC. The timezone may differ from your servers which could make it difficult to inspect logs. The timezone is configured globally in [group_vars/all](./group_vars/all#L280) or by passing an extra variable `-e docker_timezone=xxx` when you run an ansible-playbook.
diff --git a/ansible/group_vars/all b/ansible/group_vars/all
index ffc658b..ad7e441 100644
--- a/ansible/group_vars/all
+++ b/ansible/group_vars/all
@@ -275,6 +275,7 @@ docker:
   pull:
     retries: 10
     delay: 10
+  timezone: "{{ docker_timezone | default('UTC') }}"
 
 sdk:
   dir:
diff --git a/ansible/roles/apigateway/tasks/deploy.yml b/ansible/roles/apigateway/tasks/deploy.yml
index ff1973b..67af893 100644
--- a/ansible/roles/apigateway/tasks/deploy.yml
+++ b/ansible/roles/apigateway/tasks/deploy.yml
@@ -16,6 +16,7 @@
       "REDIS_PORT": "{{ redis.port }}"
       "PUBLIC_MANAGEDURL_HOST": "{{ ansible_host }}"
       "PUBLIC_MANAGEDURL_PORT": "{{ apigateway.port.mgmt }}"
+      "TZ": "{{ docker.timezone }}"
     ports:
       - "{{ apigateway.port.mgmt }}:8080"
       - "{{ apigateway.port.api }}:9000"
diff --git a/ansible/roles/controller/tasks/deploy.yml b/ansible/roles/controller/tasks/deploy.yml
index d7f4f59..a34bb9b 100644
--- a/ansible/roles/controller/tasks/deploy.yml
+++ b/ansible/roles/controller/tasks/deploy.yml
@@ -124,6 +124,7 @@
       "JMX_REMOTE": "{{ jmx.enabled }}"
 
       "PORT": 8080
+      "TZ": "{{ docker.timezone }}"
 
       "CONFIG_whisk_info_date": "{{ whisk.version.date }}"
       "CONFIG_whisk_info_buildNo": "{{ docker.image.tag }}"
diff --git a/ansible/roles/couchdb/tasks/deploy.yml b/ansible/roles/couchdb/tasks/deploy.yml
index 0bf5170..2e3f640 100644
--- a/ansible/roles/couchdb/tasks/deploy.yml
+++ b/ansible/roles/couchdb/tasks/deploy.yml
@@ -53,6 +53,7 @@
       COUCHDB_USER: "{{ db.credentials.admin.user }}"
       COUCHDB_PASSWORD: "{{ db.credentials.admin.pass }}"
       NODENAME: "{{ ansible_host }}"
+      TZ: "{{ docker.timezone }}"
     pull: "{{ couchdb.pull_couchdb | default(true) }}"
 
 - name: wait until CouchDB in this host is up and running
diff --git a/ansible/roles/invoker/tasks/deploy.yml b/ansible/roles/invoker/tasks/deploy.yml
index ba17b70..706d5dc 100644
--- a/ansible/roles/invoker/tasks/deploy.yml
+++ b/ansible/roles/invoker/tasks/deploy.yml
@@ -168,6 +168,7 @@
       "INVOKER_OPTS": "{{ invoker_args | default(invoker.arguments) }}"
       "JMX_REMOTE": "{{ jmx.enabled }}"
       "PORT": 8080
+      "TZ": "{{ docker.timezone }}"
       "KAFKA_HOSTS": "{{ kafka_connect_string }}"
       "CONFIG_whisk_kafka_replicationFactor": "{{ kafka.replicationFactor | default() }}"
       "CONFIG_whisk_kafka_topics_invoker_retentionBytes": "{{ kafka_topics_invoker_retentionBytes | default() }}"
diff --git a/ansible/roles/kafka/tasks/deploy.yml b/ansible/roles/kafka/tasks/deploy.yml
index b758c76..f329488 100644
--- a/ansible/roles/kafka/tasks/deploy.yml
+++ b/ansible/roles/kafka/tasks/deploy.yml
@@ -25,6 +25,7 @@
       "KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR": "{{ kafka.offsetsTopicReplicationFactor }}"
       "KAFKA_AUTO_CREATE_TOPICS_ENABLE": "false"
       "KAFKA_NUM_NETWORK_THREADS": "{{ kafka.networkThreads }}"
+      "TZ": "{{ docker.timezone }}"
 
 - name: add kafka non-ssl vars
   when: kafka.protocol != 'SSL'
diff --git a/ansible/roles/nginx/tasks/deploy.yml b/ansible/roles/nginx/tasks/deploy.yml
index 2812051..490f289 100644
--- a/ansible/roles/nginx/tasks/deploy.yml
+++ b/ansible/roles/nginx/tasks/deploy.yml
@@ -69,3 +69,5 @@
       - "{{ nginx.port.http }}:80"
       - "{{ nginx.port.api }}:443"
       - "{{ nginx.port.adminportal }}:8443"
+    env:
+      TZ: "{{ docker.timezone }}"
diff --git a/ansible/roles/redis/tasks/deploy.yml b/ansible/roles/redis/tasks/deploy.yml
index 31b47e6..9110f43 100644
--- a/ansible/roles/redis/tasks/deploy.yml
+++ b/ansible/roles/redis/tasks/deploy.yml
@@ -19,6 +19,8 @@
     restart_policy: "{{ docker.restart.policy }}"
     ports:
       - "{{ redis.port }}:6379"
+    env:
+      TZ: "{{ docker.timezone }}"
 
 - name: wait until redis is up and running
   action: shell (echo PING; sleep 1) | nc {{ ansible_host }} {{ redis.port }}
diff --git a/ansible/roles/zookeeper/tasks/deploy.yml b/ansible/roles/zookeeper/tasks/deploy.yml
index 74c2de8..db3607e 100644
--- a/ansible/roles/zookeeper/tasks/deploy.yml
+++ b/ansible/roles/zookeeper/tasks/deploy.yml
@@ -18,6 +18,7 @@
     recreate: true
     restart_policy: "{{ docker.restart.policy }}"
     env:
+        TZ: "{{ docker.timezone }}"
         ZOO_MY_ID: "{{ groups['zookeepers'].index(inventory_hostname) + 1 }}"
         ZOO_SERVERS: "{% set zhosts = [] %}
                       {% for host in groups['zookeepers'] %}