Skip to content

Instantly share code, notes, and snippets.

@chianingwang
Created August 30, 2018 17:20
Show Gist options
  • Save chianingwang/55a59f5a512dd55643ea565528053903 to your computer and use it in GitHub Desktop.
Save chianingwang/55a59f5a512dd55643ea565528053903 to your computer and use it in GitHub Desktop.
=== create swift-paco-gowf ===
# create swift-paco-gowf docker container
$ docker run -i -t -d --net=host --hostname="swift-paco-gowf-test" --name="swift-paco-gowf-test" -v /srv/node/sdb1:/srv/node/sdb1:rw registry.swiftstack.com/swift-paco-gowf:queens-ss
# double check swift
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test stat -v
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list
=== create c7_systemd_gowf ===
# create c7_systemd_gowf
$ docker run --privileged -ti -d -e container=docker -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /home/ubuntu/git/gowf:/tmp/gowf --net=host --hostname="c7_systemd_gowf-test" --name="c7_systemd_gowf-test" registry.swiftstack.com/c7-systemd-gowf:0.0.1
=== install gowf in c7_systemd_gowf ===
# jump into c7 test host
$ docker exec -it c7_systemd_gowf-test bash
$ cd ~
# double check mount vm host drive in /tmp/gowf
$ ls -larth /tmp/gowf
# go to GitHub readme
https://github.com/swiftstack/go-watch-folder
# run through installation
$ curl https://cloud.swiftstack.com/v1/AUTH_gowf/gowf/install-gowf.sh | bash
# run through installation ( enable the service )
=============================================================================
To enable the Swift Watch Folder to start automatically, you need to run:
systemctl enable gowf.service
To start Swift Watch Folder first, edit the configuration file in
/etc/gowf/gowf.conf to your liking and then run:
systemctl start gowf.service
=============================================================================
# before you enable / start gowf.service, check
$ gowf -h
# check gowf.conf
$ cd /tmp/gowf
# 1. cp gowf.conf
$ cp /tmp/gowf/gowf.conf /etc/gowf/gowf.conf
# 2. cp /tmp/gowf.service ; hack service to add `curl https://cloud.swiftstack.com/v1/AUTH_gowf/gowf/install-gowf.sh`
$ vi /tmp/gowf.service # add —dedup
$ cp /tmp/gowf.service /lib/systemd/system/
$ tail -f /var/log/gowf/gowf.log
=== demo gowf in c7_systemd_gowf ===
+++ normal file +++
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list
$ ls ../
$ cp ../cloudcat.jpg sync/
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list test_gowf_sync
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list test_gowf_sync_segments
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test stat -v test_gowf_sync cloudcat.jpg
$ cp ../cloudcat.jpg archive/
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list test_gowf_archive
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list test_gowf_archive_segments
+++ SLO +++
$ cp ../100MB archive/100MB.tmp
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list test_gowf_archive
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test stat -v test_gowf_archive 100MB.tmp
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list test_gowf_archive_segments
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test stat -v test_gowf_archive_segments
+++ Dedup +++
$ cp ../100MB deduper/100MB.tmp
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list test_gowf_deduper
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test stat -v test_gowf_deduper 100MB.tmp
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list test_gowf_deduper_segments
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test stat -v test_gowf_deduper_segments
+++ Showing Dedup in SLO +++
$ cp ../100MB archive/100MB-1.tmp
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list test_gowf_archive
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test stat -v test_gowf_archive_segments
+++ Showing Dedup in Deduper +++
$ cp ../100MB deduper/100MB-1.tmp
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list test_gowf_deduper
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test stat -v test_gowf_deduper_segments
+++ Showing Variable Chunking in Deduper +++
$ cp ../100MB ../100MB.new
$ vi ../100MB.new
$ cp ../100MB.new ./deduper/
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list test_gowf_deduper
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test stat -v test_gowf_deduper_segments
$ ls -larth sync/
$ ls -larth archive/
$ ls -larth deduper/
=== purge dedup 100MB.new ===
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test delete test_gowf_deduper 100MB.new
# $ curl https://cloud.swiftstack.com/v1/AUTH_gowf/gowf/download-gowf.sh | bash
$ curl https://cloud.swiftstack.com/v1/AUTH_gowfdev/gowf/download-gowfdev.sh | bash
$ ./gowf-linux-amd64-0.2.3-7-g1fbd0c4 --config /etc/gowf/gowf.conf --log-file /tmp/gowf/gowf-purgededup.log --log-level INFO --stats-folder /tmp/gowf/stat --purgededup
or
$ gowf --config /etc/gowf/gowf.conf --log-file /tmp/gowf/gowf-purgededup.log --log-level INFO --stats-folder /tmp/gowf/stat --purgededup
=== clean out gowf folder in c7_systemd_gowf local ===
$ rm -rf ./sync/*
$ rm -rf ./archive/*
$ rm -rf ./deduper/*
=== clean out c7_systemd_gowf-test docker container ===
$ docker rm c7_systemd_gowf-test -f
=== clean out swift in swift-paco-gowf ===
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test delete test_gowf_sync
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test delete test_gowf_sync_segments
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test delete test_gowf_archive
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test delete test_gowf_archive_segments
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test delete test_gowf_deduper
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test delete test_gowf_deduper_segments
$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test -K test list
=== clean out swift-paco-gowf-test container ===
$ docker rm swift-paco-gowf-test -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment