Skip to content

Commit dbc2ac3

Browse files
committed
Merge branch 'master' of gitlab.ricebook.net:platform/core
2 parents 836c776 + 358d863 commit dbc2ac3

File tree

5 files changed

+67
-56
lines changed

5 files changed

+67
-56
lines changed

.gitlab-ci.yml

+6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ stages:
77
- rpm
88
test:
99
stage: test
10+
only:
11+
- master
1012
script:
1113
- "make test"
1214
build:
1315
stage: build
16+
only:
17+
- master
1418
script:
1519
- make build
1620
artifacts:
@@ -19,6 +23,8 @@ build:
1923
expire_in: 1 week
2024
rpm:
2125
stage: rpm
26+
only:
27+
- master
2228
script:
2329
- "./make-rpm"
2430
dependencies:

Makefile

+14-13
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,20 @@ python:
1515
cd ./rpc/gen/; python -m grpc.tools.protoc -I. --python_out=. --grpc_python_out=. core.proto; mv core_pb2.py ../../devtools/
1616

1717
deps:
18-
go get github.com/docker/docker
19-
go get github.com/docker/engine-api
20-
go get github.com/docker/go-units
21-
go get github.com/docker/go-connections
22-
go get github.com/coreos/etcd
23-
go get github.com/Sirupsen/logrus
24-
go get github.com/stretchr/testify
25-
go get github.com/golang/protobuf/proto
26-
go get github.com/codegangsta/cli
27-
go get gopkg.in/yaml.v2
28-
go get gopkg.in/libgit2/git2go.v23
29-
go get golang.org/x/net/context
30-
go get google.golang.org/grpc
18+
go get github.com/docker/engine-api || echo "oops"
19+
go get github.com/docker/go-units || echo "oops"
20+
go get github.com/docker/go-connections || echo "oops"
21+
go get github.com/docker/distribution || echo "oops"
22+
go get github.com/Sirupsen/logrus || echo "oops"
23+
go get github.com/stretchr/testify || echo "oops"
24+
go get github.com/golang/protobuf/{proto,protoc-gen-go} || echo "oops"
25+
go get github.com/codegangsta/cli || echo "oops"
26+
go get gopkg.in/yaml.v2 || echo "oops"
27+
go get gopkg.in/libgit2/git2go.v23 || echo "oops"
28+
go get golang.org/x/net/context || echo "oops"
29+
go get google.golang.org/grpc || echo "oops"
30+
go get github.com/coreos/etcd || echo "oops"
31+
go get github.com/docker/docker || echo "oops"
3132

3233
build:
3334
go build -ldflags "$(GO_LDFLAGS)" -a -tags netgo -installsuffix netgo -o eru-core

README.md

+17-36
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,31 @@ Core
55
We use v0.23.4 because v0.24 sucks
66

77
```shell
8-
$ wget https://github.com/libgit2/libgit2/archive/v0.23.4.zip
9-
$ unzip v0.23.4.zip
8+
cp devtools/libgit2.rb.patch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
9+
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
10+
git apply libgit2.rb.patch && git add libgit2.rb && git commit -m "patch libgit2 version for eru-core" && rm libgit2.rb.patch
11+
cd -
1012
```
11-
Install dependencies: `libssh2`, `http-parser`, `cmake`, `libcurl`.
1213

13-
```shell
14-
On Mac OSX:
15-
$ brew install libssh2 http-parser cmake libcurl
16-
17-
On CentOS:
18-
$ yum install libssh2-devel http-parser cmake libcurl-devel
19-
```
20-
Then install libgit2.
21-
22-
```shell
23-
$ cmake . -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DUSE_SSH=YES
24-
$ make && make install
25-
```
26-
Note on Mac OSX may need to set CFLAGS="-std=c99".
27-
Now libgit2 is installed under `/usr/local/lib` as default. We still need to set pkg-config and link dynamic libraries.
14+
## setup dev environment
2815

