-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Aravinda Vishwanathapura <aravinda@kadalu.io>
- Loading branch information
1 parent
ac4b08e
commit 19bd6ed
Showing
10 changed files
with
186 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Run on every PR | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- 'docs/**' | ||
- 'extras/**' | ||
- '**.md' | ||
- '**.adoc' | ||
|
||
jobs: | ||
# TODO: Add unit test as well here | ||
tests: | ||
name: Gluster Metrics Exporter Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Crystal | ||
run: | | ||
curl -fsSL https://crystal-lang.org/install.sh | sudo bash | ||
- name: Format Check | ||
run: make fmt-check | ||
- name: Lint | ||
run: make lint | ||
- name: Install Binnacle | ||
run: | | ||
curl -L https://github.com/kadalu/binnacle/releases/latest/download/binnacle -o binnacle | ||
chmod +x ./binnacle | ||
sudo mv ./binnacle /usr/local/bin/binnacle | ||
binnacle --version | ||
- name: Build Storage node container | ||
run: | | ||
cd tests && ./build-container.sh | ||
- name: Setup Test environment | ||
run: binnacle -v tests/setup.t | ||
- name: Build and Install Gluster Metrics Exporter to nodes/containers | ||
run: binnacle -v tests/install.t | ||
- name: Run all Tests | ||
run: binnacle -v tests/all |
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
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,28 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update -yq && \ | ||
apt-get install -y --no-install-recommends python3 libtirpc3 init \ | ||
vim python3-pip ssh rsync lvm2 less emacs software-properties-common \ | ||
sudo curl wget git build-essential automake autoconf automake libtool \ | ||
flex bison libssl-dev pkg-config uuid-dev acl-dev zlib1g-dev \ | ||
libxml2-dev libxml2-utils liburcu-dev xfsprogs gdb attr \ | ||
libgoogle-perftools-dev zfsutils-linux screen libsqlite3-dev sqlite3 \ | ||
glusterfs-server | ||
|
||
RUN echo "root:kadalu" | chpasswd | ||
|
||
RUN sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config \ | ||
&& sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' \ | ||
/etc/ssh/sshd_config && \ | ||
sed -i.save -e "s#udev_sync = 1#udev_sync = 0#" \ | ||
-e "s#udev_rules = 1#udev_rules = 0#" \ | ||
-e "s#use_lvmetad = 1#use_lvmetad = 0#" \ | ||
-e "s#obtain_device_list_from_udev = 1#obtain_device_list_from_udev = 0#" \ | ||
/etc/lvm/lvm.conf && \ | ||
systemctl mask getty.target | ||
|
||
RUN curl -fsSL https://crystal-lang.org/install.sh | sudo bash | ||
|
||
cmd ["/usr/sbin/init"] |
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,30 @@ | ||
# -*- mode: ruby -*- | ||
load "#{File.dirname(__FILE__)}/../reset.t" | ||
|
||
USE_REMOTE_PLUGIN "docker" | ||
|
||
nodes = ["gserver1", "gserver2", "gserver3"] | ||
|
||
nodes.each do |node| | ||
USE_NODE node | ||
|
||
TEST "systemctl start glusterd" | ||
puts TEST "systemctl status glusterd" | ||
TEST "systemctl start gluster-metrics-exporter" | ||
puts TEST "systemctl status gluster-metrics-exporter" | ||
|
||
TEST "mkdir -p /exports/vol1" | ||
end | ||
|
||
USE_NODE nodes[0] | ||
TEST "gluster peer probe #{nodes[1]}" | ||
TEST "gluster peer probe #{nodes[2]}" | ||
TEST "gluster volume create vol1 replica 3 #{nodes[0]}:/exports/vol1/s1 #{nodes[1]}:/exports/vol1/s2 #{nodes[2]}:/exports/vol1/s3 force" | ||
TEST "gluster volume start vol1" | ||
puts TEST "curl http://localhost:9713/metrics" | ||
puts TEST "curl http://localhost:9713/metrics.json" | ||
|
||
nodes.each do |node| | ||
USE_NODE node | ||
puts TEST "cat /var/log/gluster-metrics-exporter/exporter.log" | ||
end |
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,2 @@ | ||
#!/bin/sh | ||
docker build . --tag kadalu/gluster-node -f Dockerfile |
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,18 @@ | ||
# -*- mode: ruby -*- | ||
|
||
USE_REMOTE_PLUGIN "docker" | ||
nodes = ["gserver1", "gserver2", "gserver3"] | ||
|
||
# Static build Kadalu Storage Manager | ||
TEST "docker run --rm -i -v $PWD:/workspace -w /workspace crystallang/crystal:1.2.0-alpine /bin/sh -c \"apk add --update --no-cache --force-overwrite sqlite-dev sqlite-static && shards install && shards build --static\"" | ||
|
||
# Install the Static binary to all containers/nodes | ||
# and copy the service files | ||
nodes.each do |node| | ||
TEST "docker cp ./bin/gluster-metrics-exporter #{node}:/usr/sbin/gluster-metrics-exporter" | ||
TEST "docker cp extra/gluster-metrics-exporter.service #{node}:/lib/systemd/system/" | ||
end | ||
|
||
# Sanity test | ||
USE_NODE nodes[0] | ||
puts TEST "gluster-metrics-exporter --version" |
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,15 @@ | ||
# -*- mode: ruby -*- | ||
|
||
USE_REMOTE_PLUGIN "docker" | ||
nodes = ["gserver1", "gserver2", "gserver3"] | ||
|
||
nodes.each do |node| | ||
USE_NODE node | ||
RUN "systemctl stop glusterd" | ||
RUN "systemctl disable glusterd" | ||
RUN "systemctl stop gluster-metrics-exporter" | ||
RUN "systemctl disable gluster-metrics-exporter" | ||
RUN "rm -rf /var/lib/glusterd" | ||
RUN "rm -rf /var/log/gluster" | ||
RUN "rm -rf /var/log/gluster-metrics-exporter" | ||
end |
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,19 @@ | ||
# -*- mode: ruby -*- | ||
USE_REMOTE_PLUGIN "docker" | ||
nodes = ["gserver1", "gserver2", "gserver3"] | ||
|
||
# Start three or N storage nodes(Containers) | ||
USE_NODE "local" | ||
nodes.each do |node| | ||
USE_NODE "local" | ||
RUN "docker stop #{node}" | ||
RUN "docker rm #{node}" | ||
end | ||
|
||
RUN "docker network rm g1" | ||
TEST "docker network create g1" | ||
|
||
nodes.each do |node| | ||
USE_NODE "local" | ||
TEST "docker run -d -v /sys/fs/cgroup/:/sys/fs/cgroup:ro --privileged --name #{node} --hostname #{node} --network g1 kadalu/gluster-node" | ||
end |