mirror of
https://github.com/clearlinux/dockerfiles.git
synced 2026-10-03 23:38:31 +00:00
Delete java containers
As Clear Linux removed most of java packages, the flink, tomcat, cassandra and elasticsearch containers are removed as well. https://community.clearlinux.org/t/clear-linux-os-will-be-reducing-its-java-footprint/2454 Signed-off-by: Qi Zheng <qi.zheng@intel.com>
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
FROM clearlinux:latest AS builder
|
||||
|
||||
ARG swupd_args
|
||||
# Move to latest Clear Linux release to ensure
|
||||
# that the swupd command line arguments are
|
||||
# correct
|
||||
RUN swupd update --no-boot-update $swupd_args
|
||||
|
||||
# Grab os-release info from the minimal base image so
|
||||
# that the new content matches the exact OS version
|
||||
COPY --from=clearlinux/os-core:latest /usr/lib/os-release /
|
||||
|
||||
# Install additional content in a target directory
|
||||
# using the os version from the minimal base
|
||||
# Remove openjdk src package to optimize docker image size
|
||||
RUN source /os-release && \
|
||||
mkdir /install_root \
|
||||
&& swupd os-install -V ${VERSION_ID} \
|
||||
--path /install_root --statedir /swupd-state \
|
||||
--bundles=cassandra,os-core-plus,su-exec --no-boot-update \
|
||||
&& rm /install_root/usr/lib/jvm/*/src.zip
|
||||
|
||||
# For some Host OS configuration with redirect_dir on,
|
||||
# extra data are saved on the upper layer when the same
|
||||
# file exists on different layers. To minimize docker
|
||||
# image size, remove the overlapped files before copy.
|
||||
RUN mkdir /os_core_install
|
||||
COPY --from=clearlinux/os-core:latest / /os_core_install/
|
||||
RUN cd / && \
|
||||
find os_core_install | sed -e 's/os_core_install/install_root/' | xargs rm -d &> /dev/null || true
|
||||
|
||||
FROM clearlinux/os-core:latest
|
||||
|
||||
COPY --from=builder /install_root /
|
||||
|
||||
ENV CASSANDRA_CONFIG /usr/share/cassandra/conf
|
||||
ENV PATH /usr/share/cassandra/bin:/usr/share/cassandra/tools/bin:$PATH
|
||||
|
||||
RUN mkdir -p /var/lib/cassandra/{cdc_raw,commitlog,data,hints,saved_caches} \
|
||||
&& chown -R cassandra:cassandra /var/lib/cassandra "$CASSANDRA_CONFIG" \
|
||||
&& chmod -R 777 /var/lib/cassandra /usr/share/cassandra/tools/bin "$CASSANDRA_CONFIG"
|
||||
VOLUME /var/lib/cassandra
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
# 7000: intra-node communication
|
||||
# 7001: TLS intra-node communication
|
||||
# 7199: JMX
|
||||
# 9042: CQL
|
||||
# 9160: thrift service
|
||||
EXPOSE 7000 7001 7199 9042 9160
|
||||
CMD ["cassandra", "-f"]
|
||||
@@ -1,223 +0,0 @@
|
||||
# Clear Linux* OS `cassandra` container image
|
||||
|
||||
<!-- Required -->
|
||||
## What is this image?
|
||||
|
||||
`clearlinux/cassandra` is a Docker image with `cassandra` running on top of the
|
||||
[official clearlinux base image](https://hub.docker.com/_/clearlinux).
|
||||
|
||||
<!-- application introduction -->
|
||||
> [Cassandra](http://cassandra.apache.org/) is a free and open-source, distributed,
|
||||
> wide column store, NoSQL database management system designed to handle large amounts
|
||||
> of data across many commodity servers, providing high availability with no single
|
||||
> point of failure. Cassandra offers robust support for clusters spanning multiple
|
||||
> datacenters, with asynchronous masterless replication allowing low latency operations
|
||||
> for all clients.
|
||||
|
||||
For other Clear Linux* OS
|
||||
based container images, see: https://hub.docker.com/u/clearlinux
|
||||
|
||||
## Why use a clearlinux based image?
|
||||
|
||||
<!-- CL introduction -->
|
||||
> [Clear Linux* OS](https://clearlinux.org/) is an open source, rolling release
|
||||
> Linux distribution optimized for performance and security, from the Cloud to
|
||||
> the Edge, designed for customization, and manageability.
|
||||
|
||||
Clear Linux* OS based container images use:
|
||||
* Optimized libraries that are compiled with latest compiler versions and
|
||||
flags.
|
||||
* Software packages that follow upstream source closely and update frequently.
|
||||
* An aggressive security model and best practices for CVE patching.
|
||||
* A multi-staged build approach to keep a reduced container image size.
|
||||
* The same container syntax as the official images to make getting started
|
||||
easy.
|
||||
|
||||
To learn more about Clear Linux* OS, visit: https://clearlinux.org.
|
||||
|
||||
<!-- Required -->
|
||||
## Deployment:
|
||||
|
||||
### Deploy with Docker
|
||||
The easiest way to get started with this image is by simply pulling it from
|
||||
Docker Hub.
|
||||
|
||||
*Note: This container uses the same syntax as the [official cassandra image](https://hub.docker.com/_/cassandra).
|
||||
|
||||
|
||||
1. Pull the image from Docker Hub:
|
||||
```
|
||||
docker pull clearlinux/cassandra
|
||||
```
|
||||
|
||||
2. Start a container using the examples below:
|
||||
|
||||
```
|
||||
docker run --name some-cassandra --network some-network -d clearlinux/cassandra:tag
|
||||
```
|
||||
|
||||
connect to cassandra from cqlsh
|
||||
---------------------
|
||||
```
|
||||
docker run -it --network some-network --rm clearlinux/cassandra cqlsh -h some-cassandra
|
||||
```
|
||||
|
||||
<!-- Optional -->
|
||||
### Deploy with Kubernetes
|
||||
This image can also be deployed on a Kubernetes cluster.The following example YAML files are provided
|
||||
in the repository as reference for deploying Cassandra with Stateful Sets on a single node cluster:
|
||||
|
||||
- [`pv-local.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/cassandra/pv-local.yaml): local persistent volumes for cassandra database.
|
||||
- [`storageclass.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/cassandra/storageclass.yaml): create a StorageClass with the volumeBindingMode set to “WaitForFirstConsumer”
|
||||
- [`cassandra-deployment.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/cassandra/cassandra-deployment.yaml): example using default configuration to create a basic cassandra service.
|
||||
- [`cassandra-deployment-conf.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/cassandra/cassandra-deployment-conf.yaml): example using your own custom configuration to create a cassandra service.
|
||||
- [`cassandra-statefulset.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/cassandra/cassandra-statefulset.yaml): create a Headless Service and a Statefulset for Cassandra with three replicas.
|
||||
|
||||
|
||||
|
||||
**In this tutorial, we proposed 2 different kinds of method to deploy cassandra: stateless and stateful**
|
||||
|
||||
If you want to deploy Cassandra in **stateful** manner, the example uses official clearlinux cassandra container, to deploy this container on a Kubernetes cluster, please follow with below steps:
|
||||
|
||||
1. Create /mnt/disks directory on local test cluster
|
||||
|
||||
```
|
||||
$ mkdir /mnt/disks
|
||||
$ for vol in vol1 vol2 vol3; do
|
||||
mkdir /mnt/disks/$vol
|
||||
chmod 777 /mnt/disks/$vol
|
||||
done
|
||||
```
|
||||
|
||||
2. Create a StorageClass
|
||||
|
||||
```
|
||||
kubectl apply -f storageclass.yaml
|
||||
```
|
||||
|
||||
3. Create local persistent volumes
|
||||
|
||||
```
|
||||
kubectl apply -f pv-local.yaml
|
||||
```
|
||||
|
||||
4. Create a Headless Service and a Statefulset for Cassandra with three replicas
|
||||
|
||||
```
|
||||
kubectl apply -f cassandra-statefulset.yaml
|
||||
```
|
||||
|
||||
5. Validate the Cassandra StatefulSet
|
||||
|
||||
*Get the Cassandra StatefulSet:
|
||||
|
||||
```
|
||||
kubectl get statefulset cassandra
|
||||
```
|
||||
|
||||
```
|
||||
The response should be:
|
||||
|
||||
NAME READY AGE
|
||||
cassandra 4/4 19h
|
||||
```
|
||||
|
||||
*Get the Pods to see the ordered creation status:
|
||||
|
||||
```
|
||||
kubectl get pods -l="app=cassandra"
|
||||
```
|
||||
|
||||
```
|
||||
The response should be:
|
||||
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
cassandra-0 1/1 Running 0 19h
|
||||
cassandra-1 1/1 Running 0 19h
|
||||
cassandra-2 1/1 Running 1 19h
|
||||
cassandra-3 1/1 Running 1 19h
|
||||
```
|
||||
|
||||
*Run the Cassandra nodetool to display the status of the ring
|
||||
|
||||
```
|
||||
kubectl exec -it cassandra-0 -- nodetool status
|
||||
```
|
||||
|
||||
```
|
||||
The response should be:
|
||||
|
||||
Datacenter: datacenter1
|
||||
=======================
|
||||
Status=Up/Down
|
||||
|/ State=Normal/Leaving/Joining/Moving
|
||||
-- Address Load Tokens Owns (effective) Host ID Rack
|
||||
UN 10.244.0.64 227.89 KiB 256 24.4% d0bf15be-ce18-40be-b3c2-f6f80e307e31 rack1
|
||||
UN 10.244.0.61 189.28 KiB 256 23.2% 2aa68c9c-99b7-4a70-803a-5886019391ac rack1
|
||||
UN 10.244.0.62 195.16 KiB 256 28.1% ecb0fe92-2b28-4be5-921d-a7d6b3367b5f rack1
|
||||
UN 10.244.0.63 228.66 KiB 256 24.3% 9720efad-a434-4b81-9434-9b7cafd72a9b rack1
|
||||
```
|
||||
|
||||
|
||||
|
||||
If you want to deploy Cassandra in **stateless** manner, please follow with below steps:
|
||||
|
||||
1. If you want to deploy `cassandra-deployment.yaml`
|
||||
|
||||
```
|
||||
kubectl create -f cassandra-deployment.yaml
|
||||
```
|
||||
|
||||
Or if you want to deploy `cassandra-deployment-conf.yaml`
|
||||
|
||||
```
|
||||
kubectl create -f cassandra-deployment-conf.yaml
|
||||
```
|
||||
|
||||
2. Install Cassandra bundle and add environmental variable.
|
||||
|
||||
```
|
||||
source cassandra-setup.sh
|
||||
```
|
||||
|
||||
3. Connect to the service, where 30001 is the port number defined in your service.
|
||||
|
||||
```
|
||||
cqlsh <nodeIP> 30001
|
||||
```
|
||||
|
||||
<!-- Required -->
|
||||
|
||||
## Build and modify:
|
||||
|
||||
The Dockerfiles for all Clear Linux* OS based container images are available at
|
||||
https://github.com/clearlinux/dockerfiles. These can be used to build and
|
||||
modify the container images.
|
||||
|
||||
1. Clone the clearlinux/dockerfiles repository.
|
||||
```
|
||||
git clone https://github.com/clearlinux/dockerfiles.git
|
||||
```
|
||||
|
||||
2. Change to the directory of the application:
|
||||
```
|
||||
cd cassandra/
|
||||
```
|
||||
|
||||
3. Build the container image:
|
||||
```
|
||||
docker build -t clearlinux/cassandra .
|
||||
```
|
||||
|
||||
Refer to the Docker documentation for [default build arguments](https://docs.docker.com/engine/reference/builder/#arg).
|
||||
Additionally:
|
||||
|
||||
- `swupd_args` - specifies arguments to pass to the Clear Linux* OS software
|
||||
manager. See the [swupd man pages](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options)
|
||||
for more information.
|
||||
|
||||
<!-- Required -->
|
||||
## Licenses
|
||||
|
||||
All licenses for the Clear Linux* Project and distributed software can be found
|
||||
at https://clearlinux.org/terms-and-policies
|
||||
@@ -1,45 +0,0 @@
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cassandra
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: cassandra
|
||||
spec:
|
||||
containers:
|
||||
- image: docker.io/clearlinux/cassandra
|
||||
name: cassandra
|
||||
env:
|
||||
- name: CASSANDRA_DISK_FAILURE_POLICY
|
||||
value: start
|
||||
- name: CASSANDRA_NUM_TOKENS
|
||||
value: "255"
|
||||
- name: CASSANDRA_CLUSTER_NAME
|
||||
value: my_Cassandra
|
||||
- name: CASSANDRA_DC
|
||||
value: DC1
|
||||
- name: CASSANDRA_RACK
|
||||
value: Kubernetes Cluster
|
||||
- name: CASSANDRA_ENDPOINT_SNITCH
|
||||
value: GossipingPropertyFileSnitch
|
||||
ports:
|
||||
- containerPort: 9042
|
||||
name: cql
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cassandra-svc
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 9042
|
||||
targetPort: 9042
|
||||
nodePort: 30001
|
||||
selector:
|
||||
name: cassandra
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cassandra
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: cassandra
|
||||
spec:
|
||||
containers:
|
||||
- image: docker.io/clearlinux/cassandra
|
||||
name: cassandra
|
||||
ports:
|
||||
- containerPort: 9042
|
||||
name: cql
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cassandra-svc
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 9042
|
||||
targetPort: 9042
|
||||
nodePort: 30001
|
||||
selector:
|
||||
name: cassandra
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
swupd bundle-add cassandra
|
||||
swupd bundle-add which
|
||||
BIN_CASSANDRA="/usr/share/cassandra/bin"
|
||||
BIN_CASSANDRA_TOOL="/usr/share/cassandra/tools/bin"
|
||||
export PATH=$PATH:$BIN_CASSANDRA:$BIN_CASSANDRA_TOOL
|
||||
chmod -R 777 /usr/share/cassandra/tools/bin
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cassandra
|
||||
labels:
|
||||
app: cassandra
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
name: cassandra
|
||||
clusterIP: None
|
||||
selector:
|
||||
app: cassandra
|
||||
---
|
||||
apiVersion: "apps/v1" # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: cassandra
|
||||
labels:
|
||||
app: cassandra
|
||||
spec:
|
||||
serviceName: cassandra
|
||||
replicas: 4
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cassandra
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cassandra
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 1800
|
||||
containers:
|
||||
- name: cassandra
|
||||
image: clearlinux/cassandra:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 7000
|
||||
name: intra-node
|
||||
- containerPort: 7001
|
||||
name: tls-intra-node
|
||||
- containerPort: 7199
|
||||
name: jmx
|
||||
- containerPort: 9042
|
||||
name: cql
|
||||
resources:
|
||||
limits:
|
||||
cpu: "500m"
|
||||
memory: 1Gi
|
||||
requests:
|
||||
cpu: "500m"
|
||||
memory: 1Gi
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- IPC_LOCK
|
||||
lifecycle:
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- nodetool drain
|
||||
env:
|
||||
- name: MAX_HEAP_SIZE
|
||||
value: 512M
|
||||
- name: HEAP_NEWSIZE
|
||||
value: 100M
|
||||
- name: CASSANDRA_SEEDS
|
||||
value: "cassandra-0.cassandra.default.svc.cluster.local"
|
||||
- name: CASSANDRA_CLUSTER_NAME
|
||||
value: "K8Demo"
|
||||
- name: CASSANDRA_DC
|
||||
value: "DC1-K8Demo"
|
||||
- name: CASSANDRA_RACK
|
||||
value: "Rack1-K8Demo"
|
||||
- name: CASSANDRA_SEED_PROVIDER
|
||||
value: io.k8s.cassandra.KubernetesSeedProvider
|
||||
- name: POD_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
# These volume mounts are persistent. They are like inline claims,
|
||||
# but not exactly because the names need to match exactly one of
|
||||
# the stateful pod volumes.
|
||||
volumeMounts:
|
||||
- name: cassandra-data
|
||||
mountPath: /var/lib/cassandra
|
||||
# These are converted to volume claims by the controller
|
||||
# and mounted at the paths mentioned above.
|
||||
# do not use these in production until ssd GCEPersistentDisk or other ssd pd
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: cassandra-data
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: my-local-pv
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# first arg is `-f` or `--some-option`
|
||||
# or there are no args
|
||||
if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
|
||||
set -- cassandra -f "$@"
|
||||
fi
|
||||
|
||||
# allow the container to be started with `--user`
|
||||
if [ "$1" = 'cassandra' -a "$(id -u)" = '0' ]; then
|
||||
exec su-exec cassandra "$BASH_SOURCE" "$@"
|
||||
fi
|
||||
|
||||
_ip_address() {
|
||||
# scrape the first non-localhost IP address of the container
|
||||
# in Swarm Mode, we often get two IPs -- the container IP, and the (shared) VIP, and the container IP should always be first
|
||||
ip address | awk '
|
||||
$1 == "inet" && $NF != "lo" {
|
||||
gsub(/\/.+$/, "", $2)
|
||||
print $2
|
||||
exit
|
||||
}
|
||||
'
|
||||
}
|
||||
|
||||
# "sed -i", but without "mv" (which doesn't work on a bind-mounted file, for example)
|
||||
_sed-in-place() {
|
||||
local filename="$1"; shift
|
||||
local tempFile
|
||||
tempFile="$(mktemp)"
|
||||
sed "$@" "$filename" > "$tempFile"
|
||||
cat "$tempFile" > "$filename"
|
||||
rm "$tempFile"
|
||||
}
|
||||
|
||||
if [ "$1" = 'cassandra' ]; then
|
||||
: ${CASSANDRA_RPC_ADDRESS='0.0.0.0'}
|
||||
|
||||
: ${CASSANDRA_LISTEN_ADDRESS='auto'}
|
||||
if [ "$CASSANDRA_LISTEN_ADDRESS" = 'auto' ]; then
|
||||
CASSANDRA_LISTEN_ADDRESS="$(_ip_address)"
|
||||
fi
|
||||
|
||||
: ${CASSANDRA_BROADCAST_ADDRESS="$CASSANDRA_LISTEN_ADDRESS"}
|
||||
|
||||
if [ "$CASSANDRA_BROADCAST_ADDRESS" = 'auto' ]; then
|
||||
CASSANDRA_BROADCAST_ADDRESS="$(_ip_address)"
|
||||
fi
|
||||
: ${CASSANDRA_BROADCAST_RPC_ADDRESS:=$CASSANDRA_BROADCAST_ADDRESS}
|
||||
|
||||
if [ -n "${CASSANDRA_NAME:+1}" ]; then
|
||||
: ${CASSANDRA_SEEDS:="cassandra"}
|
||||
fi
|
||||
: ${CASSANDRA_SEEDS:="$CASSANDRA_BROADCAST_ADDRESS"}
|
||||
|
||||
_sed-in-place "$CASSANDRA_CONFIG/cassandra.yaml" \
|
||||
-r 's/(- seeds:).*/\1 "'"$CASSANDRA_SEEDS"'"/'
|
||||
|
||||
for yaml in \
|
||||
broadcast_address \
|
||||
broadcast_rpc_address \
|
||||
cluster_name \
|
||||
endpoint_snitch \
|
||||
listen_address \
|
||||
num_tokens \
|
||||
rpc_address \
|
||||
start_rpc \
|
||||
; do
|
||||
var="CASSANDRA_${yaml^^}"
|
||||
val="${!var}"
|
||||
if [ "$val" ]; then
|
||||
_sed-in-place "$CASSANDRA_CONFIG/cassandra.yaml" \
|
||||
-r 's/^(# )?('"$yaml"':).*/\2 '"$val"'/'
|
||||
fi
|
||||
done
|
||||
|
||||
for rackdc in dc rack; do
|
||||
var="CASSANDRA_${rackdc^^}"
|
||||
val="${!var}"
|
||||
if [ "$val" ]; then
|
||||
_sed-in-place "$CASSANDRA_CONFIG/cassandra-rackdc.properties" \
|
||||
-r 's/^('"$rackdc"'=).*/\1 '"$val"'/'
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
@@ -1,96 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: task-pv-volume1
|
||||
labels:
|
||||
type: local
|
||||
spec:
|
||||
storageClassName: my-local-pv
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
hostPath:
|
||||
path: "/mnt/disks/vol1"
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- wangjue-clr-host
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: task-pv-volume2
|
||||
labels:
|
||||
type: local
|
||||
spec:
|
||||
storageClassName: my-local-pv
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
hostPath:
|
||||
path: "/mnt/disks/vol2"
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- wangjue-clr-host
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: task-pv-volume3
|
||||
labels:
|
||||
type: local
|
||||
spec:
|
||||
storageClassName: my-local-pv
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
hostPath:
|
||||
path: "/mnt/disks/vol3"
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- wangjue-clr-host
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: task-pv-volume4
|
||||
labels:
|
||||
type: local
|
||||
spec:
|
||||
storageClassName: my-local-pv
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
hostPath:
|
||||
path: "/mnt/disks/vol4"
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- wangjue-clr-host
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
kind: StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
metadata:
|
||||
name: my-local-pv
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
@@ -1,51 +0,0 @@
|
||||
FROM clearlinux:latest AS builder
|
||||
|
||||
ARG swupd_args
|
||||
# Move to latest Clear Linux release to ensure
|
||||
# that the swupd command line arguments are
|
||||
# correct
|
||||
RUN swupd update --no-boot-update $swupd_args
|
||||
|
||||
# Grab os-release info from the minimal base image so
|
||||
# that the new content matches the exact OS version
|
||||
COPY --from=clearlinux/os-core:latest /usr/lib/os-release /
|
||||
|
||||
# Install additional content in a target directory
|
||||
# using the os version from the minimal base
|
||||
RUN source /os-release && \
|
||||
mkdir /install_root \
|
||||
&& swupd os-install -V ${VERSION_ID} \
|
||||
--path /install_root --statedir /swupd-state \
|
||||
--bundles=elasticsearch,su-exec --no-boot-update
|
||||
|
||||
# For some Host OS configuration with redirect_dir on,
|
||||
# extra data are saved on the upper layer when the same
|
||||
# file exists on different layers. To minimize docker
|
||||
# image size, remove the overlapped files before copy.
|
||||
RUN mkdir /os_core_install
|
||||
COPY --from=clearlinux/os-core:latest / /os_core_install/
|
||||
RUN cd / && \
|
||||
find os_core_install | sed -e 's/os_core_install/install_root/' | xargs rm -d &> /dev/null || true
|
||||
|
||||
FROM clearlinux/os-core:latest
|
||||
|
||||
COPY --from=builder /install_root /
|
||||
|
||||
RUN set -ex \
|
||||
&& for path in \
|
||||
/var/data/elasticsearch \
|
||||
/var/log/elasticsearch \
|
||||
/etc/elasticsearch \
|
||||
; do \
|
||||
mkdir -p "$path"; \
|
||||
chown -R elasticsearch:elasticsearch "$path"; \
|
||||
done
|
||||
|
||||
COPY config /etc/elasticsearch
|
||||
COPY docker-entrypoint.sh /
|
||||
|
||||
VOLUME /var/data/elasticsearch
|
||||
|
||||
EXPOSE 9200 9300
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
CMD ["-Epath.conf=/etc/elasticsearch/"]
|
||||
@@ -1,113 +0,0 @@
|
||||
# Clear Linux* OS `elasticsearch` container image
|
||||
|
||||
<!-- Required -->
|
||||
## What is this image?
|
||||
|
||||
`clearlinux/elasticsearch` is a Docker image with `elasticsearch` running on top of the
|
||||
[official clearlinux base image](https://hub.docker.com/_/clearlinux).
|
||||
|
||||
<!-- application introduction -->
|
||||
> [Elasticsearch](https://www.elastic.co/) is a search engine based on the Lucene library
|
||||
> It provides a distributed, multitenant-capable full-text search engine with an HTTP web
|
||||
> interface and schema-free JSON documents. Elasticsearch is developed in Java.
|
||||
|
||||
For other Clear Linux* OS
|
||||
based container images, see: https://hub.docker.com/u/clearlinux
|
||||
|
||||
## Why use a clearlinux based image?
|
||||
|
||||
<!-- CL introduction -->
|
||||
> [Clear Linux* OS](https://clearlinux.org/) is an open source, rolling release
|
||||
> Linux distribution optimized for performance and security, from the Cloud to
|
||||
> the Edge, designed for customization, and manageability.
|
||||
|
||||
Clear Linux* OS based container images use:
|
||||
* Optimized libraries that are compiled with latest compiler versions and
|
||||
flags.
|
||||
* Software packages that follow upstream source closely and update frequently.
|
||||
* An aggressive security model and best practices for CVE patching.
|
||||
* A multi-staged build approach to keep a reduced container image size.
|
||||
* The same container syntax as the official images to make getting started
|
||||
easy.
|
||||
|
||||
To learn more about Clear Linux* OS, visit: https://clearlinux.org.
|
||||
|
||||
<!-- Required -->
|
||||
## Deployment:
|
||||
|
||||
### Deploy with Docker
|
||||
The easiest way to get started with this image is by simply pulling it from
|
||||
Docker Hub.
|
||||
|
||||
*Note: This container uses the same syntax as the [official elasticsearch image](https://hub.docker.com/_/elasticsearch).
|
||||
|
||||
|
||||
1. Pull the image from Docker Hub:
|
||||
```
|
||||
docker pull clearlinux/elasticsearch
|
||||
```
|
||||
|
||||
2. Start a container using the examples below:
|
||||
```
|
||||
docker volume create esdata
|
||||
docker run -d -p 9200:9200 -e "discovery.type=single-elasticsearch" -v esdata:/var/data/elasticsearch clearlinux/elasticsearch
|
||||
```
|
||||
|
||||
3. Check cluster health
|
||||
```
|
||||
curl http://localhost:9200/_cluster/health?pretty
|
||||
```
|
||||
|
||||
4. Create an index called customer
|
||||
```
|
||||
curl -X PUT "localhost:9200/customer?pretty"
|
||||
```
|
||||
|
||||
5. Add new document to that index
|
||||
```
|
||||
curl -X PUT "localhost:9200/customer/doc/1?pretty" -H 'Content-Type: application/json' -d'{"name": "Tom John" }'
|
||||
curl -X PUT "localhost:9200/customer/doc/2?pretty" -H 'Content-Type: application/json' -d'{"name": "Kelly Wong" }'
|
||||
```
|
||||
|
||||
6. View documents in the index
|
||||
```
|
||||
curl localhost:9200/customer/_search?pretty
|
||||
```
|
||||
|
||||
<!-- Optional -->
|
||||
### Deploy with Kubernetes
|
||||
|
||||
<!-- Required -->
|
||||
## Build and modify:
|
||||
|
||||
The Dockerfiles for all Clear Linux* OS based container images are available at
|
||||
https://github.com/clearlinux/dockerfiles. These can be used to build and
|
||||
modify the container images.
|
||||
|
||||
1. Clone the clearlinux/dockerfiles repository.
|
||||
```
|
||||
git clone https://github.com/clearlinux/dockerfiles.git
|
||||
```
|
||||
|
||||
2. Change to the directory of the application:
|
||||
```
|
||||
cd elasticsearch/
|
||||
```
|
||||
|
||||
3. Build the container image:
|
||||
```
|
||||
docker build -t clearlinux/elasticsearch .
|
||||
```
|
||||
|
||||
Refer to the Docker documentation for [default build arguments](https://docs.docker.com/engine/reference/builder/#arg).
|
||||
Additionally:
|
||||
|
||||
- `swupd_args` - specifies arguments to pass to the Clear Linux* OS software
|
||||
manager. See the [swupd man pages](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options)
|
||||
for more information.
|
||||
|
||||
<!-- Required -->
|
||||
## Licenses
|
||||
|
||||
All licenses for the Clear Linux* Project and distributed software can be found
|
||||
at https://clearlinux.org/terms-and-policies
|
||||
@@ -1,9 +0,0 @@
|
||||
http.host: 0.0.0.0
|
||||
|
||||
# Uncomment the following lines for a production cluster deployment
|
||||
#transport.host: 0.0.0.0
|
||||
#discovery.zen.minimum_master_nodes: 1
|
||||
|
||||
path:
|
||||
data: /var/data/elasticsearch
|
||||
logs: /var/log/elasticsearch
|
||||
@@ -1,9 +0,0 @@
|
||||
status = error
|
||||
|
||||
appender.console.type = Console
|
||||
appender.console.name = console
|
||||
appender.console.layout.type = PatternLayout
|
||||
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n
|
||||
|
||||
rootLogger.level = info
|
||||
rootLogger.appenderRef.console.ref = console
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
export PATH=/usr/share/elasticsearch/bin/:$PATH
|
||||
|
||||
# Add elasticsearch as command if needed
|
||||
if [ "${1:0:1}" = '-' ]; then
|
||||
set -- elasticsearch "$@"
|
||||
fi
|
||||
|
||||
# Drop root privileges if we are running elasticsearch
|
||||
# allow the container to be started with `--user`
|
||||
if [ "$1" = 'elasticsearch' -a "$(id -u)" = '0' ]; then
|
||||
# Change the ownership of user-mutable directories to elasticsearch
|
||||
for path in \
|
||||
/var/data/elasticsearch \
|
||||
/var/log/elasticsearch \
|
||||
; do
|
||||
chown -R elasticsearch:elasticsearch "$path"
|
||||
done
|
||||
|
||||
set -- su-exec elasticsearch "$@"
|
||||
fi
|
||||
|
||||
# As argument is not related to elasticsearch,
|
||||
# then assume that user wants to run his own process,
|
||||
# for example a `bash` shell to explore this image
|
||||
exec "$@"
|
||||
@@ -1,56 +0,0 @@
|
||||
FROM clearlinux:latest AS builder
|
||||
|
||||
ARG swupd_args
|
||||
# Move to latest Clear Linux release to ensure
|
||||
# that the swupd command line arguments are
|
||||
# correct
|
||||
RUN swupd update --no-boot-update $swupd_args
|
||||
|
||||
# Grab os-release info from the minimal base image so
|
||||
# that the new content matches the exact OS version
|
||||
COPY --from=clearlinux/os-core:latest /usr/lib/os-release /
|
||||
|
||||
# Install additional content in a target directory
|
||||
# using the os version from the minimal base
|
||||
RUN source /os-release && \
|
||||
mkdir /install_root \
|
||||
&& swupd os-install -V ${VERSION_ID} \
|
||||
--path /install_root --statedir /swupd-state \
|
||||
--bundles=os-core-update,apache-flink --no-boot-update
|
||||
|
||||
# For some Host OS configuration with redirect_dir on,
|
||||
# extra data are saved on the upper layer when the same
|
||||
# file exists on different layers. To minimize docker
|
||||
# image size, remove the overlapped files before copy.
|
||||
RUN mkdir /os_core_install
|
||||
COPY --from=clearlinux/os-core:latest / /os_core_install/
|
||||
RUN cd / && \
|
||||
find os_core_install | sed -e 's/os_core_install/install_root/' | xargs rm -d &> /dev/null || true
|
||||
|
||||
|
||||
FROM clearlinux/os-core:latest
|
||||
|
||||
COPY --from=builder /install_root /
|
||||
|
||||
# Prepare environment
|
||||
ENV FLINK_HOME=/usr/share/flink
|
||||
ENV PATH=$FLINK_HOME/bin:$PATH
|
||||
|
||||
#create group and user flink
|
||||
RUN groupadd --system --gid=9999 flink && \
|
||||
useradd --system --home-dir $FLINK_HOME --uid=9999 --gid=flink flink
|
||||
|
||||
WORKDIR $FLINK_HOME
|
||||
|
||||
#change owner for workdir
|
||||
RUN chown -R flink:flink .
|
||||
|
||||
# Prepare to run
|
||||
RUN mkdir -p /var/log/flink
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
EXPOSE 6123 8081
|
||||
CMD ["help"]
|
||||
-123
@@ -1,123 +0,0 @@
|
||||
# Clear Linux* OS `flink` container image
|
||||
|
||||
<!-- Required -->
|
||||
## What is this image?
|
||||
|
||||
`clearlinux/flink` is a Docker image with `flink` running on top of the
|
||||
[official clearlinux base image](https://hub.docker.com/_/clearlinux).
|
||||
|
||||
<!-- application introduction -->
|
||||
> [Flink](http://flink.apache.org/) is a framework and distributed processing engine
|
||||
> for stateful computations over unbounded and bounded data streams. Flink has been
|
||||
> designed to run in all common cluster environments, perform computations at in-memory
|
||||
> speed and at any scale.
|
||||
|
||||
For other Clear Linux* OS
|
||||
based container images, see: https://hub.docker.com/u/clearlinux
|
||||
|
||||
## Why use a clearlinux based image?
|
||||
|
||||
<!-- CL introduction -->
|
||||
> [Clear Linux* OS](https://clearlinux.org/) is an open source, rolling release
|
||||
> Linux distribution optimized for performance and security, from the Cloud to
|
||||
> the Edge, designed for customization, and manageability.
|
||||
|
||||
Clear Linux* OS based container images use:
|
||||
* Optimized libraries that are compiled with latest compiler versions and
|
||||
flags.
|
||||
* Software packages that follow upstream source closely and update frequently.
|
||||
* An aggressive security model and best practices for CVE patching.
|
||||
* A multi-staged build approach to keep a reduced container image size.
|
||||
* The same container syntax as the official images to make getting started
|
||||
easy.
|
||||
|
||||
To learn more about Clear Linux* OS, visit: https://clearlinux.org.
|
||||
|
||||
<!-- Required -->
|
||||
## Deployment:
|
||||
|
||||
### Deploy with Docker
|
||||
The easiest way to get started with this image is by simply pulling it from
|
||||
Docker Hub.
|
||||
|
||||
*Note: This container uses the same syntax as the [official flink
|
||||
image](https://hub.docker.com/_/flink).
|
||||
|
||||
|
||||
1. Pull the image from Docker Hub:
|
||||
```
|
||||
docker pull clearlinux/flink
|
||||
```
|
||||
|
||||
2. Start a container using the examples below:
|
||||
|
||||
```
|
||||
docker run -d clearlinux/flink
|
||||
```
|
||||
|
||||
|
||||
<!-- Optional -->
|
||||
### Deploy with Kubernetes
|
||||
|
||||
This image can also be deployed on a Kubernetes cluster, such as [minikube](https://kubernetes.io/docs/setup/learning-environment/minikube/).The following example YAML files are provided in the repository as reference for Kubernetes deployment:
|
||||
|
||||
- [`flink-deployment.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/flink/flink-deployment.yaml): example using default configuration to create a basic flink service.
|
||||
|
||||
- [`flink-deployment-conf.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/flink/flink-deployment-conf.yaml): example using your own custom configuration to create a flink service.
|
||||
|
||||
|
||||
|
||||
Steps to deploy flink on a Kubernetes cluster:
|
||||
|
||||
1. If you want to deploy `flink-deployment.yaml`
|
||||
|
||||
```
|
||||
kubectl create -f flink-deployment.yaml
|
||||
```
|
||||
|
||||
Or if you want to deploy `flink-deployment-conf.yaml`
|
||||
|
||||
```
|
||||
kubectl create -f flink-deployment-conf.yaml
|
||||
```
|
||||
|
||||
2. Run kubectl proxy in your terminal.
|
||||
|
||||
3. Navigate to [http://\<nodeIP\>:8001/api/v1/namespaces/default/services/flink-jobmanager:ui/proxy](http://\<nodeIP\>:8001/api/v1/namespaces/default/services/flink-jobmanager:ui/proxy) in your browser.
|
||||
|
||||
<!-- Required -->
|
||||
## Build and modify:
|
||||
|
||||
The Dockerfiles for all Clear Linux* OS based container images are available at
|
||||
https://github.com/clearlinux/dockerfiles. These can be used to build and
|
||||
modify the container images.
|
||||
|
||||
1. Clone the clearlinux/dockerfiles repository.
|
||||
```
|
||||
git clone https://github.com/clearlinux/dockerfiles.git
|
||||
```
|
||||
|
||||
2. Change to the directory of the application:
|
||||
```
|
||||
cd flink/
|
||||
```
|
||||
|
||||
3. Build the container image:
|
||||
```
|
||||
docker build -t clearlinux/flink .
|
||||
```
|
||||
|
||||
Refer to the Docker documentation for [default build
|
||||
arguments](https://docs.docker.com/engine/reference/builder/#arg).
|
||||
Additionally:
|
||||
|
||||
- `swupd_args` - specifies arguments to pass to the Clear Linux* OS software
|
||||
manager. See the [swupd man
|
||||
pages](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options)
|
||||
for more information.
|
||||
|
||||
<!-- Required -->
|
||||
## Licenses
|
||||
|
||||
All licenses for the Clear Linux* Project and distributed software can be found
|
||||
at https://clearlinux.org/terms-and-policies
|
||||
@@ -1,90 +0,0 @@
|
||||
#!/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.
|
||||
###############################################################################
|
||||
|
||||
# If unspecified, the hostname of the container is taken as the JobManager address
|
||||
JOB_MANAGER_RPC_ADDRESS=${JOB_MANAGER_RPC_ADDRESS:-$(hostname -f)}
|
||||
CONF_FILE="/usr/share/defaults/flink/flink-conf.yaml"
|
||||
|
||||
drop_privs_cmd() {
|
||||
return
|
||||
}
|
||||
|
||||
if [ "$1" = "help" ]; then
|
||||
echo "Usage: $(basename "$0") (jobmanager|taskmanager|help)"
|
||||
exit 0
|
||||
elif [ "$1" = "jobmanager" ]; then
|
||||
shift 1
|
||||
echo "Starting Job Manager"
|
||||
|
||||
if grep -E "^jobmanager\.rpc\.address:.*" "${CONF_FILE}" > /dev/null; then
|
||||
sed -i -e "s/jobmanager\.rpc\.address:.*/jobmanager.rpc.address: ${JOB_MANAGER_RPC_ADDRESS}/g" "${CONF_FILE}"
|
||||
else
|
||||
echo "jobmanager.rpc.address: ${JOB_MANAGER_RPC_ADDRESS}" >> "${CONF_FILE}"
|
||||
fi
|
||||
|
||||
if grep -E "^blob\.server\.port:.*" "${CONF_FILE}" > /dev/null; then
|
||||
sed -i -e "s/blob\.server\.port:.*/blob.server.port: 6124/g" "${CONF_FILE}"
|
||||
else
|
||||
echo "blob.server.port: 6124" >> "${CONF_FILE}"
|
||||
fi
|
||||
|
||||
if grep -E "^query\.server\.port:.*" "${CONF_FILE}" > /dev/null; then
|
||||
sed -i -e "s/query\.server\.port:.*/query.server.port: 6125/g" "${CONF_FILE}"
|
||||
else
|
||||
echo "query.server.port: 6125" >> "${CONF_FILE}"
|
||||
fi
|
||||
|
||||
echo "config file: " && grep '^[^\n#]' "${CONF_FILE}"
|
||||
exec $(drop_privs_cmd) "$FLINK_HOME/bin/jobmanager.sh" start-foreground "$@"
|
||||
elif [ "$1" = "taskmanager" ]; then
|
||||
shift 1
|
||||
echo "Starting Task Manager"
|
||||
|
||||
TASK_MANAGER_NUMBER_OF_TASK_SLOTS=${TASK_MANAGER_NUMBER_OF_TASK_SLOTS:-$(grep -c ^processor /proc/cpuinfo)}
|
||||
|
||||
if grep -E "^jobmanager\.rpc\.address:.*" "${CONF_FILE}" > /dev/null; then
|
||||
sed -i -e "s/jobmanager\.rpc\.address:.*/jobmanager.rpc.address: ${JOB_MANAGER_RPC_ADDRESS}/g" "${CONF_FILE}"
|
||||
else
|
||||
echo "jobmanager.rpc.address: ${JOB_MANAGER_RPC_ADDRESS}" >> "${CONF_FILE}"
|
||||
fi
|
||||
|
||||
if grep -E "^taskmanager\.numberOfTaskSlots:.*" "${CONF_FILE}" > /dev/null; then
|
||||
sed -i -e "s/taskmanager\.numberOfTaskSlots:.*/taskmanager.numberOfTaskSlots: ${TASK_MANAGER_NUMBER_OF_TASK_SLOTS}/g" "${CONF_FILE}"
|
||||
else
|
||||
echo "taskmanager.numberOfTaskSlots: ${TASK_MANAGER_NUMBER_OF_TASK_SLOTS}" >> "${CONF_FILE}"
|
||||
fi
|
||||
|
||||
if grep -E "^blob\.server\.port:.*" "${CONF_FILE}" > /dev/null; then
|
||||
sed -i -e "s/blob\.server\.port:.*/blob.server.port: 6124/g" "${CONF_FILE}"
|
||||
else
|
||||
echo "blob.server.port: 6124" >> "${CONF_FILE}"
|
||||
fi
|
||||
|
||||
if grep -E "^query\.server\.port:.*" "${CONF_FILE}" > /dev/null; then
|
||||
sed -i -e "s/query\.server\.port:.*/query.server.port: 6125/g" "${CONF_FILE}"
|
||||
else
|
||||
echo "query.server.port: 6125" >> "${CONF_FILE}"
|
||||
fi
|
||||
|
||||
echo "config file: " && grep '^[^\n#]' "${CONF_FILE}"
|
||||
exec $(drop_privs_cmd) "$FLINK_HOME/bin/taskmanager.sh" start-foreground "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
@@ -1,134 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: flink-config
|
||||
labels:
|
||||
app: flink
|
||||
data:
|
||||
flink-conf.yaml: |+
|
||||
jobmanager.rpc.address: flink-jobmanager
|
||||
taskmanager.numberOfTaskSlots: 1
|
||||
blob.server.port: 6124
|
||||
jobmanager.rpc.port: 6123
|
||||
taskmanager.rpc.port: 6122
|
||||
jobmanager.heap.size: 1024m
|
||||
taskmanager.heap.size: 1000m
|
||||
log4j.properties: |+
|
||||
log4j.rootLogger=INFO, file
|
||||
log4j.logger.akka=INFO
|
||||
log4j.logger.org.apache.kafka=INFO
|
||||
log4j.logger.org.apache.hadoop=INFO
|
||||
log4j.logger.org.apache.zookeeper=INFO
|
||||
log4j.appender.file=org.apache.log4j.FileAppender
|
||||
log4j.appender.file.file=${log.file}
|
||||
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
|
||||
log4j.logger.org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline=ERROR, file
|
||||
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: flink-jobmanager
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: flink
|
||||
component: jobmanager
|
||||
spec:
|
||||
containers:
|
||||
- name: jobmanager
|
||||
image: docker.io/clearlinux/flink
|
||||
args:
|
||||
- jobmanager
|
||||
ports:
|
||||
- containerPort: 6123
|
||||
name: rpc
|
||||
- containerPort: 6124
|
||||
name: blob
|
||||
- containerPort: 6125
|
||||
name: query
|
||||
- containerPort: 8081
|
||||
name: ui
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: 6122
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 60
|
||||
volumeMounts:
|
||||
- name: flink-config-volume
|
||||
mountPath: /usr/share/defaults/flink
|
||||
volumes:
|
||||
- name: flink-config-volume
|
||||
configMap:
|
||||
name: flink-config
|
||||
items:
|
||||
- key: flink-conf.yaml
|
||||
path: flink-conf.yaml
|
||||
- key: log4j.properties
|
||||
path: log4j.properties
|
||||
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: flink-taskmanager
|
||||
spec:
|
||||
replicas: 2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: flink
|
||||
component: taskmanager
|
||||
spec:
|
||||
containers:
|
||||
- name: taskmanager
|
||||
image: docker.io/clearlinux/flink
|
||||
args:
|
||||
- taskmanager
|
||||
ports:
|
||||
- containerPort: 6121
|
||||
name: data
|
||||
- containerPort: 6122
|
||||
name: rpc
|
||||
- containerPort: 6125
|
||||
name: query
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: 6122
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 60
|
||||
volumeMounts:
|
||||
- name: flink-config-volume
|
||||
mountPath: /usr/share/defaults/flink
|
||||
volumes:
|
||||
- name: flink-config-volume
|
||||
configMap:
|
||||
name: flink-config
|
||||
items:
|
||||
- key: flink-conf.yaml
|
||||
path: flink-conf.yaml
|
||||
- key: log4j.properties
|
||||
path: log4j.properties
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: flink-jobmanager
|
||||
spec:
|
||||
ports:
|
||||
- name: rpc
|
||||
port: 6123
|
||||
- name: blob
|
||||
port: 6124
|
||||
- name: query
|
||||
port: 6125
|
||||
- name: ui
|
||||
port: 8081
|
||||
selector:
|
||||
app: flink
|
||||
component: jobmanager
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: flink-jobmanager
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: flink
|
||||
component: jobmanager
|
||||
spec:
|
||||
containers:
|
||||
- name: jobmanager
|
||||
image: docker.io/clearlinux/flink
|
||||
args:
|
||||
- jobmanager
|
||||
ports:
|
||||
- containerPort: 6123
|
||||
name: rpc
|
||||
- containerPort: 6124
|
||||
name: blob
|
||||
- containerPort: 6125
|
||||
name: query
|
||||
- containerPort: 8081
|
||||
name: ui
|
||||
env:
|
||||
- name: JOB_MANAGER_RPC_ADDRESS
|
||||
value: flink-jobmanager
|
||||
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: flink-taskmanager
|
||||
spec:
|
||||
replicas: 2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: flink
|
||||
component: taskmanager
|
||||
spec:
|
||||
containers:
|
||||
- name: taskmanager
|
||||
image: docker.io/clearlinux/flink
|
||||
args:
|
||||
- taskmanager
|
||||
ports:
|
||||
- containerPort: 6121
|
||||
name: data
|
||||
- containerPort: 6122
|
||||
name: rpc
|
||||
- containerPort: 6125
|
||||
name: query
|
||||
env:
|
||||
- name: JOB_MANAGER_RPC_ADDRESS
|
||||
value: flink-jobmanager
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: flink-jobmanager
|
||||
spec:
|
||||
ports:
|
||||
- name: rpc
|
||||
port: 6123
|
||||
- name: blob
|
||||
port: 6124
|
||||
- name: query
|
||||
port: 6125
|
||||
- name: ui
|
||||
port: 8081
|
||||
selector:
|
||||
app: flink
|
||||
component: jobmanager
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env bats
|
||||
# *-*- Mode: sh; c-basic-offset: 8; indent-tabs-mode: nil -*-*
|
||||
|
||||
load ../utils
|
||||
|
||||
@test "Start flink cluster" {
|
||||
docker run --name flink-cluster --rm -d -p 8081:8081 clearlinux/flink jobmanager
|
||||
sleep 5
|
||||
run check_container_status flink-cluster
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "Connecting to flink cluster" {
|
||||
curl --silent -X GET --noproxy 'localhost' 'http://localhost:8081/' \
|
||||
| grep "Apache Flink Web Dashboard"
|
||||
}
|
||||
|
||||
@test "Stop flink cluster" {
|
||||
docker stop flink-cluster
|
||||
sleep 3
|
||||
run check_container_status flink-cluster
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
FROM clearlinux:latest AS builder
|
||||
|
||||
ARG swupd_args
|
||||
# Move to latest Clear Linux release to ensure
|
||||
# that the swupd command line arguments are
|
||||
# correct
|
||||
RUN swupd update --no-boot-update $swupd_args
|
||||
|
||||
# Grab os-release info from the minimal base image so
|
||||
# that the new content matches the exact OS version
|
||||
COPY --from=clearlinux/os-core:latest /usr/lib/os-release /
|
||||
|
||||
# Install additional content in a target directory
|
||||
# using the os version from the minimal base
|
||||
RUN source /os-release && \
|
||||
mkdir /install_root \
|
||||
&& swupd os-install -V ${VERSION_ID} \
|
||||
--path /install_root --statedir /swupd-state \
|
||||
--bundles=apache-tomcat --no-boot-update
|
||||
|
||||
# For some Host OS configuration with redirect_dir on,
|
||||
# extra data are saved on the upper layer when the same
|
||||
# file exists on different layers. To minimize docker
|
||||
# image size, remove the overlapped files before copy.
|
||||
RUN mkdir /os_core_install
|
||||
COPY --from=clearlinux/os-core:latest / /os_core_install/
|
||||
RUN cd / && \
|
||||
find os_core_install | sed -e 's/os_core_install/install_root/' | xargs rm -d &> /dev/null || true
|
||||
|
||||
FROM clearlinux/os-core:latest
|
||||
|
||||
COPY --from=builder /install_root /
|
||||
|
||||
EXPOSE 8080
|
||||
CMD ["catalina.sh", "run"]
|
||||
@@ -1,126 +0,0 @@
|
||||
# Clear Linux* OS `tomcat` container image
|
||||
|
||||
<!-- Required -->
|
||||
## What is this image?
|
||||
|
||||
`clearlinux/tomcat` is a Docker image with `tomcat` running on top of the
|
||||
[official clearlinux base image](https://hub.docker.com/_/clearlinux).
|
||||
|
||||
<!-- application introduction -->
|
||||
> [Tomcat](http://tomcat.apache.org/) is an open source implementation of the Java Servlet,
|
||||
> JavaServer Pages, Java Expression Language and Java WebSocket technologies.
|
||||
|
||||
For other Clear Linux* OS
|
||||
based container images, see: https://hub.docker.com/u/clearlinux
|
||||
|
||||
## Why use a clearlinux based image?
|
||||
|
||||
<!-- CL introduction -->
|
||||
> [Clear Linux* OS](https://clearlinux.org/) is an open source, rolling release
|
||||
> Linux distribution optimized for performance and security, from the Cloud to
|
||||
> the Edge, designed for customization, and manageability.
|
||||
|
||||
Clear Linux* OS based container images use:
|
||||
* Optimized libraries that are compiled with latest compiler versions and
|
||||
flags.
|
||||
* Software packages that follow upstream source closely and update frequently.
|
||||
* An aggressive security model and best practices for CVE patching.
|
||||
* A multi-staged build approach to keep a reduced container image size.
|
||||
* The same container syntax as the official images to make getting started
|
||||
easy.
|
||||
|
||||
To learn more about Clear Linux* OS, visit: https://clearlinux.org.
|
||||
|
||||
<!-- Required -->
|
||||
## Deployment:
|
||||
|
||||
### Deploy with Docker
|
||||
The easiest way to get started with this image is by simply pulling it from
|
||||
Docker Hub.
|
||||
|
||||
*Note: This container uses the same syntax as the [official tomcat image](https://hub.docker.com/_/tomcat).
|
||||
|
||||
|
||||
1. Pull the image from Docker Hub:
|
||||
```
|
||||
docker pull clearlinux/tomcat
|
||||
```
|
||||
|
||||
2. Start a container using the examples below:
|
||||
|
||||
```
|
||||
docker run --rm -it --hostname my-tomcat --name some-tomcat -p 8080:8080 clearlinux/tomcat
|
||||
```
|
||||
|
||||
|
||||
<!-- Optional -->
|
||||
### Deploy with Kubernetes
|
||||
|
||||
This image can also be deployed on a Kubernetes cluster, such as [minikube](https://kubernetes.io/docs/setup/learning-environment/minikube/).The following example YAML files are provided in the repository as reference for Kubernetes deployment:
|
||||
|
||||
- [`tomcat-deployment.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/tomcat/tomcat-deployment.yaml): example using default configuration to create a basic tomcat service.
|
||||
|
||||
- [`tomcat-deployment-index-custom.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/tomcat/tomcat-deployment-index-custom.yaml): example using your own custom index html to create a tomcat service.
|
||||
|
||||
- [`tomcat-deployment-conf-custom.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/tomcat/tomcat-deployment-conf-custom.yaml): example using your own custom configuration to create a tomcat service.
|
||||
|
||||
|
||||
|
||||
Steps to deploy tomcat on a Kubernetes cluster:
|
||||
|
||||
1. If you want to deploy `tomcat-deployment.yaml`
|
||||
|
||||
```
|
||||
kubectl create -f tomcat-deployment.yaml
|
||||
```
|
||||
|
||||
Or if you want to deploy `tomcat-deployment-index-custom.yaml`
|
||||
|
||||
```
|
||||
kubectl create -f tomcat-deployment-index-custom.yaml
|
||||
```
|
||||
|
||||
Or if you want to deploy `tomcat-deployment-conf-custom.yaml`
|
||||
|
||||
```
|
||||
kubectl create -f tomcat-deployment-conf-custom.yaml
|
||||
```
|
||||
|
||||
2. Navigate to [http://\<nodeIP\>:30001](http://\<nodeIP\>:30001) in your browser, where 30001 is the port number defined in your service.
|
||||
|
||||
|
||||
|
||||
<!-- Required -->
|
||||
## Build and modify:
|
||||
|
||||
The Dockerfiles for all Clear Linux* OS based container images are available at
|
||||
https://github.com/clearlinux/dockerfiles. These can be used to build and
|
||||
modify the container images.
|
||||
|
||||
1. Clone the clearlinux/dockerfiles repository.
|
||||
```
|
||||
git clone https://github.com/clearlinux/dockerfiles.git
|
||||
```
|
||||
|
||||
2. Change to the directory of the application:
|
||||
```
|
||||
cd tomcat/
|
||||
```
|
||||
|
||||
3. Build the container image:
|
||||
```
|
||||
docker build -t clearlinux/tomcat .
|
||||
```
|
||||
|
||||
Refer to the Docker documentation for [default build arguments](https://docs.docker.com/engine/reference/builder/#arg).
|
||||
Additionally:
|
||||
|
||||
- `swupd_args` - specifies arguments to pass to the Clear Linux* OS software
|
||||
manager. See the [swupd man pages](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options)
|
||||
for more information.
|
||||
|
||||
<!-- Required -->
|
||||
## Licenses
|
||||
|
||||
All licenses for the Clear Linux* Project and distributed software can be found
|
||||
at https://clearlinux.org/terms-and-policies
|
||||
@@ -1,83 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: tomcat-conf
|
||||
data:
|
||||
server.xml: |
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Server port="8005" shutdown="SHUTDOWN">
|
||||
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
|
||||
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
|
||||
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
|
||||
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
|
||||
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
|
||||
|
||||
<GlobalNamingResources>
|
||||
<Resource name="UserDatabase" auth="Container"
|
||||
type="org.apache.catalina.UserDatabase"
|
||||
description="User database that can be updated and saved"
|
||||
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
|
||||
pathname="conf/tomcat-users.xml" />
|
||||
</GlobalNamingResources>
|
||||
|
||||
<Service name="Catalina">
|
||||
<Connector port="8080" protocol="HTTP/1.1"
|
||||
connectionTimeout="20000"
|
||||
redirectPort="8443" />
|
||||
|
||||
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
|
||||
<Engine name="Catalina" defaultHost="localhost">
|
||||
<Realm className="org.apache.catalina.realm.LockOutRealm">
|
||||
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
|
||||
resourceName="UserDatabase"/>
|
||||
</Realm>
|
||||
<Host name="localhost" appBase="webapps"
|
||||
unpackWARs="true" autoDeploy="true">
|
||||
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
|
||||
prefix="localhost_access_log" suffix=".txt"
|
||||
pattern="%h %l %u %t "%r" %s %b" />
|
||||
</Host>
|
||||
</Engine>
|
||||
</Service>
|
||||
</Server>
|
||||
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-tomcat
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: my-tomcat
|
||||
spec:
|
||||
containers:
|
||||
- name: my-tomcat
|
||||
image: docker.io/clearlinux/tomcat
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
volumeMounts:
|
||||
- name: config-volume
|
||||
mountPath: /usr/share/apache-tomcat/conf/server.xml
|
||||
subPath: server.xml
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: tomcat-conf
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: my-tomcat
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
nodePort: 30001
|
||||
selector:
|
||||
app: my-tomcat
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: tomcat-conf
|
||||
data:
|
||||
index.jsp: |
|
||||
hello,tomcat!
|
||||
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-tomcat
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: my-tomcat
|
||||
spec:
|
||||
containers:
|
||||
- name: my-tomcat
|
||||
image: docker.io/clearlinux/tomcat
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
volumeMounts:
|
||||
- name: config-volume
|
||||
mountPath: /usr/share/apache-tomcat/webapps/ROOT/index.jsp
|
||||
subPath: index.jsp
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: tomcat-conf
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: my-tomcat
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
nodePort: 30001
|
||||
selector:
|
||||
app: my-tomcat
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-tomcat
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: my-tomcat
|
||||
spec:
|
||||
containers:
|
||||
- name: my-tomcat
|
||||
image: docker.io/clearlinux/tomcat
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: my-tomcat
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
nodePort: 30001
|
||||
selector:
|
||||
app: my-tomcat
|
||||
Reference in New Issue
Block a user