2916
```shell
30-
On Mac OSX:
31-
$ cd /usr/local/lib/pkgconfig
32-
$ ln -s /path/to/libgit2/pkgconfig/libgit2.pc libgit2.pc
33-
$ cd /usr/local/lib
34-
$ ln -s /path/to/libgit2/libgit2.23.dylib libgit2.23.dylib
35-
36-
On CentOS:
37-
$ cd /usr/lib64/pkgconfig/
38-
$ ln -s /usr/local/lib/pkgconfig/libgit2.pc libgit2.pc
39-
$ cd /usr/lib64
40-
$ ln -s /usr/local/lib/libgit2.so.23 libgit2.so.23
17+
git config --global url."git@gitlab.ricebook.net:".insteadOf "https://gitlab.ricebook.net/"
18+
go get gitlab.ricebook.net/platform/core.git
19+
mv $GOPATH/src/gitlab.ricebook.net/platform/core.git $GOPATH/src/gitlab.ricebook.net/platform/core
20+
cd $GOPATH/src/gitlab.ricebook.net/platform/core
21+
make deps
22+
make build
4123
```
4224

43-
## setup dev environment
25+
## Upgrade core on test/production server
4426

4527
```shell
46-
$ git config --global url."git@gitlab.ricebook.net:".insteadOf "https://gitlab.ricebook.net/"
47-
$ go get gitlab.ricebook.net/platform/core.git
48-
$ mv $GOPATH/src/gitlab.ricebook.net/platform/core.git $GOPATH/src/gitlab.ricebook.net/platform/core
49-
$ cd $GOPATH/src/gitlab.ricebook.net/platform/core && go install
50-
$ ln -s $GOPATH/src/gitlab.ricebook.net/platform/core $MY_WORK_SPACE/eru-core2
51-
$ make deps
28+
make build
29+
# test server
30+
devtools/upgrade-eru-core.sh test eru-core
31+
# prod server
32+
devtools/upgrade-eru-core.sh
5233
```
5334

5435
### GRPC

devtools/libgit2.rb.patch

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/Formula/libgit2.rb b/Formula/libgit2.rb
2+
index b91f4ff..45205f1 100644
3+
--- a/Formula/libgit2.rb
4+
+++ b/Formula/libgit2.rb
5+
@@ -1,8 +1,8 @@
6+
class Libgit2 < Formula
7+
desc "C library of Git core methods that is re-entrant and linkable"
8+
homepage "https://libgit2.github.com/"
9+
- url "https://github.com/libgit2/libgit2/archive/v0.24.2.tar.gz"
10+
- sha256 "00f0a7403143fba69601accc80cacf49becc568b890ba232f300c1b2a37475e6"
11+
+ url "https://github.com/libgit2/libgit2/archive/v0.23.4.tar.gz"
12+
+ sha256 "c7f5e2d7381dbc4d7e878013d14f9993ae8a41bd23f032718e39ffba57894029"
13+
head "https://github.com/libgit2/libgit2.git"
14+
15+
bottle do

devtools/upgrade-eru-core.sh

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

3-
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo yum --enablerepo=ricebook clean metadata'
4-
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo yum reinstall -y eru-core'
5-
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo systemctl daemon-reload'
6-
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo systemctl restart eru-core.service'
7-
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo git --work-tree=/opt/citadel --git-dir=/opt/citadel/.git pull'
8-
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo systemctl restart citadel'
3+
if [ $1 == "test" ]; then
4+
rsync -a /Users/timfeirg/gocode/src/gitlab.ricebook.net/platform/core sa-ricebook:~
5+
ssh sa-ricebook -t 'sudo rm -rf /root/.go/src/gitlab.ricebook.net/platform/core'
6+
ssh sa-ricebook -t 'sudo mv ~/core /root/.go/src/gitlab.ricebook.net/platform/core'
7+
# ssh zzz1 -t 'sudo mv eru-core /usr/bin/eru-core'
8+
# ssh zzz1 -t 'sudo systemctl restart eru-core.service'
9+
else
10+
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo yum --enablerepo=ricebook clean metadata'
11+
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo yum reinstall -y eru-core'
12+
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo systemctl daemon-reload'
13+
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo systemctl restart eru-core.service'
14+
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo git --work-tree=/opt/citadel --git-dir=/opt/citadel/.git pull'
15+
ssh liuyifu@c2-eru-1.ricebook.link -t 'sudo systemctl restart citadel'
16+
fi

0 commit comments

Comments
 (0)