forked from doujiang24/lua-resty-kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
96 lines (87 loc) · 5.75 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
sudo: required
dist: xenial
os: linux
language: c
addons:
apt:
packages:
- libtest-base-perl
- libtext-diff-perl
- libipc-run3-perl
- liburi-perl
- libwww-perl
- libtest-longstring-perl
- liblist-moreutils-perl
- libgd-dev
cache:
directories:
- download-cache
env:
global:
-JOBS=3
-KAFKA_VER=2.4.0
-SCALA_VER=2.11
-OPENRESTY_VER=1.15.8.2
install:
- git clone https://github.com/openresty/test-nginx.git ../test-nginx
- if [ ! -f download-cache/kafka_$SCALA_VER-$KAFKA_VER.tgz ]; then wget -P download-cache https://archive.apache.org/dist/kafka/$KAFKA_VER/kafka_$SCALA_VER-$KAFKA_VER.tgz;fi
- if [ ! -f download-cache/openresty-$OPENRESTY_VER.tar.gz ]; then wget -P download-cache https://openresty.org/download/openresty-$OPENRESTY_VER.tar.gz;fi
script:
- sudo tar -xzf download-cache/kafka_$SCALA_VER-$KAFKA_VER.tgz -C /usr/local/
- sudo mv /usr/local/kafka_$SCALA_VER-$KAFKA_VER /usr/local/kafka
- sudo sed -i '$aauthProvider\.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider' /usr/local/kafka/config/zookeeper.properties
- sudo sed -i '$azookeeper\.sasl\.client=true' /usr/local/kafka/config/zookeeper.properties
- sudo sed -i '$arequireClientAuthScheme=sasl' /usr/local/kafka/config/zookeeper.properties
- sudo sed -i '$ajaasLoginRenew=3600000' /usr/local/kafka/config/zookeeper.properties
- sudo touch /usr/local/kafka/config/zk_server_jass.conf
- echo -e '''Server {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="admin"
password="admin-secret"
user_admin="admin-secret";};''' | sudo tee /usr/local/kafka/config/zk_server_jass.conf
- sudo yes "" | keytool -genkeypair -keyalg RSA -dname "CN=127.0.0.1" -alias 127.0.0.1 -keystore selfsigned.jks -validity 365 -keysize 2048 -storepass changeit
- sudo mv selfsigned.jks /usr/local/selfsigned.jks; chmod 755 /usr/local/selfsigned.jks
- sudo sed -i '$ahost\.name=127.0.0.1' /usr/local/kafka/config/server.properties
- sudo sed -i '$alisteners=PLAINTEXT://127.0.0.1:9092,SSL://127.0.0.1:9093,SASL_PLAINTEXT://127.0.0.1:9094' /usr/local/kafka/config/server.properties
- sudo sed -i '$aadvertised\.listeners=PLAINTEXT://127.0.0.1:9092,SSL://127.0.0.1:9093,SASL_PLAINTEXT://127.0.0.1:9094' /usr/local/kafka/config/server.properties
- sudo sed -i '$assl\.keystore\.location = \/usr\/local\/selfsigned.jks' /usr/local/kafka/config/server.properties
- sudo sed -i '$assl\.keystore\.password = changeit' /usr/local/kafka/config/server.properties
- sudo sed -i '$assl\.key\.password = changeit' /usr/local/kafka/config/server.properties
- sudo sed -i '$assl\.key\.password = changeit' /usr/local/kafka/config/server.properties
- sudo sed -i '$asuper\.users=User:admin' /usr/local/kafka/config/server.properties
- sudo sed -i '$asuper\.users=User:admin' /usr/local/kafka/config/server.properties
- sudo sed -i '$asasl\.mechanism\.inter\.broker\.protocol=PLAIN' /usr/local/kafka/config/server.properties
- sudo sed -i '$asasl\.enabled\.mechanisms=PLAIN' /usr/local/kafka/config/server.properties
- sudo sed -i '$aallow\.everyone\.if\.no\.acl\.found=true' /usr/local/kafka/config/server.properties
- sudo sed -i '$aauthorizer\.class\.name=kafka.security.auth.SimpleAclAuthorizer' /usr/local/kafka/config/server.properties
- sudo sed -i '$aauto\.create\.topics\.enable=false' /usr/local/kafka/config/server.properties
- sudo cat /usr/local/kafka/config/server.properties
- sudo touch /usr/local/kafka/config/kafka_server_jass.conf
- echo -e ''' KafkaServer {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="admin"
password="admin-secret"
user_admin="admin-secret"; };
Client {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="admin"
password="admin-secret";}; ''' | sudo tee /usr/local/kafka/config/kafka_server_jass.conf
- sudo cat /usr/local/kafka/config/kafka_server_jass.conf
- sudo sed -i '$c\exec $base_dir/kafka-run-class.sh $EXTRA_ARGS -Djava.security.auth.login.config=/usr/local/kafka/config/zk_server_jass.conf org.apache.zookeeper.server.quorum.QuorumPeerMain "$@"' /usr/local/kafka/bin/zookeeper-server-start.sh
- sudo /usr/local/kafka/bin/zookeeper-server-start.sh -daemon /usr/local/kafka/config/zookeeper.properties
- sudo sed -i '$c\exec $base_dir/kafka-run-class.sh $EXTRA_ARGS -Djava.security.auth.login.config=/usr/local/kafka/config/kafka_server_jass.conf kafka.Kafka "$@"' /usr/local/kafka/bin/kafka-server-start.sh
- sudo /usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties
- sleep 5
- /usr/local/kafka/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 2 --topic test
- /usr/local/kafka/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 2 --topic test2
- /usr/local/kafka/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 2 --topic test3
- /usr/local/kafka/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 2 --topic test4
- /usr/local/kafka/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 2 --topic test5
- /usr/local/kafka/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 2 --topic test-consumer
- tar -xzf download-cache/openresty-$OPENRESTY_VER.tar.gz
- cd openresty-$OPENRESTY_VER
- ./configure --prefix=/usr/local/openresty-debug --with-debug > build.log 2>&1 || (cat build.log && exit 1)
- make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1)
- sudo make install > build.log 2>&1 || (cat build.log && exit 1)
- cd ..
- make test