added package deployment

This commit is contained in:
franklin 2015-07-03 18:08:13 +02:00
parent fc0a837146
commit 365ae262fe
6 changed files with 82 additions and 10 deletions

4
.gitignore vendored
View File

@ -1,6 +1,6 @@
.*
*~
/bin/*
/bin/
/pkg/
/main
/*.sublime-*
!.git*

View File

@ -7,5 +7,7 @@ clean:
build:
make clean
go build -o bin/contentserver
package:
cli/package.sh
test:
go test -v github.com/foomo/contentserver/server/repo

21
Vagrantfile vendored Normal file
View File

@ -0,0 +1,21 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.network :private_network, ip: "192.168.33.99"
config.vm.network :forwarded_port, guest: 22, host: 2299
config.vbguest.no_remote = true
config.vbguest.auto_update = false
config.vm.define 'trusty' do |instance|
instance.vm.box = 'ubuntu/trusty64'
end
config.vm.define 'precise' do |instance|
instance.vm.box = 'ubuntu/precise64'
end
config.vm.synced_folder ".", "/vagrant"
end

54
cli/package.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
USER="foomo"
NAME="content-server"
URL="http://www.foomo.org"
DESCRIPTION="Serves content tree structures very quickly through a json socket api"
LICENSE="LGPL-3.0"
ARCH="amd64"
VERSION=`bin/content-server --version | sed 's/content-server //'`
PACKAGE=`pwd`/pkg
mkdir -p $PACKAGE
package()
{
OS=$1
ARCH=$2
TYPE=$3
TARGET=$4
# create build folder
BUILD=`pwd`/${NAME}-${VERSION}
mkdir -p $BUILD/usr/bin
cp bin/${NAME} $BUILD/usr/bin/.
# build binary
make clean
GOOS=$OS GOARCH=$ARCH go build -o $BUILD/usr/bin/${NAME} contentserver.go
# create package
fpm -s dir \
-t $TYPE \
--name $NAME \
--maintainer $USER \
--version $VERSION \
--license $LICENSE \
--description "${DESCRIPTION}" \
--architecture $ARCH \
--package pkg \
--url "${URL}" \
-C $BUILD \
.
# cleanup
rm -rf $BUILD
# push
package_cloud push $TARGET $PACKAGE/${NAME}_${VERSION}_${ARCH}.${TYPE}
}
package linux amd64 deb foomo/content-server/ubuntu/trusty
#package linux amd64 rpm

View File

@ -3,10 +3,11 @@ package main
import (
"flag"
"fmt"
"github.com/foomo/contentserver/server"
"github.com/foomo/contentserver/server/log"
"os"
"strings"
"github.com/foomo/contentserver/server"
"github.com/foomo/contentserver/server/log"
)
const (

6
doc.go
View File

@ -1,6 +0,0 @@
// contentserver project doc.go
/*
contentserver document
*/
package main