From: Waldemar Kozaczuk <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
Branch: master

apps: add SeaweedFS example

Signed-off-by: Waldemar Kozaczuk <[email protected]>

---
diff --git a/seaweedfs/.gitignore b/seaweedfs/.gitignore
--- a/seaweedfs/.gitignore
+++ b/seaweedfs/.gitignore
@@ -0,0 +1 @@
+usr.manifest
diff --git a/seaweedfs/GET b/seaweedfs/GET
--- a/seaweedfs/GET
+++ b/seaweedfs/GET
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+set -e
+
+VERSION=2.96
+
+rm -rf upstream
+
+mkdir upstream
+cd upstream
+git clone -b $VERSION --depth 1 https://github.com/chrislusf/seaweedfs.git
diff --git a/seaweedfs/Makefile b/seaweedfs/Makefile
--- a/seaweedfs/Makefile
+++ b/seaweedfs/Makefile
@@ -0,0 +1,17 @@
+.PHONY: module
+module: upstream/seaweedfs/weed/weed
+       echo '/weed: $${MODULE_DIR}/upstream/seaweedfs/weed/weed' > usr.manifest
+
+go_version=$(shell go version | grep -o 1.[0-9][0-9])
+go_version_new_enough=$(shell echo "$(go_version) >= 1.18" | bc)
+
+ifneq (1,$(go_version_new_enough))
+  $(error "Golang version needs to be at least 1.18")
+endif
+
+upstream/seaweedfs/weed/weed:
+       ./GET
+       cd upstream/seaweedfs/weed && go build -buildmode=pie -ldflags 
"-linkmode external"
+
+clean:
+       rm -rf ./upstream usr.manifest
diff --git a/seaweedfs/README.md b/seaweedfs/README.md
--- a/seaweedfs/README.md
+++ b/seaweedfs/README.md
@@ -0,0 +1,14 @@
+This is a example of [SeaweedFS](https://github.com/chrislusf/seaweedfs) 
golang app running on OSv.
+
+Here are the examples on how to build and run it:
+* master
+```
+./scripts/build image=seaweedfs
+./scripts/run.py --forward 'tcp::9333-:9333'
+```
+
+* server
+```
+./scripts/build image=seaweedfs.server
+./scripts/run.py --forward 'tcp::9333-:9333'
+```
diff --git a/seaweedfs/module.py b/seaweedfs/module.py
--- a/seaweedfs/module.py
+++ b/seaweedfs/module.py
@@ -0,0 +1,5 @@
+from osv.modules import api
+
+default = api.run(cmdline="/weed master -port 9333")
+server = api.run(cmdline="/weed server -dir=/tmp -volume.max=5")
+volume = api.run(cmdline="/weed volume -dir=/tmp")

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/00000000000046dc5505df8c515d%40google.com.

Reply via email to