I've deployed locally with docker and tried different settings, but the timestamp of the task is not applied as I want.
services:
mysql:
image: mysql:5.7
container_name: dataflow-mysql
platform: linux/amd64
environment:
LANG: en_US.utf8
LC_ALL: en_US.utf8
JDK_JAVA_OPTIONS: '-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8'
MYSQL_DATABASE: dataflow
MYSQL_ROOT_PASSWORD: rootpw
MYSQL_ROOT_HOST: '%'
TZ: Asia/Seoul
expose:
- 3306
ports:
- 3306:3306
volumes:
- '/etc/localtime:/etc/localtime:ro'
- /etc/localtime:/etc/localtime:ro # cent os
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
rabbitmq:
image: rabbitmq:3.8-management
container_name: dataflow-rabbitmq
environment:
LANG: en_US.utf8
LC_ALL: en_US.utf8
JDK_JAVA_OPTIONS: '-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8'
TZ: Asia/Seoul
expose:
- '5672'
- '15672'
ports:
- '5672:5672' # RabbitMQ 메시지 브로커 포트
- '15672:15672' # RabbitMQ 관리 대시보드 포트
volumes:
- '/etc/localtime:/etc/localtime:ro'
- /etc/localtime:/etc/localtime:ro # cent os
dataflow-server:
user: root
image: springcloud/spring-cloud-dataflow-server:${DATAFLOW_VERSION:-2.11.3-SNAPSHOT}${BP_JVM_VERSION:-}
container_name: dataflow-server
ports:
- "9393:9393"
environment:
- TZ=Asia/Seoul
- LANG=en_US.utf8
- LC_ALL=en_US.utf8
- METADATA_DEFAULT_DOCKERHUB_USER=admin
- METADATA_DEFAULT_DOCKERHUB_PASSWORD=P@ssw0rd1!e
- JAVA_OPTS=-Duser.timezone=Asia/Seoul -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8
# Set CLOSECONTEXTENABLED=true to ensure that the CRT launcher is closed.
- SPRING_CLOUD_DATAFLOW_APPLICATIONPROPERTIES_TASK_SPRING_CLOUD_TASK_CLOSECONTEXTENABLED=true
- SPRING_CLOUD_SKIPPER_CLIENT_SERVER_URI=${SKIPPER_URI:-http://skipper-server:7577}/api
# (Optionally) authenticate the default Docker Hub access for the App Metadata access.
- SPRING_CLOUD_DATAFLOW_CONTAINER_REGISTRY_CONFIGURATIONS_DEFAULT_REGISTRY_HOST={METADATA_DEFAULT_DOCKERHUB_HOST}
- SPRING_CLOUD_DATAFLOW_CONTAINER_REGISTRY_CONFIGURATIONS_DEFAULT_USER=${METADATA_DEFAULT_DOCKERHUB_USER}
- SPRING_CLOUD_DATAFLOW_CONTAINER_REGISTRY_CONFIGURATIONS_DEFAULT_SECRET=${METADATA_DEFAULT_DOCKERHUB_PASSWORD}
- SPRING_CLOUD_DATAFLOW_CONTAINER_REGISTRYCONFIGURATIONS_DEFAULT_USER=${METADATA_DEFAULT_DOCKERHUB_USER}
- SPRING_CLOUD_DATAFLOW_CONTAINER_REGISTRYCONFIGURATIONS_DEFAULT_SECRET=${METADATA_DEFAULT_DOCKERHUB_PASSWORD}
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/dataflow?permitMysqlScheme
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.mariadb.jdbc.Driver
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=rootpw
- SPRING_CLOUD_STREAM_DEFAULT_BINDER=rabbit
- SPRING_CLOUD_DATAFLOW_APPLICATIONPROPERTIES_STREAM_SPRING_RABBITMQ_HOST=rabbitmq
- SPRING_RABBITMQ_HOST=rabbitmq
- SPRING_RABBITMQ_PORT=5672
- SPRING_RABBITMQ_USERNAME=guest
- SPRING_RABBITMQ_PASSWORD=guest
depends_on:
- skipper-server
- mysql
- rabbitmq
restart: always
volumes:
- ${HOST_MOUNT_PATH:-.}:${DOCKER_MOUNT_PATH:-/home/cnb/scdf}
- /home/workday:/home/workday
command: ["java", "-Duser.timezone=Asia/Seoul", "-jar", "/app.jar"]
skipper-server:
user: root
image: springcloud/spring-cloud-skipper-server:${SKIPPER_VERSION:-2.11.3-SNAPSHOT}${BP_JVM_VERSION:-}
container_name: skipper-server
ports:
- "7577:7577"
- ${APPS_PORT_RANGE:-20000-20195:20000-20195}
environment:
- TZ=Asia/Seoul
- LANG=en_US.utf8
- LC_ALL=en_US.utf8
- JAVA_OPTS=-Duser.timezone=Asia/Seoul -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8
- SERVER_PORT=7577
- SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_LOCAL_ACCOUNTS_DEFAULT_PORTRANGE_LOW=20000
- SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_LOCAL_ACCOUNTS_DEFAULT_PORTRANGE_HIGH=20190
- LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_CLOUD_SKIPPER_SERVER_DEPLOYER=ERROR
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/dataflow?permitMysqlScheme
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.mariadb.jdbc.Driver
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=rootpw
- SPRING_JACKSON_TIME_ZONE=Asia/Seoul
- SPRING_CLOUD_STREAM_DEFAULT_BINDER=rabbit
- SPRING_CLOUD_DATAFLOW_APPLICATIONPROPERTIES_STREAM_SPRING_RABBITMQ_HOST=rabbitmq
- SPRING_RABBITMQ_HOST=rabbitmq
- SPRING_RABBITMQ_PORT=5672
- SPRING_RABBITMQ_USERNAME=guest
- SPRING_RABBITMQ_PASSWORD=guest
# 추가된 설정: SCDF Global Deployment
- SPRING_CLOUD_DATAFLOW_TASK_PLATFORM_LOCAL_ACCOUNTS_DEFAULT_ENVIRONMENT-VARIABLES=JAVA_OPTS=-Duser.timezone=Asia/Seoul
- SPRING_CLOUD_DATAFLOW_STREAM_PLATFORM_LOCAL_ACCOUNTS_DEFAULT_ENVIRONMENT-VARIABLES=JAVA_OPTS=-Duser.timezone=Asia/Seoul
restart: always
depends_on:
- mysql
- rabbitmq
volumes:
- ${HOST_MOUNT_PATH:-.}:${DOCKER_MOUNT_PATH:-/home/cnb/scdf}
- /home/workday:/home/workday
command: ["java", "-Duser.timezone=Asia/Seoul", "-jar", "/app.jar"]
It's showing a different timezone than the one I set.
When I access each container and check the timezone, I see that it is asia/seoul, so I want to know the reason and solution why the deployed app does not change.
I wanted the timezone to be asia/seoul, so I set it as above. Then I connected to the skipper server container and checked the following.
However, when I added the following code to the stream application and executed it, the result was not asia/seoul.
log.info("Application Default Timezone: " + TimeZone.getDefault().getID());
log.info("Application Current Time: " + LocalDateTime.now());
2024-11-26 01:13:06.128 INFO 801 --- [ main] c.i.f.FileSyncStartProcessor : Application Default Timezone: Etc/UTC
2024-11-26 01:13:06.128 INFO 801 --- [ main] c.i.f.FileSyncStartProcessor : Application Current Time: 2024-11-26T01:13:06.128474
With the experiments I performed you don't need to use -Duser.timezone
you only need to set TZ in environment variables for workloads e.g. deployer.<app>.kubernetes.environment-variables: TZ=Asia/Seoul
and you can add TZ in dataflow and skipper deployments. You can even configure a default environment variable in as part of dataflow and skipper deployments:
spring.cloud.dataflow.task.platform.kubernetes.accounts.default.environmentVariables="TZ=Asia/Seoul"
spring.cloud.skipper.server.platform.kubernetes.accounts.default.environmentVariables="TZ=Asia/Seoul"
For local deployments use local
instead of kubernetes
When using local deployments you have the options to configure:
spring.cloud.skipper.server.platform.local.accounts.default.envVarsToInherit=TZ
spring.cloud.dataflow.task.platform.local.accounts.default.envVarsToInherit=TZ
Then the host platform TZ will be passed along.