Centos 7 with IRC agent

by wangkangluo5
44 deployments · 44 still active · last rev. 7 months ago

docker template

Compatible with: CentOS 7
						#!/bin/bash
HOST_IP_=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1  -d'/')
IRC_HOST_=irc.oftc.net
IRC_CHANNEL_=#roy-wang
IRC_NICK_=docker-$(echo $HOST_IP_ | sed -e "s/\./-/g")

yum -y update
yum install -y tmux telnet iftop irssi git fish

# add docker repo
docker_setup() {
tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF

yum install -y docker-engine
service docker start
}

#log setup
log_setup() {
  LOGFILE=~/install-`date +"%m%d%Y_%H%M"`.log
  mkdir -p `dirname ${LOGFILE}`

  # in order to redirect to the console and log we need a named pipe
  npipe=/tmp/$$.tmp
  trap "rm -f $npipe" EXIT
  mknod $npipe p
  tee <$npipe ${LOGFILE} &
  exec 1>&-
  exec 1>$npipe 2>&1
}

log_setup
docker_setup

docker login --username=wangkangluo1 --password=4rQCdtbRQ7cN --email=wangkangluo1@gmail.com
docker pull wangkangluo1/linode-irc-agent

docker run -d -t --name linode-irc-agent \
 -e IRC_HOST=$IRC_HOST_ \
 -e IRC_CHANNEL=$IRC_CHANNEL_ \
 -e IRC_NICK=$IRC_NICK_ \
 -e HOST_IP=$HOST_IP_ \
 wangkangluo1/linode-irc-agent