forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-5635] [docker] Improvements for Docker on Flink experience
Modifying Dockerfile to build from local flink-dist as well as release URLs. Logging to stdout. Adding scripts to deploy seamlessly on Docker Swarm. Updating Docker Compose scripts to work correctly. Parameterizing things so these Docker scripts are more generally useful.
- Loading branch information
Showing
6 changed files
with
242 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/sh | ||
|
||
################################################################################ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# 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. | ||
################################################################################ | ||
|
||
usage() { | ||
cat <<HERE | ||
Usage: | ||
create-docker-swarm-service.sh [--image-name <image>] <service-name> <service-port> | ||
If the --image-name flag is not used the service will use the 'flink' image. | ||
HERE | ||
exit 1 | ||
} | ||
|
||
if [ "$1" == "--image-name" ]; then | ||
IMAGE_NAME="$2" | ||
shift; shift | ||
else | ||
IMAGE_NAME=flink | ||
fi | ||
|
||
[[ $# -ne 2 ]] && usage | ||
|
||
SERVICE_BASE_NAME="$1" | ||
SERVICE_PORT="${2}" | ||
JOB_MANAGER_NAME=${SERVICE_BASE_NAME}-jobmanager | ||
TASK_MANAGER_NAME=${SERVICE_BASE_NAME}-taskmanager | ||
JOB_MANAGER_RPC_ADDRESS=${JOB_MANAGER_NAME} | ||
OVERLAY_NETWORK_NAME=${SERVICE_BASE_NAME} | ||
|
||
# Create overlay network | ||
docker network create -d overlay ${OVERLAY_NETWORK_NAME} | ||
|
||
# Create the jobmanager service | ||
docker service create --name ${JOB_MANAGER_NAME} --env JOB_MANAGER_RPC_ADDRESS=${JOB_MANAGER_RPC_ADDRESS} -p ${SERVICE_PORT}:8081 --network ${OVERLAY_NETWORK_NAME} ${IMAGE_NAME} jobmanager | ||
|
||
# Create the taskmanger service (scale this out as needed) | ||
docker service create --name ${TASK_MANAGER_NAME} --env JOB_MANAGER_RPC_ADDRESS=${JOB_MANAGER_RPC_ADDRESS} --network ${OVERLAY_NETWORK_NAME} ${IMAGE_NAME} taskmanager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
################################################################################ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# 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 affects logging for both user code and Flink | ||
log4j.rootLogger=INFO, file, console | ||
|
||
# Uncomment this if you want to _only_ change Flink's logging | ||
#log4j.logger.org.apache.flink=INFO | ||
|
||
# The following lines keep the log level of common libraries/connectors on | ||
# log level INFO. The root logger does not override this. You have to manually | ||
# change the log levels here. | ||
log4j.logger.akka=INFO | ||
log4j.logger.org.apache.kafka=INFO | ||
log4j.logger.org.apache.hadoop=INFO | ||
log4j.logger.org.apache.zookeeper=INFO | ||
|
||
# Log all infos in the given file | ||
log4j.appender.file=org.apache.log4j.FileAppender | ||
log4j.appender.file.file=${log.file} | ||
log4j.appender.file.append=false | ||
log4j.appender.file.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %-60c %x - %m%n | ||
|
||
# Log to stdout as well | ||
log4j.appender.console=org.apache.log4j.ConsoleAppender | ||
log4j.appender.console.target=System.err | ||
log4j.appender.console.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %-60c %x - %m%n | ||
|
||
# Suppress the irrelevant (wrong) warnings from the Netty channel handler | ||
log4j.logger.org.jboss.netty.channel.DefaultChannelPipeline=ERROR, file, console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/sh | ||
|
||
################################################################################ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# 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. | ||
################################################################################ | ||
|
||
usage() { | ||
cat <<HERE | ||
Usage: | ||
remove-docker-swarm-service.sh <service-name> | ||
HERE | ||
exit 1 | ||
} | ||
|
||
[[ $# -ne 1 ]] && usage | ||
|
||
SERVICE_BASE_NAME="$1" | ||
JOB_MANAGER_NAME=${SERVICE_BASE_NAME}-jobmanager | ||
TASK_MANAGER_NAME=${SERVICE_BASE_NAME}-taskmanager | ||
OVERLAY_NETWORK_NAME=${SERVICE_BASE_NAME} | ||
|
||
# Remove taskmanager service | ||
docker service rm ${TASK_MANAGER_NAME} | ||
|
||
# Remove jobmanager service | ||
docker service rm ${JOB_MANAGER_NAME} | ||
|
||
# Remove overlay network | ||
docker network rm ${OVERLAY_NETWORK_NAME} |