提交 9248f417 编写于 作者: H Hongze Cheng

remove useless files

上级 13494f01
# Parent image
FROM ubuntu
# Set work directory
WORKDIR /app
# Copy executable file to work directory
COPY ./bin/tdengine .
# Copy configuration file to /etc/taos
COPY ./cfg/tdengine.cfg /etc/tdengine/
# Volume to communicate with host machine
# config file history file
VOLUME ["/etc/tdengine/", "/root"]
# Command to run
ENTRYPOINT ["/app/tdengine"]
# To build the image
# docker build -t taos_img -f Dockerfile.taos .
# To run the image
# docker run -it --rm \
# --mount type=bind,source=/etc/taos/,target=/etc/taos/ \
# --mount type=bind,source="$HOME",target=/root \
# taos_img -p
# Parent image
FROM ubuntu
# Install required libraries
RUN apt-get update && apt-get install -y libssl-dev
# Set work directory
WORKDIR /app
# COPY executable file to work directory
COPY ./bin/tdengined .
# Copy configuration file to /etc/taos
COPY ./cfg/tdengine.cfg /etc/tdengine/
# Volume to communicate with host machine
# data file log file config file
VOLUME ["/var/lib/tdengine/", "/var/log/tdengine/", "/etc/tdengine/"]
# Port to expose to outside of the world.
EXPOSE 6100 6120 6140 6160 6180 6200 6220 6240 6260 6280 6290 6300 8080
# Command to run
ENTRYPOINT ["/app/tdengined"]
# To build the image
# docker build -t mnode_img -f Dockerfile.mnode .
# To run mnode
# docker run --rm -it --name mnode \
# -p 6100:6100 -p 6120:6120 -p 6220:6220 -p 6260:6260 -p 6280:6280 \
# --mount source=taos_data,target=/var/lib/taos/ \
# --mount source=taos_log,target=/var/log/taos/ \
# --mount type=bind,source=/home/hzcheng/Documents/TAOS/taosdata/cfg/,target=/etc/taos/ \
# --network isolated_nw --ip 172.25.0.10 \
# mnode_img
#
# TAOS DATABASE Docker version
# Realse docker version install package
To release a docker version install package, change directory to
_taosdata/tools/docker_ and run:
```shell
bash release_docker.sh
```
Then it will generate a tar file in _release_ file.
# Install TAOS DATA
To install taosdata, uncompress the _tar_ file in release directory and
run _install.sh_
```shell
./install.sh # Install mnode and dnode
./install.sh all # Install mnode and dnode
./install.sh mnode # Install mnode
./install.sh dnode # Install dnode
```
# Check the services
To check if taosdata run correctly, use _docker_ commands.
```shell
docker container ls
```
version: '3.2'
services:
mnode:
# Build properties
build:
context: .
dockerfile: Dockerfile.mnode
image: mnode_img
# Deploy properties
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
ports:
- "6100:6100"
- "6120:6120"
- "6220:6220"
- "6260:6260"
- "6280:6280"
volumes:
- type: volume
source: taos_data
target: /var/lib/taos/
- type: volume
source: taos_log
target: /var/log/taos/
# And also configuration files.
network_mode: bridge
dnode:
# Build properties
build:
context: .
dockerfile: Dockerfile.dnode
image: dnode_img
# Deploy properties
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
ports:
- "6140:6140"
- "6160:6160"
- "6180:6180"
- "6200:6200"
- "6240:6240"
volumes:
- type: volume
source: taos_data
target: /var/lib/taos/
- type: volume
source: taos_log
target: /var/log/taos/
# And also configuration files.
network_mode: bridge
taos:
# Build properties
build:
context: .
dockerfile: Dockerfile.taos
image: taos_img
# Deploy properties
volumes:
taos_data:
taos_log:
# To build the images: docker-compose build
#!/bin/bash
# ********************************************************
# Script to install docker-version TAOSDATA on computer
# ********************************************************
set -e
# Global variables
tarFile="tdengine.tar.gz"
headerDir="/usr/local/include/tdengine"
cfgDir="/etc/tdengine"
binDir="/usr/local/bin/tdengine"
libDir="/usr/local/lib/tdengine"
linkDir="/usr/bin"
javaAppDir="connector"
# TODO: Function to install different parts.
make_directory() {
sudo mkdir -p ${cfgDir} ${headerDir} ${binDir} ${libDir} ${binDir}/connector
# Copy global configure file
sudo cp -n cfg/tdengine.cfg ${cfgDir}
}
installTDengine() {
# TODO: check if program is installed
make_directory
# Build tdengined image
sudo docker container rm -f tdengined_img || true
sudo docker image rm tdengined_img || true
sudo docker build -t tdengined_img -f Dockerfile.tdengined .
# Deploy the service
sudo docker run -d --name tdengined --network="host" \
--mount source=taos_data,target=/var/lib/tdengine/ \
--mount source=taos_log,target=/var/log/tdengine/ \
--mount type=bind,source=/etc/tdengine/,target=/etc/tdengine/ \
--restart=always \
tdengined_img
}
installOthers() {
# Update header file
sudo rm -f ${headerDir}/*.h && sudo cp inc/*.h ${headerDir}
# Update lib file
sudo rm -f /usr/lib/libtaos.so /usr/lib/libtaos.a
sudo rm -f ${libDir}/* && sudo cp lib/* ${libDir}
sudo ln -s ${libDir}/libtaos.so /usr/lib/libtaos.so
sudo ln -s ${libDir}/libtaos.a /usr/lib/libtaos.a
# Update JDBC
sudo rm -rf ${binDir}/connector/*
sudo cp JDBCDriver*-dist.* ${binDir}/connector 2> /dev/null || :
# TODO: Install taos
sudo rm -f ${linkDir}/taos ${binDir}/taos.sh
sudo docker image rm taos_img || true
sudo docker build --no-cache -t taos_img -f Dockerfile.tdengine .
sudo echo '#!/bin/bash' > taos.sh
sudo echo >> taos.sh
sudo echo 'docker run -it --rm --network="host" \' >> taos.sh
sudo echo '--mount type=bind,source=/etc/tdengine/,target=/etc/tdengine/ \' >> taos.sh
sudo echo '--mount type=bind,source="$HOME",target=/root \' >> taos.sh
sudo echo 'taos_img $@' >> taos.sh
sudo mv taos.sh ${binDir}
sudo chmod a+x ${binDir}/taos.sh
sudo ln -s ${binDir}/taos.sh ${linkDir}/taos
# Install remove.sh
sudo rm -f ${linkDir}/rmtaos ${binDir}/remove.sh
sudo cp bin/remove.sh ${binDir}
sudo chmod a+x ${binDir}/remove.sh
sudo ln -s ${binDir}/remove.sh ${linkDir}/rmtaos
}
printInstallGuide() {
echo
echo "Type 'bash install.sh' to install management and data service"
echo "Type 'bash install.sh dnode' to install data service only"
echo "Type 'bash install.sh mgmt' to install management service only"
}
# ----------------------- Main program -----------------------
tar -zxf ${tarFile}
installTDengine
installOthers
rm -rf $(tar -tf ${tarFile})
#!/bin/bash
# **************************************************************
# Script to release TAOS install package.
# **************************************************************
set -e
currDir=$(pwd)
codeDir=$(readlink -m ${currDir}/../..)
rootDir=$(readlink -m ${codeDir}/..)
buildDir=$(readlink -m ${rootDir}/build)
releaseDir=$(readlink -m ${rootDir}/release)
# # --------------------Get version information
versionInfo="${codeDir}/util/src/version.c"
version=$(cat ${versionInfo} | grep version | cut -d '"' -f2)
if [ "$1" != "test" ]; then
while true; do
read -p "Do you want to release a new version? [y/N]: " isVersionChange
if [[ ( "${isVersionChange}" == "y") || ( "${isVersionChange}" == "Y") ]]; then
# TODO: Add version format check here.
read -p "Please enter the new version: " version
break
elif [[ ( "${isVersionChange}" == "n") || ( "${isVersionChange}" == "N") ]]; then
echo "Use old version ${version}"
break
else
continue
fi
done
fi
buildTime=$(date +"%F %R")
echo "char version[64] = \"${version}\";" > ${versionInfo}
echo "char buildinfo[512] = \"Built by ${USER} at ${buildTime}\";" >> ${versionInfo}
# --------------------------Make executable file.
cd ${codeDir}
make clean
make
cd ${currDir}
# --------------------------Group files
# create compressed install file.
installDir="tdengine-docker-${version}-$(echo ${buildTime}| tr ': ' -)-${USER}"
# directories and files.
binDir="bin"
libDir="lib"
headerDir="inc"
cfgDir="cfg"
binFiles="${buildDir}/bin/tdengine ${buildDir}/bin/tdengined ${currDir}/remove.sh"
libFiles="${buildDir}/lib/libtaos.so ${buildDir}/lib/libtaos.a"
headerFiles="${codeDir}/inc/taos.h"
cfgFiles="${codeDir}/cfg/*"
dockerFiles="${currDir}/Dockerfile.tdengined ${currDir}/Dockerfile.tdengine"
installFiles="${currDir}/install.sh"
# make directories.
mkdir -p ${installDir}
mkdir -p ${installDir}/${binDir} && cp ${binFiles} ${installDir}/${binDir}
mkdir -p ${installDir}/${libDir} && cp ${libFiles} ${installDir}/${libDir}
mkdir -p ${installDir}/${headerDir} && cp ${headerFiles} ${installDir}/${headerDir}
mkdir -p ${installDir}/${cfgDir} && cp ${cfgFiles} ${installDir}/${cfgDir}
cp ${dockerFiles} ${installDir}
cp ${rootDir}/build/lib/JDBCDriver*-dist.* ${installDir} 2> /dev/null || :
cd ${installDir}
tar -zcf tdengine.tar.gz * --remove-files
cd ${currDir}
cp ${installFiles} ${installDir}
# Copy example code
cp -r ${codeDir}/examples ${installDir}
tar -zcf "${installDir}.tar.gz" ${installDir} --remove-files
mkdir -p ${releaseDir}
mv "${installDir}.tar.gz" ${releaseDir}
#!/bin/bash
# ********************************************************
# Script to uninstall docker-version TAOSDATA on computer
# ********************************************************
headerDir="/usr/local/include/tdengine"
cfgDir="/etc/tdengine"
binDir="/usr/local/bin/tdengine"
libDir="/usr/local/lib/tdengine"
linkDir="/usr/bin"
# 1. Stop continer and remove image
# TODO : Check information
sudo docker container stop tdengined || true
sudo docker container rm tdengined || true
sudo docker image rm tdengined_img || true
sudo docker image rm taos_img || true
# 2. Remove others
## remove binary files
sudo rm -rf {linkDir}/taos {linkDir}/rmtaos ${binDir}
## remove header files
sudo rm -rf ${headerDir}
## remove lib file
sudo rm -rf /usr/lib/libtaos* ${libDir}
## remove configuration file
sudo rm -rf ${cfgDir}
# 3. Remove data
while true; do
read -p "Do you want to delete data file? [y/N]: " isDeleteData
if [[ ( "${isDeleteData}" == "y") || ( "${isDeleteData}" == "Y") ]]; then
sudo docker volume rm -f taos_data taos_log
break
elif [[ ( "${isDeleteData}" == "n") || ( "${isDeleteData}" == "N") ]]; then
break
else
continue
fi
done
#!/bin/bash
# run dnode
docker run --rm -it --name dnode \
-p 6140:6140 -p 6160:6160 -p 6180:6180 -p 6200:6200 -p 6240:6240\
--mount source=taos_data,target=/var/lib/taos/ \
--mount source=taos_log,target=/var/log/taos/ \
--mount type=bind,source=/home/hzcheng/Documents/TAOS/taosdata/cfg/,target=/etc/taos/ \
--network isolated_nw --ip 172.25.0.11 \
dnode_img
#!/bin/bash
# run mnode
docker run --rm -it --name mnode \
-p 6100:6100 -p 6120:6120 -p 6220:6220 -p 6260:6260 -p 6280:6280 \
--mount source=taos_data,target=/var/lib/taos/ \
--mount source=taos_log,target=/var/log/taos/ \
--mount type=bind,source=/home/hzcheng/Documents/TAOS/taosdata/cfg/,target=/etc/taos/ \
--network isolated_nw --ip 172.25.0.10 \
mnode_img
#!/bin/bash
# run taos
docker run --rm -it --name taos \
--mount type=bind,source=/home/hzcheng/.taos_history,target=/root/.taos_history \
--mount type=bind,source=/home/hzcheng/Documents/TAOS/taosdata/cfg/,target=/etc/taos/ \
--network isolated_nw --ip 172.25.0.12 \
taos_img -p
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册