update initial directories for packaging
authorwansuyoo <wansu.yoo@samsung.com>
Thu, 7 Mar 2019 01:12:16 +0000 (10:12 +0900)
committerwansuyoo <wansu.yoo@samsung.com>
Thu, 7 Mar 2019 01:12:16 +0000 (10:12 +0900)
glide.lock [new file with mode: 0644]
glide.yaml [new file with mode: 0644]
packaging/edge-orchestration.manifest [new file with mode: 0644]
packaging/edge-orchestration.service [new file with mode: 0644]
packaging/edge-orchestration.spec [new file with mode: 0644]
src/main.go [new file with mode: 0644]

diff --git a/glide.lock b/glide.lock
new file mode 100644 (file)
index 0000000..bc59c77
--- /dev/null
@@ -0,0 +1,4 @@
+hash: 3441bf6ff6d443d7e65fcdfc4f1d1b67e506cee012ed3b4901bbe2aab9890aa9
+updated: 2019-03-06T14:51:53.467677333+09:00
+imports: []
+testImports: []
diff --git a/glide.yaml b/glide.yaml
new file mode 100644 (file)
index 0000000..6f3ee59
--- /dev/null
@@ -0,0 +1,2 @@
+package: .
+import: []
diff --git a/packaging/edge-orchestration.manifest b/packaging/edge-orchestration.manifest
new file mode 100644 (file)
index 0000000..81ace0c
--- /dev/null
@@ -0,0 +1,6 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
+
diff --git a/packaging/edge-orchestration.service b/packaging/edge-orchestration.service
new file mode 100644 (file)
index 0000000..b5288f5
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=edge orchestration
+After=connman.service
+
+[Service]
+SmackProcessLabel=System
+Type=simple
+ExecStart=/usr/bin/edge-orchestration
+Restart=always
+RestartSec=0
+
+[Install]
+WantedBy=multi-user.target
diff --git a/packaging/edge-orchestration.spec b/packaging/edge-orchestration.spec
new file mode 100644 (file)
index 0000000..cc23c93
--- /dev/null
@@ -0,0 +1,55 @@
+Name: edge-orchestration
+Version: 0.0.1
+Release: 0
+License: Apache-2.0
+Summary: edge orchestration
+
+ExclusiveArch: armv7l
+Source0: %{name}-%{version}.tar.gz
+Source1: %{name}.manifest
+Source2: %{name}.service
+
+Requires(post): /sbin/ldconfig, /usr/bin/systemctl
+Requires(postun): /sbin/ldconfig, /usr/bin/systemctl
+
+BuildRequires: go
+
+%description
+Technologies for Device/Service management.
+Edge service deployment/monitoring and data sharing in home environment with limited available H/W resources.
+
+%prep
+%setup -q
+
+chmod g-w %_sourcedir/*
+cp %{SOURCE1} ./%{name}.manifest
+cp %{SOURCE2} ./%{name}.services
+
+%build
+ORG_VENDOR_DIR='vendor'
+CUR_VENDOR_DIR='vendor/src'
+mkdir -p ${CUR_VENDOR_DIR}
+ln -s %{_builddir}/%{name}-%{version}/${ORG_VENDOR_DIR} %{_builddir}/%{name}-%{version}/${CUR_VENDOR_DIR}
+
+cd src
+export GOARCH=arm GOARM=7
+export GOROOT=/usr/local/go
+export PATH=$PATH:/usr/local/go/bin/linux_arm
+export GOPATH=%{_builddir}/%{name}-%{version}:%{_builddir}/%{name}-%{version}/vendor
+go build -a -v -ldflags '-extldflags "-static"' -o ../bin/%{name}
+cd ..
+
+%install
+rm -rf %{buildroot}
+install -d $RPM_BUILD_ROOT%{_bindir}
+install -p -m 755 ./bin/%{name} $RPM_BUILD_ROOT%{_bindir}/%{name}
+mkdir -p %{buildroot}/usr/lib/systemd/system/multi-user.target.wants
+install -m 0644 %SOURCE2 %{buildroot}/usr/lib/systemd/system/%{name}.service
+ln -s ../%{name}.service %{buildroot}/usr/lib/systemd/system/multi-user.target.wants/
+
+%files
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_bindir}/%{name}
+%{_unitdir}/%{name}.service
+%{_unitdir}/multi-user.target.wants/%{name}.service
diff --git a/src/main.go b/src/main.go
new file mode 100644 (file)
index 0000000..dabcaf8
--- /dev/null
@@ -0,0 +1,18 @@
+package main
+
+import (
+       "fmt"
+       "net/http"
+)
+
+func main() {
+       http.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) {
+               fmt.Fprintf(w, "Welcome to my website!")
+       })
+
+       fs := http.FileServer(http.Dir("static/"))
+       http.Handle("/static/", http.StripPrefix("/static/", fs))
+
+       http.ListenAndServe(":9090", nil)
+}
+