Skip to content

Commit

Permalink
Merge pull request #16 from indigo-dc/docker
Browse files Browse the repository at this point in the history
Add scripts to build docker
  • Loading branch information
bwegh authored Mar 3, 2017
2 parents 0ae471b + d1ee70b commit 167846d
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ vendor/
*.prof
*.deb
*.rpm
*.tgz
*.tar

# temporary emacs files
*#
Expand Down
38 changes: 33 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@ The Orchestrator Command Line Client
## Usage
orchent helps you as much as possible:
```
./orchent --help
usage: orchent --url=URL [<flags>] <command> [<args> ...]
$ orchent --help
usage: orchent [<flags>] <command> [<args> ...]
The orchestrator client. Please store your access token in the 'ORCHENT_TOKEN' environment variable: 'export ORCHENT_TOKEN=<your access token>'
The orchestrator client. Please store your access token in the 'ORCHENT_TOKEN'
environment variable: 'export ORCHENT_TOKEN=<your access token>'. If you need to
specify the file containing the trusted root CAs use the 'ORCHENT_CAFILE'
environment variable: 'export ORCHENT_CAFILE=<path to file containing trusted
CAs>'.
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
--help Show context-sensitive help (also try --help-long and
--help-man).
--version Show application version.
-u, --url=URL the base url of the orchestrator rest interface
-u, --url=URL the base url of the orchestrator rest interface. Alternative
the environment variable 'ORCHENT_URL' can be used: 'export
ORCHENT_URL=<the_url>'
Commands:
help [<command>...]
Expand Down Expand Up @@ -41,6 +48,8 @@ Commands:
resshow <deployment uuid> <resource uuid>
show a specific resource of a given deployment
```

Before using the orchestrator with orchent you need to export your IAM access token:
Expand Down Expand Up @@ -70,3 +79,22 @@ Deployment [eac4dabb-9613-4026-bac7-6075050308e3]:
template [http://orchestrator01-indigo.cloud.ba.infn.it:8080/orchestrator/deployments/eac4dabb-9613-4026-bac7-6075050308e3/template]
```
For more information and more examples please see the [documentation](https://indigo-dc.gitbooks.io/orchent/)


## using Docker
If your system is not supported you can still use orchent through a lightweight Docker container.
Download the container in the release section and import it using the `docker load` command:
```
docker load --input orchent_container_0.4.0.tar
```

After loading the container you can use it to run orchent:
```
docker run orchent:0.4.0 --version
docker run orchent:0.4.0 --help
```

For information on how to pass environment settings to the docker see
```
docker run --help
```
5 changes: 5 additions & 0 deletions utils/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM scratch
ADD orchent /
ADD ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
ENTRYPOINT ["/orchent"]
CMD ["--help"]
72 changes: 72 additions & 0 deletions utils/build_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash

GO=`which go`
REALPATH=`which realpath`
if [ "x$GO" == "x" ]; then
echo "go missing, please install go 1.5 or newer"
exit 1
fi

if [ "x$REALPATH" == "x" ]; then
echo "realpath missing, please install it"
exit 1
fi

PATH_TO_SCRIPT=`realpath ${0}`
PATH_TO_FOLDER=`dirname "$PATH_TO_SCRIPT"`
PATH_TO_REPO=`cd "${PATH_TO_FOLDER}/.." && pwd -P`

DOCKERFILE="$PATH_TO_FOLDER/Dockerfile"
ORCHENT="$PATH_TO_REPO/orchent"

cd $PATH_TO_REPO
echo " "
echo " building orchent ..."

VERSION=`go version`
GOPATH=`cd "${PATH_TO_FOLDER}/.." && pwd -P`

echo " cleaning ..."
pwd
rm orchent
rm orchent_container_*.tgz
echo " "
echo "running the build with '$VERSION', please include in issue reports"
echo " "
export "GOPATH=${GOPATH}"
echo "fetiching:"
echo -n " kingpin ... "
go get gopkg.in/alecthomas/kingpin.v2
echo "done"
echo -n " sling ... "
go get github.com/dghubble/sling
echo "done"
echo -n "building orchent ... "
CGO_ENABLED=0 GOOS=linux go build -a -v -o $ORCHENT ${GOPATH}/orchent.go
echo "done"

echo "building docker ... "
mkdir -p /tmp/orchent_docker/
cp $DOCKERFILE /tmp/orchent_docker/
cp $ORCHENT /tmp/orchent_docker/
cp /etc/ssl/certs/ca-certificates.crt /tmp/orchent_docker/
cd /tmp/orchent_docker/
ORCHENT_VERSION=`./orchent --version 2>&1`
ORCHENT_TAG="orchent:$ORCHENT_VERSION"
ORCHENT_DOCKER="$PATH_TO_REPO/orchent_container_${ORCHENT_VERSION}.tar"
docker image rm -f "$ORCHENT_TAG"
docker build -t "$ORCHENT_TAG" .
cd $PATH_TO_REPO
rm -rf /tmp/orchent_docker/
docker save --output "$ORCHENT_DOCKER" "$ORCHENT_TAG"
echo "done"

echo " "
echo " "
echo " checking image "
docker image rm -f "$ORCHENT_TAG"
docker images -a
docker load --input "$ORCHENT_DOCKER"
docker run --rm "$ORCHENT_TAG" --version
docker images -a
echo " done "
12 changes: 9 additions & 3 deletions utils/compile.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#!/bin/bash

GO=`which go`
PATH_TO_SCRIPT=`readlink -f ${0}`
PATH_TO_FOLDER=`dirname "$PATH_TO_SCRIPT"`

REALPATH=`which realpath`
if [ "x$GO" == "x" ]; then
echo "go missing, please install go 1.5 or newer"
exit 1
fi

if [ "x$REALPATH" == "x" ]; then
echo "realpath missing, please install it"
exit 1
fi

PATH_TO_SCRIPT=`realpath ${0}`
PATH_TO_FOLDER=`dirname "$PATH_TO_SCRIPT"`

VERSION=`go version`
GOPATH=`cd "${PATH_TO_FOLDER}/.." && pwd -P`
echo " "
Expand Down

0 comments on commit 167846d

Please sign in to comment.