Giter Club home page Giter Club logo

geard's Introduction

geard Build Status

geard is a command line client for installing Docker images as containers onto a systemd-enabled Linux operating system (systemd 207 or newer). It may be run as a command:

$ sudo gear install openshift/busybox-http-app my-sample-service

to install the public image openshift/busybox-http-app to systemd on the local machine with the service name "ctr-my-sample-service". The command can also start as a daemon and serve API requests over HTTP (default port 43273) :

$ sudo gear daemon
2014/02/21 02:59:42 ports: searching block 41, 4000-4099
2014/02/21 02:59:42 Starting HTTP on :43273 ...

The gear CLI can connect to this agent:

$ gear stop localhost/my-sample-service
$ gear install openshift/busybox-http-app localhost/my-sample-service.1 localhost/my-sample-service.2
$ gear start localhost/my-sample-service.1 localhost/my-sample-service.2

The geard agent exposes operations on containers needed for large scale orchestration in production environments, and tries to map those operations closely to the underlying concepts in Docker and systemd. It supports linking containers into logical groups (applications) across multiple hosts with iptables based local networking, shared environment files, and SSH access to containers. It is also a test bed for prototyping related container services that may eventually exist as Docker plugins, such as routing, event notification, and efficient idling and network activation.

The gear daemon and local commands must run as root to interface with the Docker daemon over its Unix socket and systemd over DBus.

What is a "gear", and why Docker?

In OpenShift Origin, a gear is a secure, isolated environment for user processes using cGroups and SELinux. As Linux namespace technology has evolved to provide other means of constraining processes, the term "container" has become prevalent, and is used interchangeably below. Docker has made the creation and distribution of container images effortless, and the ability to reproducibly run a Linux application in many environments is a key component for developers and administrators. At the same time, the systemd process manager has unified many important Linux process subsystems (logging, audit, managing and monitoring processes, and controlling cGroups) into a reliable and consistent whole.

What are the key requirements for production containers?

  • Containers are securely isolated from the host except through clear interfaces

    By default, a container should only see what the host allows - being able to become root within a container is extremely valuable for installing packaged software, but that is also a significant security concern. Both user namespaces and SELinux are key components to protecting the host from arbitrary code, and should be secure by default within Docker. However, as necessary administrators should be able to expose system services or other containers to a container. Other limits include network abstractions and quota restrictions on the files containers create.

  • Container processes should be independent and resilient to failure

    Processes fail, become corrupted, and die. Those failures should be isolated and recoverable - a key feature of systemd is its comprehensive ability to handle the wide variety of process death and restart, recover, limit, and track the involved processes. The failure of other components within the system should not block restarting or reinitializing other containers to the extent possible, especially in bulk.

  • Containers should be portable across hosts

    A Docker image should be reusable across hosts. This means that the underlying Docker abstractions (links, port mappings, environment files) should be used to ensure the gear does not become dependent on the host system except where necessary. The system should make it easy to share environment and context between gears and move or recreate them among host systems.

  • Containers must be auditable, constrained, and reliably logged

    Many of the most important characteristics of Linux security are difficult to enforce on arbitrary processes. systemd provides standard patterns for each of these and when properly integrated with Docker can give administrators in multi-tenant or restricted environments peace of mind.

Actions on a container

Here are the supported container actions on the agent - these should map cleanly to Docker, systemd, or a very simple combination of the two. Extensions are intended to simplify cross container actions (shared environment and links)

  • Create a new system unit file that runs a single docker image (install and start a container)

    $ gear install openshift/busybox-http-app localhost/my-sample-service --start -p 8080:0
    
    $ curl -X PUT "http://localhost:43273/container/my-sample-service" -H "Content-Type: application/json" -d '{"Image": "openshift/busybox-http-app", "Started":true, "Ports":[{"Internal":8080}]}'
    
  • Stop, start, and restart a container

    $ gear stop localhost/my-sample-service
    $ gear start localhost/my-sample-service
    $ gear restart localhost/my-sample-service
    
    $ curl -X PUT "http://localhost:43273/container/my-sample-service/stopped"
    $ curl -X PUT "http://localhost:43273/container/my-sample-service/started"
    $ curl -X POST "http://localhost:43273/container/my-sample-service/restart"
    
  • Deploy a set of containers on one or more systems, with links between them:

    # create a simple two container web app
    $ gear deploy deployment/fixtures/simple_deploy.json localhost
    

    Deploy creates links between the containers with iptables - use nsenter to join the container web-1 and try curling 127.0.0.1:8081 to connect to the second web container. These links are stable across hosts and can be changed without the container knowing.

    # create a mongo db replica set (some assembly required)
    $ gear deploy deployment/fixtures/mongo_deploy.json localhost
    $ sudo switchns --container=db-1 -- /bin/bash
    > mongo 192.168.1.1
    MongoDB shell version: 2.4.9
    > rs.initiate({_id: "replica0", version: 1, members:[{_id: 0, host:"192.168.1.1:27017"}]})
    > rs.add("192.168.1.2")
    > rs.add("192.168.1.3")
    > rs.status()
    # wait....
    > rs.status()
    

    Note: The argument to initiate() sets the correct hostname for the first member, otherwise the other members cannot connect.

  • View the systemd status of a container

    $ gear status localhost/my-sample-service
    $ curl "http://localhost:43273/container/my-sample-service/status"
    
  • Tail the logs for a container (will end after 30 seconds)

    $ curl -H "Accept: text/plain;stream=true" "http://localhost:43273/container/my-sample-service/log"
    
  • List all installed containers (for one or more servers)

    $ gear list-units localhost
    $ curl "http://localhost:43273/containers"
    
  • Perform housekeeping cleanup on the geard directories

    $ gear clean
    
  • Create a new empty Git repository

    $ curl -X PUT "http://localhost:43273/repository/my-sample-repo"
    
  • Link containers with local loopback ports (for e.g. 127.0.0.2:8081 -> 9.8.23.14:8080). If local ip isn't specified, it defaults to 127.0.0.1

    $ gear link -n=127.0.0.2:8081:9.8.23.14:8080 localhost/my-sample-service
    $ curl -X PUT -H "Content-Type: application/json" "http://localhost:43273/container/my-sample-service" -d '{"Image": "openshift/busybox-http-app", "Started":true, "Ports":[{"Internal":8080}], "NetworkLinks": [{"FromHost": "127.0.0.1","FromPort": 8081, "ToHost": "9.8.23.14","ToPort": 8080}]}'
    
  • Set a public key as enabling SSH or Git SSH access to a container or repository (respectively)

    $ gear add-keys --key-file=[FILE] my-sample-service
    $ curl -X POST "http://localhost:43273/keys" -H "Content-Type: application/json" -d '{"Keys": [{"Type":"authorized_keys","Value":"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ=="}], "Containers": [{"Id": "my-sample-service"}]}'
    
  • Enable SSH access to join a container for a set of authorized keys

    # Make sure that /etc/ssh/sshd_config has the following two lines.
    AuthorizedKeysCommand /usr/sbin/gear-auth-keys-command
    AuthorizedKeysCommandUser nobody
    
    # Restart sshd to pickup the changes.
    $ systemctl restart sshd.service
    
    # Install and start a container in isolate mode which is necessary for SSH.
    $ gear install openshift/busybox-http-app testapp1 --isolate --start
    
    # Add ssh keys.
    $ gear add-keys --key-file=/path/to/id_rsa.pub testapp1
    
    # ssh into the container.
    # Note: All of this works with a remote host as well.
    $ ssh ctr-testapp1@localhost
    2014/05/01 12:48:21 docker: execution driver native-0.1
    bash-4.2$ id
    uid=1019(container) gid=1019(container) groups=1019(container)
    bash-4.2$ ps -ef
    UID        PID  PPID  C STIME TTY          TIME CMD
    root         1     0  0 19:39 ?        00:00:00 su container -s /bin/bash -c /.container.cmd
    contain+    16     1  0 19:39 ?        00:00:00 /usr/bin/ruby-mri /usr/mock/mock_server.rb 0.0.0.0 /usr/mock  /source/
    contain+    22     0  0 19:48 ?        00:00:00 /bin/bash -l
    contain+    24    22  0 19:48 ?        00:00:00 ps -ef
    bash-4.2$
    
  • Build a new image using Source-to-Images (STI) from a source URL and base image

    # build an image on the local system and tag it as mybuild-1
    $ gear build git://github.com/pmorie/simple-html pmorie/fedora-mock mybuild-1
    
    # remote build
    $ curl -X POST "http://localhost:43273/build-image" -H "Content-Type: application/json" -d '{"BaseImage":"pmorie/fedora-mock","Source":"git://github.com/pmorie/simple-html","Tag":"mybuild-1"}'
    
  • Use Git repositories on the geard host

    # Create a repository on the host.
    # Note: We are using localhost for this example, however, it works for remote hosts as well.
    $ gear create-repo myrepo [<optional source url to clone>]
    
    # Add keys to grant access to the repository.
    # The write flag enables git push, otherwise only git clone i.e. read is allowed.
    $ gear add-keys --write=true --key-file=/path/to/id_rsa.pub repo://myrepo
    
    # Clone the repo.
    $ git clone git-myrepo@localhost:~ myrepo
    
    # Commit some changes locally.
    $ cd myrepo
    $ echo "Hello" > hi.txt
    $ git add hi.txt
    $ git commit -m "Add simple text file."
    
    # Push the changes to the repository on the host.
    $ git push origin master
    
  • Fetch a Git archive zip for a repository

    $ curl "http://localhost:43273/repository/my-sample-repo/archive/master"
    
  • Set and retrieve environment files for sharing between containers (patch and pull operations)

    $ gear set-env localhost/my-sample-service A=B B=C
    $ gear env localhost/my-sample-service
    $ curl "http://localhost:43273/environment/my-sample-service"
    $ gear set-env localhost/my-sample-service --reset
    

    You can set environment during installation

    $ gear install ccoleman/envtest localhost/env-test1 --env-file=deployment/fixtures/simple.env
    

    Loading environment into a running container is dependent on the "docker run --env-file" option in Docker master from 0.9.x after April 1st. You must start the daemon with "gear daemon --has-env-file" in order to use the option - this option will be made the default after 0.9.1 lands and the minimal requirements will be updated.

  • More to come....

geard allows an administrator to easily ensure a given Docker container will always run on the system by creating a systemd unit describing a docker run command. It will execute the Docker container processes as children of the systemd unit, allowing auto restart of the container, customization of additional namespace options, the capture stdout and stderr to journald, and audit/seccomp integration to those child processes. Note that foreground execution is currently not in Docker master - see https://github.com/alexlarsson/docker/tree/forking-run for some prototype work demonstrating the concept.

Each created systemd unit can be assigned a unique Unix user for quota and security purposes with the --isolate flag, which prototypes isolation prior to user namespaces being part of Docker. An SELinux MCS category label will automatically be assigned to the container to separate it from the other containers on the system, and containers can be set into systemd slices with resource constraints.

Try it out

The geard code depends on:

  • systemd 207 (Fedora 20 or newer)
  • Docker 0.7 or newer (0.9.x from Apr 1 to use --env-file, various other experimental features not in tree)

If you don't have those, you can use the following to run in a development vm:

  • Vagrant
  • VirtualBox

If you have Go installed locally (have a valid GOPATH env variable set), run:

go get github.com/openshift/geard
cd $GOPATH/src/github.com/openshift/geard
vagrant up

If you don't have Go installed locally, run the following steps:

git clone [email protected]:openshift/geard && cd geard
vagrant up

vagrant up will install a few RPMs the first time it is started. Once vagrant up is running, you can ssh into the vm:

vagrant ssh

The contrib/build script checks and downloads Go dependencies, builds the gear binary, and then installs it to /vagrant/bin/gear and /usr/bin/gear. It has a few flags - '-s' builds with SELinux support for SSH and Git.

contrib/build -s

Once you've built the executables, you can run:

sudo $GOPATH/bin/gear daemon

to start the gear agent. The agent will listen on port 43273 by default and print logs to the console - hit CTRL+C to stop the agent.

See contrib/example.sh and contrib/stress.sh for more examples of API calls.

An example systemd unit file for geard is included in the contrib/ directory. After building, the following commands will install the unit file and start the agent under systemd:

sudo systemctl enable $(pwd)/contrib/geard.service
sudo systemctl start geard.service

Report issues and contribute

Bugs are tracked by the Red Hat and OpenShift test teams in Bugzilla in the geard component, but you can always open a GitHub issue as well.

We are glad to accept pull requests for fixes, features, and experimentation. A rough map of the code structure is available here.

To submit a pull request, ensure your commit has a good description of the problem and contains a test case where possible for your function. We use Travis to perform builds and test pull requests - if your pull request fails Travis we'll try to help you get it fixed.

To run the test suite locally, from your development machine or VM, run:

$ contrib/test

to run just the unit tests. To run the full integration suite you should run:

$ contrib/build -g
$ contrib/test -a

which will build the current source, restart the gear daemon service under systemd, and then run both unit tests and integration tests. Be aware that at the current time a few of the integration tests fail occasionally due to race conditions - we hope to address that soon. Just retry! :)

How can geard be used in orchestration?

See the orchestrating geard doc

API Design

See the API design doc

Disk Structure

Description of storage on disk

geard Concepts

Outline of how some of the core operations work:

  • Linking - use iptable rules and environment variables to simplify container interconnect
  • SSH - generate authorized_keys for a user on demand
  • Isolated container - start an arbitrary image and force it to run as a given user on the host by chown the image prior to execution
  • Idling - use iptable rules to wake containers on SYN packets
  • Git - host Git repositories inside a running Docker container
  • Logs - stream journald log entries to clients
  • Builds - use transient systemd units to execute a build inside a container
  • Jobs - run one-off jobs as systemd transient units and extract their logs and output after completion

Not yet prototyped:

  • Integrated health check - mark containers as available once a pluggable/configurable health check passes
  • Joining - reconnect to an already running operation
  • Direct server to server image pulls - allow hosts to act as a distributed registry
  • Job callbacks - invoke a remote endpoint after an operation completes
  • Local routing - automatically distribute config for inbound and outbound proxying via HAProxy
  • Repair - cleanup and perform consistency checks on stored data (most operations assume some cleanup)
  • Capacity reporting - report capacity via API calls, allow precondition PUTs based on remaining capacity ("If-Match: capacity>=5"), allow capacity to be defined via config

Building Images

geard uses Source-to-Images (STI) to build deployable images from a base image and application source. STI supports a number of use cases for building deployable images, including:

  1. Use a git repository as a source
  2. Incremental builds: downloaded dependencies and generated artifacts are re-used across builds

A number of public STI base images exist:

  1. Ruby 1.9 on CentOS 6.x
  2. Wildfly 8 on CentOS 6.x
  3. WEBrick, a simple Ruby HTTP server, on latest Fedora

See the STI docs if you want to create your own STI base image.

License

Apache Software License (ASL) 2.0.

geard's People

Contributors

arborlab avatar balboah avatar bparees avatar brenton avatar danmcp avatar derekwaynecarr avatar devop-mmcgrath avatar fiadliel avatar goldmann avatar ironcladlou avatar jcantrill avatar jhadvig avatar jwforres avatar jwhonce avatar kraman avatar matthicksj avatar mfojtik avatar mmahut avatar mrunalp avatar ncdc avatar nhr avatar paulczar avatar pmorie avatar scollier avatar smarterclayton avatar stefanschneider avatar stefwalter avatar vnugent avatar vojtechvitek avatar wallrj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geard's Issues

Make it possible to override CMD

It would be valuable if we could override at register time the command that would be run when starting a geard managed container. This would let run an image for example with different options (for example configuration files).

This would be usable for EAP image to let choose between the operating modes (standalone vs. domain).

Allow NetworkLinks of existing containers to be altered via the REST API

It would be useful to be able to reconfigure the NetworkLinks of existing units using the REST API.

See http://lists.openshift.redhat.com/openshift-archives/users/2014-June/msg00058.html for the original discussion on the mailing list:

On 30 June 2014 16:24, Clayton Coleman <...> wrote:

----- Original Message -----

I'm trying to create a unit with a link from a port on localhost in
the container to a port on localhost of the host machine.

The reason I want to do that is so that I can add a NAT rule on the
host machine which routes the connection to another host (if
necessary) without having to restart the gear unit.
If the gear links of a running unit could be altered (via the REST
API) we wouldn't need to do that, but I can't find an example of such
a REST API.

It doesn't exist today, it was something we'd like to have but just hasn't been implement.

allow STI to use image files indicated via STI_SCRIPTS_PATH env var

STI is very simple and effective. I've been trying the go version and customizing some images and the fact that the image itself cannot indicate where it has STI scripts causes an "odd" recursive mention of the code linking to it's own repository URL. e.g.

https://github.com/openshift/ruby-19-centos/blob/master/Dockerfile#L30

It's also slightly awkward during development if you are testing build with different apps not inside the sti buildpack repo. For instance, I ended up using a simple fileserver locally and passing the local url as a flag to sti build. A better solution would be running docker build, then building with sti on top of that image that already has sti scripts inside, hence:

It'd be great to have the image and use the STI scripts inside that image, e.g in the Dockerfile: `ENV STI_SCRIPTS_PATH=/sti'

What do you think?

Defining environment variables

I suspect this is me being new to working with gear, but I cannot figure out how to provide environment variables to my containers.

What is the correct way of setting environment variables, equivalent to -e from docker run?

'gear deploy' possible with REST API?

I find deploying using gear deployment descriptor [*] a really powerful feature. It it possible to do that with rest api? I don't see it mentioned anywhere in the docs.

[*] gear deploy deployment/fixtures/simple_deploy.json localhost

Can't Build from tarball archive anymore

Commit ID c5a46434815a874c36b52aba5aea2909a26d9e44 introduced the dependency for the build to occur from a git checkout instead of from a tarball archive which is how we build for Fedora/EPEL.

$ git describe --abbrev=0 --tags
fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Building in mock/koji produces a failed build as a side effect.

Mock Version: 1.1.39
Mock Version: 1.1.39
ENTER do(['bash', '--login', '-c', 'rpmbuild -bs --target x86_64 --nodeps builddir/build/SPECS/geard.spec'], False, '/var/lib/mock/f22-build-2201140-403588/root/', None, 86400, True, False, 1000, 425, None, False, {'LANG': 'en_US.UTF-8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'echo -n "<mock-chroot>"', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}, logger=<mockbuild.trace_decorator.getLog object at 0x152bb90>)
Executing command: ['bash', '--login', '-c', 'rpmbuild -bs --target x86_64 --nodeps builddir/build/SPECS/geard.spec'] with env {'LANG': 'en_US.UTF-8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'echo -n "<mock-chroot>"', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}
warning: Could not canonicalize hostname: buildvm-06.phx2.fedoraproject.org
Building target platforms: x86_64
Building for target x86_64
Wrote: /builddir/build/SRPMS/geard-0-0.14.git06df437.fc22.src.rpm
Child return code was: 0
LEAVE do --> 

ENTER do(['bash', '--login', '-c', 'rpmbuild -bb --target x86_64 --nodeps  builddir/build/SPECS/geard.spec'], False, '/var/lib/mock/f22-build-2201140-403588/root/', None, 86400, True, False, 1000, 425, None, False, {'LANG': 'en_US.UTF-8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'echo -n "<mock-chroot>"', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}, logger=<mockbuild.trace_decorator.getLog object at 0x152bb90>)
Executing command: ['bash', '--login', '-c', 'rpmbuild -bb --target x86_64 --nodeps  builddir/build/SPECS/geard.spec'] with env {'LANG': 'en_US.UTF-8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'echo -n "<mock-chroot>"', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}
Building target platforms: x86_64
Building for target x86_64
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.j0HDxZ
+ umask 022
+ cd /builddir/build/BUILD
+ cd /builddir/build/BUILD
+ rm -rf geard-06df43769cbe85c898d6e6452a22aef743f7aad0
+ /usr/bin/gzip -dc /builddir/build/SOURCES/geard-06df437.tar.gz
+ /usr/bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd geard-06df43769cbe85c898d6e6452a22aef743f7aad0
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ echo 'Patch #0 (selinux-impl.patch):'
Patch #0 (selinux-impl.patch):
+ /usr/bin/cat /builddir/build/SOURCES/selinux-impl.patch
+ /usr/bin/patch -p1 -b --suffix selinux-impl --fuzz=0
patching file selinux/library/selinux_impl.go
Hunk #1 succeeded at 35 (offset -1 lines).
Hunk #2 succeeded at 51 (offset -1 lines).
Hunk #3 succeeded at 75 (offset -1 lines).
Hunk #4 succeeded at 87 (offset -1 lines).
Hunk #5 succeeded at 95 (offset -1 lines).
Hunk #6 succeeded at 107 (offset -1 lines).
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.J3wZrc
+ umask 022
+ cd /builddir/build/BUILD
+ cd geard-06df43769cbe85c898d6e6452a22aef743f7aad0
+ mkdir _build
+ pushd _build
~/build/BUILD/geard-06df43769cbe85c898d6e6452a22aef743f7aad0/_build ~/build/BUILD/geard-06df43769cbe85c898d6e6452a22aef743f7aad0
+ mkdir -p src/github.com/openshift
++ dirs +1 -l
+ ln -s /builddir/build/BUILD/geard-06df43769cbe85c898d6e6452a22aef743f7aad0 src/github.com/openshift/geard
+ popd
~/build/BUILD/geard-06df43769cbe85c898d6e6452a22aef743f7aad0
++ pwd
+ export GOPATH=/builddir/build/BUILD/geard-06df43769cbe85c898d6e6452a22aef743f7aad0/_build
+ GOPATH=/builddir/build/BUILD/geard-06df43769cbe85c898d6e6452a22aef743f7aad0/_build
+ contrib/build -s -l -n
Building with GOPATH: /builddir/build/BUILD/geard-06df43769cbe85c898d6e6452a22aef743f7aad0/contrib/../vendor:/builddir/build/BUILD/geard-06df43769cbe85c898d6e6452a22aef743f7aad0/_build
contrib/build: line 62: git: command not found
contrib/build: line 62: git: command not found
Version: version , build 
------------------------------------------
Building cmd/gear (target: linux)...
------------------------------------------
go install runtime/cgo: open /usr/lib/golang/pkg/linux_amd64/runtime/cgo.a: permission denied
===> FAILED
------------------------------------------
Building cmd/switchns (target: linux)...
------------------------------------------
go install runtime/cgo: open /usr/lib/golang/pkg/linux_amd64/runtime/cgo.a: permission denied
===> FAILED
------------------------------------------
Building ssh/cmd/gear-auth-keys-command (target: linux)...
------------------------------------------
go install runtime/cgo: open /usr/lib/golang/pkg/linux_amd64/runtime/cgo.a: permission denied
===> FAILED
------------------------------------------
Building cmd/sti (target: linux)...
------------------------------------------
go install runtime/cgo: open /usr/lib/golang/pkg/linux_amd64/runtime/cgo.a: permission denied
===> FAILED
Exiting due to build failures.
error: Bad exit status from /var/tmp/rpm-tmp.J3wZrc (%build)
RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.J3wZrc (%build)
Child return code was: 1
EXCEPTION: Command failed. See logs for output.
 # ['bash', '--login', '-c', 'rpmbuild -bb --target x86_64 --nodeps  builddir/build/SPECS/geard.spec']
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/util.py", line 376, in do
    raise mockbuild.exception.Error, ("Command failed. See logs for output.\n # %s" % (command,), child.returncode)
Error: Command failed. See logs for output.
 # ['bash', '--login', '-c', 'rpmbuild -bb --target x86_64 --nodeps  builddir/build/SPECS/geard.spec']
LEAVE do --> EXCEPTION RAISED

Containers not linked by gear deploy

Fedora release 20 (Heisenbug)
geard.x86_64 0-0.7.gitc105889.fc20
docker.x86_64 1.5-10.fc20

Scenario
Trying the rockmongo_mongo.json sample I get the following error when logging in to http://localhost:6060/index.php?action=login.index&host=0 :
Unable to connect MongoDB, please check your configurations. MongoDB said:Failed to connect to: 127.0.0.1:27017: No route to host.

gear deploy
[root@localhost gearRockmongo]# gear deploy rockmongo_mongo.json
==> Deploying rockmongo_mongo.json
local PortMapping: 80 -> 6060
local Container rockmongo-1 is installed
ports: searching block 41, 4000-4099
ports: Reserved port 4001
local PortMapping: 27017 -> 4001
local Container mongodb-1 is installed
==> Linking rockmongo: 127.0.0.1:27017 -> localhost:4001
local Container rockmongo-1 starting
local Container mongodb-1 starting
==> Deployed as rockmongo_mongo.json.20140512-140735

docker ps
26924131fdac openshift/centos-mongodb:latest /usr/bin/mongod --co 22 minutes ago Up 22 minutes 0.0.0.0:4001->27017/tcp mongodb-1
b5fd473f83f9 openshift/centos-rockmongo:latest /usr/sbin/httpd -D F 22 minutes ago Up 22 minutes 0.0.0.0:6060->80/tcp rockmongo-1

gear list-units
[root@localhost gearRockmongo]# gear list-units
ID SERVER ACTIVE SUB LOAD TYPE
mongodb-1 active running loaded
rockmongo-1 active running loaded

cat rockmongo_mongo.json.20140512-140735
{"Containers":[{"Name":"rockmongo","Image":"openshift/centos-rockmongo","PublicPorts":[{"Internal":80,"External":6060}],"Links":[{"To":"mongodb","Ports":[27017]}],"Count":1},{"Name":"mongodb","Image":"openshift/centos-mongodb","PublicPorts":[{"Internal":27017}],"Count":1}],"Instances":[{"Id":"rockmongo-1","Image":"openshift/centos-rockmongo","From":"rockmongo","On":"local","Ports":[{"Internal":80,"External":6060,"Target":{}}]},{"Id":"mongodb-1","Image":"openshift/centos-mongodb","From":"mongodb","On":"local","Ports":[{"Internal":27017,"External":4001,"Target":{"Host":"127.0.0.1","Port":27017}}]}],"IdPrefix":"","RandomizeIds":false}

REST API should publish information about the docker image associated with each unit

The REST API doesn't currently publish any information about the Docker image associated with each Gear unit.

On 6 July 2014 17:23, Clayton Coleman [email protected] wrote:

On Jul 4, 2014, at 12:43 PM, Richard Wall [email protected] wrote:

Is there any way to get that "ContainerImage" value via the REST API?

Not right now - I would imagine us adding a container GET call which returns info similar to that accepted by install image (although some of the subresources like environment might not be represented exactly).
List containers is systemd focused (returns running containers by default). One tricky consequence of that is that containers that stopped cleanly are not shown - the "-a" flag scans the filesystem for missing entries. We'd need to do something similar to unify the systemd status info with the on disk info.

Atomic VM is missing the VirtualBox guest additions

See this output:

==> rhel-7-atomic: Checking for guest additions in VM...
    rhel-7-atomic: No guest additions were detected on the base box for this VM! Guest
    rhel-7-atomic: additions are required for forwarded ports, shared folders, host only
    rhel-7-atomic: networking, and more. If SSH fails on this machine, please install
    rhel-7-atomic: the guest additions and repackage the box to continue.
    rhel-7-atomic: 
    rhel-7-atomic: This is not an error message; everything may continue to work properly,
    rhel-7-atomic: in which case you may ignore this message.
==> rhel-7-atomic: Mounting shared folders...
    rhel-7-atomic: /vagrant => /home/mfojtik/go
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant

@smarterclayton fyi

Starting the daemon with systemd behaves differently than running in shell

Hi.

I have a very strange behaviour that I haven't manage to understand. When I run as root this:

/usr/bin/gear daemon --has-env-file --listen-address='127.0.0.1:43273'

Everything works as expected: The daemon binds to the loopback in the specified port.

However if I use this service unit:

[Unit]
Description=Gear Provisioning Daemon (geard)

[Service]
ExecStart=/usr/bin/gear daemon --has-env-file --listen-address='127.0.0.1:43273'

[Install]
WantedBy=multi-user.target

I always get a failing status:

May 27 13:08:37 ferry systemd[1]: Starting Gear Provisioning Daemon (geard)...
May 27 13:08:37 ferry systemd[1]: Started Gear Provisioning Daemon (geard).
May 27 13:08:37 ferry gear[9883]: Listening (HTTP) on '127.0.0.1:43273' ...
May 27 13:08:37 ferry gear[9883]: listen tcp: unknown port tcp/43273'
May 27 13:08:37 ferry systemd[1]: geard.service: main process exited, code=exited, status=1/FAILURE

When the listen-address flag is entirely removed, everything works in systemd:

May 27 13:12:28 ferry systemd[1]: Starting Gear Provisioning Daemon (geard)...
May 27 13:12:28 ferry systemd[1]: Started Gear Provisioning Daemon (geard).
May 27 13:12:28 ferry gear[10850]: Listening (HTTP) on :43273 ...

But this leaves the daemon http interface exposed to all interfaces, which I really don't want for security reasons. Instead I want to expose the API to use from local apps through HTTP. I don't see what I'm doing wrong. First I thought it was an issue of compiling with contrib/build -s then I disabled that flag and I still cannot get it running only attached to the loopback.

Unable to run Rockmongo example

Hello, I am trying to run Rockmongo example but without success.

Rockmongo keep reporting this error:

Unable to connect MongoDB, please check your configurations. MongoDB said:Failed to connect to: 127.0.0.1:27017: No route to host.

I have also restarted Rockmongo container as suggested in the documentation but with no luck.

$ sudo gear list-units
You can also display the set of containers via 'systemctl list-units'
2014/05/07 09:02:05 local execute *jobs.ListContainersResponse
ID          SERVER  ACTIVE  SUB     LOAD    TYPE
mongodb-1           active  running loaded  
rockmongo-1         active  running loaded  

$ sudo gear status mongodb-1
You can also display the status of this container via 'systemctl status ctr-mongodb-1.service'
ctr-mongodb-1.service - Container mongodb-1
   Loaded: loaded (/var/lib/containers/units/mo/ctr-mongodb-1.service; enabled)
   Active: active (running) since Wed 2014-05-07 08:52:20 CEST; 10min ago
  Process: 16751 ExecStartPost=/usr/bin/gear init --post mongodb-1 openshift/centos-mongodb (code=exited, status=0/SUCCESS)
  Process: 16559 ExecStartPre=/usr/bin/docker rm mongodb-1 (code=exited, status=0/SUCCESS)
  Process: 16539 ExecStartPre=/bin/sh -c /usr/bin/docker inspect --format="Reusing {{.ID}}" "mongodb-1-data" || exec docker run --name "mongodb-1-data" --volumes-from "mongodb-1-data" --entrypoint true "openshift/centos-mongodb" (code=exited, status=0/SUCCESS)
 Main PID: 16750 (docker)
   CGroup: /container.slice/container-small.slice/ctr-mongodb-1.service
           └─16750 /usr/bin/docker run --rm --name mongodb-1 --volumes-from mongodb-1-data -a stdout -a stderr -p 4000:27017 openshift/centos-mongodb

May 07 08:52:20 paolobox docker[16750]: 2014-05-07T06:52:20.593+0000 [initandlisten] waiting for connections on port 27017
May 07 08:52:20 paolobox gear[16751]: 2014/05/07 08:52:20 docker: execution driver native-0.1
May 07 08:52:20 paolobox gear[16751]: 2014/05/07 08:52:20 Updating network namespaces for 16831
May 07 08:52:20 paolobox systemd[1]: Started Container mongodb-1.
May 07 08:53:20 paolobox docker[16750]: 2014-05-07T06:53:20.594+0000 [clientcursormon] mem (MB) res:35 virt:252
May 07 08:53:20 paolobox docker[16750]: 2014-05-07T06:53:20.595+0000 [clientcursormon]  mapped (incl journal view):64
May 07 08:53:20 paolobox docker[16750]: 2014-05-07T06:53:20.595+0000 [clientcursormon]  connections:0
May 07 08:58:20 paolobox docker[16750]: 2014-05-07T06:58:20.607+0000 [clientcursormon] mem (MB) res:36 virt:253
May 07 08:58:20 paolobox docker[16750]: 2014-05-07T06:58:20.608+0000 [clientcursormon]  mapped (incl journal view):64
May 07 08:58:20 paolobox docker[16750]: 2014-05-07T06:58:20.608+0000 [clientcursormon]  connections:0

$ sudo gear status rockmongo-1
You can also display the status of this container via 'systemctl status ctr-rockmongo-1.service'
ctr-rockmongo-1.service - Container rockmongo-1
   Loaded: loaded (/var/lib/containers/units/ro/ctr-rockmongo-1.service; enabled)
   Active: active (running) since Wed 2014-05-07 08:53:30 CEST; 9min ago
  Process: 17440 ExecStartPost=/usr/bin/gear init --post rockmongo-1 openshift/centos-rockmongo (code=exited, status=0/SUCCESS)
  Process: 17430 ExecStartPre=/usr/bin/docker rm rockmongo-1 (code=exited, status=1/FAILURE)
  Process: 17417 ExecStartPre=/bin/sh -c /usr/bin/docker inspect --format="Reusing {{.ID}}" "rockmongo-1-data" || exec docker run --name "rockmongo-1-data" --volumes-from "rockmongo-1-data" --entrypoint true "openshift/centos-rockmongo" (code=exited, status=0/SUCCESS)
 Main PID: 17439 (docker)
   CGroup: /container.slice/container-small.slice/ctr-rockmongo-1.service
           └─17439 /usr/bin/docker run --rm --name rockmongo-1 --volumes-from rockmongo-1-data -a stdout -a stderr -p 6060:80 openshift/centos-rockmongo

May 07 08:53:27 paolobox sh[17417]: Reusing 3776704c92bd3784d305ecf7f70abaafcdf803a20b1a9015551456c5ffdab82b
May 07 08:53:27 paolobox docker[17430]: Error: No such container: rockmongo-1
May 07 08:53:27 paolobox docker[17430]: 2014/05/07 08:53:27 Error: failed to remove one or more containers
May 07 08:53:27 paolobox gear[17440]: 2014/05/07 08:53:27 user: unknown user ctr-rockmongo-1
May 07 08:53:29 paolobox docker[17439]: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3 for ServerName
May 07 08:53:29 paolobox gear[17440]: 2014/05/07 08:53:29 docker: execution driver native-0.1
May 07 08:53:29 paolobox gear[17440]: 2014/05/07 08:53:29 Updating network namespaces for 17481
May 07 08:53:30 paolobox gear[17440]: 2014/05/07 08:53:30 Using 192.168.1.131/24 for localhost
May 07 08:53:30 paolobox systemd[1]: Started Container rockmongo-1.

$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere            
INPUT_direct  all  --  anywhere             anywhere            
INPUT_ZONES_SOURCE  all  --  anywhere             anywhere            
INPUT_ZONES  all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere            
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:8012

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             172.17.0.3           tcp dpt:http
ACCEPT     tcp  --  anywhere             172.17.0.2           tcp dpt:27017
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere            
FORWARD_direct  all  --  anywhere             anywhere            
FORWARD_IN_ZONES_SOURCE  all  --  anywhere             anywhere            
FORWARD_IN_ZONES  all  --  anywhere             anywhere            
FORWARD_OUT_ZONES_SOURCE  all  --  anywhere             anywhere            
FORWARD_OUT_ZONES  all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere            
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
OUTPUT_direct  all  --  anywhere             anywhere            

Chain FORWARD_IN_ZONES (1 references)
target     prot opt source               destination         
FWDI_public  all  --  anywhere             anywhere            
FWDI_public  all  --  anywhere             anywhere            
FWDI_public  all  --  anywhere             anywhere            

Chain FORWARD_IN_ZONES_SOURCE (1 references)
target     prot opt source               destination         

Chain FORWARD_OUT_ZONES (1 references)
target     prot opt source               destination         
FWDO_public  all  --  anywhere             anywhere            
FWDO_public  all  --  anywhere             anywhere            
FWDO_public  all  --  anywhere             anywhere            

Chain FORWARD_OUT_ZONES_SOURCE (1 references)
target     prot opt source               destination         

Chain FORWARD_direct (1 references)
target     prot opt source               destination         

Chain FWDI_public (3 references)
target     prot opt source               destination         
FWDI_public_log  all  --  anywhere             anywhere            
FWDI_public_deny  all  --  anywhere             anywhere            
FWDI_public_allow  all  --  anywhere             anywhere            

Chain FWDI_public_allow (1 references)
target     prot opt source               destination         

Chain FWDI_public_deny (1 references)
target     prot opt source               destination         

Chain FWDI_public_log (1 references)
target     prot opt source               destination         

Chain FWDO_public (3 references)
target     prot opt source               destination         
FWDO_public_log  all  --  anywhere             anywhere            
FWDO_public_deny  all  --  anywhere             anywhere            
FWDO_public_allow  all  --  anywhere             anywhere            

Chain FWDO_public_allow (1 references)
target     prot opt source               destination         

Chain FWDO_public_deny (1 references)
target     prot opt source               destination         

Chain FWDO_public_log (1 references)
target     prot opt source               destination         

Chain INPUT_ZONES (1 references)
target     prot opt source               destination         
IN_public  all  --  anywhere             anywhere            
IN_public  all  --  anywhere             anywhere            
IN_public  all  --  anywhere             anywhere            

Chain INPUT_ZONES_SOURCE (1 references)
target     prot opt source               destination         

Chain INPUT_direct (1 references)
target     prot opt source               destination         

Chain IN_public (3 references)
target     prot opt source               destination         
IN_public_log  all  --  anywhere             anywhere            
IN_public_deny  all  --  anywhere             anywhere            
IN_public_allow  all  --  anywhere             anywhere            

Chain IN_public_allow (1 references)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             224.0.0.251          udp dpt:mdns ctstate NEW
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh ctstate NEW

Chain IN_public_deny (1 references)
target     prot opt source               destination         

Chain IN_public_log (1 references)
target     prot opt source               destination         

Chain OUTPUT_direct (1 references)
target     prot opt source               destination         


$ cat rockmongo_mongo.json
{
  "containers":[
    {
      "name":"rockmongo",
      "count":1,
      "image":"openshift/centos-rockmongo",
      "publicports":[
        {"internal":80,"external":6060}
      ],
      "links":[
        {"to":"mongodb"}
      ]
    },
    {
      "name":"mongodb",
      "count":1,
      "image":"openshift/centos-mongodb",
      "publicports":[
        {"internal":27017}
      ]
    }
  ]
}0

Here some spec:

$ cat /etc/fedora-release 
Fedora release 20 (Heisenbug)

$ uname -a
Linux paolobox 3.13.10-200.fc20.x86_64 #1 SMP Mon Apr 14 20:34:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ docker -v
Docker version 0.9.1, build 867b2a9/0.9.1

$ sudo dnf info geard
Failed to synchronize cache for repo 'satools': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried, disabling.
Installed Packages
Name        : geard
Arch        : x86_64
Epoch       : 0
Version     : 0
Release     : 0.3.gitb31df16.fc20
Size        : 32 M
Repo        : @System
From repo   : updates
Summary     : CLI client for installing Docker images as containers
URL         : http://github.com/openshift/geard
Licence     : ASL 2.0
Description : geard is a command line client for installing Docker images as containers
            : onto a systemd-enabled Linux operating system (systemd 207 or newer).


$ sudo getenforce 
Permissive

Any idea or check I can perform?

Slice function is unclear and doesn't limit memory

Possible slices are hardcoded in the source; any slice should be accepted if installed

PR #179 is a nice addition that was missing. However, If I wanted to have extra slices I'd have to recompile everything because the validation of the --slice flag is made against an array defined in the code:

(https://github.com/jwhonce/geard/blob/f2f109a5f6a1ef5e678655d72b538204ecd88562/containers/jobs/init.go#L54-L58)

Wouldn't it be best to check for the presence of the slice in systemd instead of it being limited to the slices in the source?

I think that for the init job the default slices are great, but according to how many resources a system have, those definitions can fall short and may not reflect a specific case logic organization of containers. e.g: If I wanted to have containers related to cluster admins tasks on one side and public apps in another currently I don't have many alternatives for this (besides patching).

Also, there's a problem with potentially ignored resources (memory in this case). Since slices group resources for all their children, if I have a machine with 8gb of memory, the slice would left a lot of it unused (~7gb - system usage) even if the container-large.slice is used.*** Makes sense for development, but not for big nodes than can handle many containers.

I can replace the slice file in /etc/systemd/system but that feels very hackish to me. Also I'm wondering if alternative or complementary to slices, individual containers should be the ones having memory limits, like a dyno in Heroku, I know how much a container gets.

Maybe I'm missing something here about why slices were chosen and not container memory accounting. I'd say that a case where I can have a slice without memory limits and containers with specific limits seems more logical to me.

Any thoughts?

*** this is what I understood from the systemd documentation, but to be honest there aren't that many mentions to slices out there, so please correct me if I'm wrong.

gear clean failed

I just did a fresh boot of atomic host and a gear clean... pls adv what other debug data I may provide.

-bash-4.2# ostree admin status

  • project-atomic-controller 6b6b1362241f1c658b54797b51c2215e32b0978f2201eeb7cd2068276adb9015.0
    origin refspec: project-atomic-controller:project-atomic-controller/fc20/x86_64/buildmaster/controller/docker
    project-atomic-controller 309c63cc9d8cc3819b6fe798fe49a72ab77493c854bf584a893301e71a3d71be.0
    origin refspec: project-atomic-controller:project-atomic-controller/fc20/x86_64/buildmaster/controller/docker

-bash-4.2# gear clean
INFO: 2014/06/28 09:32:04 --- "FAILED CONTAINERS" CLEANUP ---
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x633e62]

goroutine 1 [running]:
runtime.panic(0x7f8620, 0xfa25e8)
/usr/lib/golang/src/pkg/runtime/panic.c:266 +0xb6
github.com/openshift/geard/cleanup.(_FailureCleanup).Clean(0xc21000a500, 0xc21007a400)
/builddir/build/BUILD/geard-3c781d0cd8a961a85449d362fb5d8c88c5a34a22/_build/src/github.com/openshift/geard/cleanup/cleanup_failures.go:48 +0x5d2
github.com/openshift/geard/cleanup.Clean(0xc21007a400)
/builddir/build/BUILD/geard-3c781d0cd8a961a85449d362fb5d8c88c5a34a22/_build/src/github.com/openshift/geard/cleanup/cleanup.go:31 +0x6f
github.com/openshift/geard/cleanup/cmd.clean(0xc2100ba2d0, 0xfc5b98, 0x0, 0x0)
/builddir/build/BUILD/geard-3c781d0cd8a961a85449d362fb5d8c88c5a34a22/_build/src/github.com/openshift/geard/cleanup/cmd/cmd.go:32 +0x1ae
github.com/spf13/cobra.(_Command).execute(0xc2100ba2d0, 0xc21000a020, 0x0, 0x0, 0x0, ...)
/builddir/build/BUILD/geard-3c781d0cd8a961a85449d362fb5d8c88c5a34a22/vendor/src/github.com/spf13/cobra/command.go:297 +0x116
github.com/spf13/cobra.(_Command).findAndExecute(0xc2100b5000, 0xc21000a010, 0x1, 0x1, 0x0, ...)
/builddir/build/BUILD/geard-3c781d0cd8a961a85449d362fb5d8c88c5a34a22/vendor/src/github.com/spf13/cobra/command.go:283 +0xa8
github.com/spf13/cobra.(_Command).Execute(0xc2100b5000, 0x0, 0x0)
/builddir/build/BUILD/geard-3c781d0cd8a961a85449d362fb5d8c88c5a34a22/vendor/src/github.com/spf13/cobra/command.go:332 +0x66e
main.Execute()
/builddir/build/BUILD/geard-3c781d0cd8a961a85449d362fb5d8c88c5a34a22/_build/src/github.com/openshift/geard/cmd/gear/commands.go:258 +0x178e
main.main()
/builddir/build/BUILD/geard-3c781d0cd8a961a85449d362fb5d8c88c5a34a22/_build/src/github.com/openshift/geard/cmd/gear/main.go:6 +0x1a
-bash-4.2#

gear clean results in gear deploy failures for me

I have the package geard.x86_64 0-0.3.gitb31df16.fc20
installed on Fedora release 20 (Heisenbug)
and am experimenting with using gear to link containers.
I felt like my josn changes were not being picked up, got a little to tidy for my own good and ran gear clean. Since the clean I get the following error messages when running gear deploy with my json file.

Any suggestions how to recover would be most appreciated!

2014/05/09 14:35:07 alter_container_state: Unable to persist whether the unit is started on boot: symlink /var/lib/containers/units/tw/ctr-twl-dashboard-1.service /etc/systemd/system/container-active.target.wants/ctr-twl-dashboard-1.service: no such file or directory
2014/05/09 14:35:07 alter_container_state: Unable to persist whether the unit is started on boot: symlink /var/lib/containers/units/tw/ctr-twl-provider-1.service /etc/systemd/system/container-active.target.wants/ctr-twl-provider-1.service: no such file or directory

Support Privileged Containers

Current template files do not support a way to specify a container to run in privileged mode. I believe having support for privileged mode containers would be great, if the user needs control over the hostnames, ip address and dns (which docker as yet doesnt support without privileged mode)

geard freezes when unit is started/stopped in quick succession

This works just fine:

$ curl -XPUT -d '{"Image": "busybox", "Started": true}' http://localhost:43273/container/testcontainer
$ sleep 1
$ curl -XPUT http://localhost:43273/container/testcontainer/stopped

If however I start and then stop the container in quick succession, often the second curl command just hangs, as do e.g. additional commands like deleting a unit.

$ curl -XPUT -d '{"Image": "busybox", "Started": true}' http://localhost:43273/container/testcontainer; curl -XPUT http://localhost:43273/container/testcontainer/stopped
... hangs here ...

This is Fedora 20, gear version alpha3, build 7516dab (built from checkout a couple hours ago using vendored dependencies).

Possibly a duplicate of #166.

openshift/busybox-http-app is not in the public index

The readme simple example of:

gear install openshift/busybox-http-app my-sample-service

No longer works since openshift/busybox-http-app is not in the index: https://index.docker.io/u/openshift/busybox-http-app/

I would like to kindly ask you to keep the public stuff accessible to everyone since this has happened before, for instance with the Vagrantfile using the atomic box. I think geard is awesome and I'm very appreciative of the contribution that Redhat is doing, but it's not nice to be truly interested and being excluded because things work for you in your networks but not outside.

Please don't take this as rude in any way, I'm just really interested in geard and it's actually the only repo that I currently track very carefully, so maybe it's simply that you're not aware of these things on a regular basis and probably a nice reminder could be useful.

I understand if my suggestion is not really what you want to do right now. In any case, thanks again for releasing geard and all your ongoing efforts to improve it.

Units not being created automatically

Hi,

I compiled and installed geard in a Fedora machine, not the vagrant provided example. I have everything working but /var/lib/containers/units has no unit files, so for example I don't have the files defined here:

https://github.com/openshift/geard/blob/ddabe78472cb9e010399501b6f26906be77e2cbc/git/jobs/templates.go

therefore the example command to activate the default geard-githost doesn't work: https://github.com/openshift/geard/blob/master/contrib/bootstrap-daemon.sh#L9

Is there something special I have to do to get this files created? I don't see a command special targeted to create this file structure though. Thanks!

busybox-http-app serves HTTP headers in the body of its response

busybox-http-app is a useful little container; we are using it in our functional tests to check that our wrappers correctly configure and call geard.

But we notice that the index.html served by busybox httpd actually contains HTTP header lines....which seems like a mistake.

It results in the following confusing HTTP conversation.

GET / HTTP/1.1
Connection: close
Host: 127.0.0.1:4040
Accept-Encoding: gzip

HTTP/1.0 200 OK
Content-type: text/html
Date: Mon, 23 Jun 2014 14:26:00 GMT
Connection: close
Last-Modified: Wed, 11 Jun 2014 18:35:13 GMT
Content-length: 88

HTTP/1.1 200 OK
Content-Type: text/plain;charset=utf-8
Content-Length: 12

Hello world!

Perhaps those headers should have been removed from the html file in #144 and perhaps the file should be renamed index.txt so that busybox httpd serves it with the correct content-type. May also have to configure busybox httpd to treat index.txt as an index file.

geard cannot be installed in /usr/local

I installed geard in /usr/local using this bootstrap script. Trying out simple things works, but deploying doesn't.

The following command was used to deploy an application:

gear deploy https://gist.githubusercontent.com/mildred/df5ef599a99c178647c2/raw/mail.gear.json

Running gear status on a docker container that was created from the deploy doesn't work. I get:

# gear status mail-1                                                                                                                         
WARNING: Unable to find all required binaries - some operations may not be available: Unable to find /usr/bin/gear
container_status: Unable to fetch container status logs: fork/exec /usr/bin/systemctl: no such file or directory

which is pretty strainghtforward. /usr/bin/gear doesn't exists as it was installed in /usr/local/bin/gear

STI save-artifacts script should be optional during build time

I was puzzled trying to build a new image for STI in that it kept failing about not finding the scripts. This was in a nginx static file server where incremental builds make no sense, hence I didn't create a save-artifacts script. This made the build command failed because it encountered a http 404.

The save-artifacts script should be optional because it doesn't always apply opposed to run and assemble.

list-units command won't show some inactive units that are installed & enabled

Hi everyone,

here's a strange issue that I noticed today working on something close to a distributed version of dokku (mostly bash as well):

gear list-units should list information for all installed containers. Installed in this context means the systemd unit was compiled and enabled. However the container may not be started if the --start flag was not given on install or gear start <unit> hasn't been run.

The list-units command will only list information about running/failed units or inactive units that were active (I assume) during the current boot. If you install but don't start the container and then run the list-units command you'll see missing units, even though they're still present in /etc/systemd/system and in /var/lib/containers/units/ and enabled to be auto-started during the next boot.

The command currently has no flags at the moment, so it'd seem logical to include the state of all installed units, aka the ones linked and enabled on systemd regardless of their running state.

I was investigating why this was happening to see if I could manage to send a pull request, but I actually found the issue to be related to systemd. Under fedora 20 with systemd 208 the list-units command won't include by default inactive units that used to be running during the current boot. Those units, for example a container that I stopped manually with systemctl stop ctr-<container>, will be listed if --all is passed to systemctl list-units.

What is absolutely surprising if that an enabled unit, that is correctly linked under container.target.wants, but that hasn't been started not even once cannot be listed with systemctl (if you find a way, please let me know, I didn't manage to find a solution).

This can be reproduced by doing a gear install <image> <container> and then running gear list-units or systemctl list-units --all | grep <container>. Reloading the systemd daemon will not change this.

One viable alternative to get a real image of all installed containers is to find /etc/systemd/system | grep ctr and then query manually systemctl status for each of them.

This seems like a bug to me and even though it's not a common concern (it'd be odd to have installed container that are not started), it results in the list units command not offering all the information it can really gather about a system, e.g. you could do thousands of gear installs and don't know what units you didn't start. Those files would probably go away with the clean commands that have received improvement lately, but I'm not sure it's not a good thing that we cannot see whats units have actually been installed. Specially since a reboot will indeed activate them since they're enabled to launch on container.target.

Given this lies deeper that the source of Geard, I leave this here hoping that you'll discuss what's the best solution (if any, maybe a doc note will suffice). I though a little bit and my personal suggestion would be that:

  • list units description is perfect, "Shows the equivalent of 'systemctl list-units ctr-' for each installed container" and instead of changing the docs, the functionality should be updated.
  • the command should not get the unit list from systemd as it currently does but from it's own information of known units taken from /var/lib/containers/units (to be close to find /etc/systemd/system | grep ctr)
  • then each of the units found should be queried to the equivalent of systemctl status

The change in the second step would result in even inactive units being listed by gear list-units making it a reliable source of information that can be filtered with bash command, for example.

Given that I'm running the last version of systemd offered in Fedora 20, this is probably something extended that is either solved in more recent non stable versions or not even in the latest release of systemd, hence requiring a position on the developer's side. I'm pretty sure you know way about this than me!

Timeout while fetching remote image

When you follow the README and setup Vagrant, with no 'pmorie/sti-html/app' imported in Docker and then execute:

gear install pmorie/sti-html-app localhost/my-sample-service --start -p 8080:0

This will timeout after some time and the container is not started and reported as 'failed'. After doing gear start my-sample-service the container starts succesfully.

I think we could either adjust the timeout for fetching the image or introduce some more complex polling wheter image is downloaded or not.

selinux policy prevents using gear remotely

When trying to use gear remotely, some operations such as list-units are blocked by selinux rules. For example, the global log shows:

Jun 26 16:58:36 dock1 gear[25480]: job START *linux.listContainers, IKO_uQ8MvDaup6IQGEppkw: &{ListContainersRequest:0xc21036e370 systemd:0xc2100cd9b0}
Jun 26 16:58:36 dock1 systemd[1]: SELinux policy denies access.
Jun 26 16:58:36 dock1 gear[25480]: list_units: Unable to list units from systemd: SELinux policy denies access.
Jun 26 16:58:36 dock1 gear[25480]: job END   IKO_uQ8MvDaup6IQGEppkw
Jun 26 16:58:36 dock1 gear[25480]: 2014/06/26 16:58:36 500 2.07ms GET /containers

And here's the gear log:

Jun 26 16:59:47 dock1 gear[25480]: 2014/06/26 16:59:47 500 2.34ms GET /containers
Jun 26 17:02:20 dock1 gear[25480]: job START *linux.listContainers, oBI5yNHnZ4pa8wLN2Zl6nA: &{ListContainersRequest:0xc21014d140 systemd:0xc2100cd9b0}
Jun 26 17:02:20 dock1 gear[25480]: list_units: Unable to list units from systemd: SELinux policy denies access.
Jun 26 17:02:20 dock1 gear[25480]: job END   oBI5yNHnZ4pa8wLN2Zl6nA
Jun 26 17:02:20 dock1 gear[25480]: 2014/06/26 17:02:20 500 2.72ms GET /containers

Unable to get version information from a tarball archive

Commit ID c5a46434815a874c36b52aba5aea2909a26d9e44 introduced the dependency for the build version information to be populated form a git checkout. This doesn't work from a tarball archive which is how we build for Fedora/EPEL.

$ git describe --abbrev=0 --tags
fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Discussion of geard roadmap

Hi,

I don't know where else to post this question. Let me know if there's a better place.

I don't understand how to use the auth-keys command, the add-keys or the init-repo or init command in gear CLI. I understand that they use switchns to allow me to run something in the context of a container, but I'm still stuck understanding how.

Also, the docs don't really explain, they say TODO: add fixture public and private key for example
Thanks!

Allow NetworkLinks to the container loopback address to be forwarded specifically to the loopback address of the host

It can be confusing that when you configure NetworkLinks with a target of 127.0.0.1, the traffic is actually routed to one of the non-loopback addresses of the host machine.

To be fair, the log entries do make this clear, but it would be better if it actually sent the traffic to the intended destination.

$ curl -v -X PUT "http://127.0.0.1:43273/container/my-sample-service";
-H "Content-Type: application/json" -d '{"Started": true,
"NetworkLinks": [{"ToPort": 44831, "FromPort": 31337, "FromHost":
"127.0.0.1", "ToHost": "127.0.0.1"}], "Image":
"openshift/busybox-http-app", "Ports": []}'

$ sudo gear status my-sample-service ctr-my-sample-service.service - Container my-sample-service   Loaded: loaded
...
Jun 30 18:04:14 localhost.localdomain gear[13338]: Using 10.0.2.15/24
for 127.0.0.1
Jun 30 18:04:14 localhost.localdomain gear[13338]: Mapping
172.17.0.87(127.0.0.1):31337 -> 10.0.2.15:44831
...

See http://lists.openshift.redhat.com/openshift-archives/users/2014-June/msg00065.html for discussion of this feature and a possible solution:

On 30 June 2014 23:21, Mrunal Patel <...> wrote:

Would it be possible to route the connection to the host's loopback
address? I guess it would involve tunnels or something.

It would probably be a new type of link - host loopback as the ToHost vs.
host public. We'd have to change the iptables rules, and I actually don't
know for sure whether you can route to 127.0.0.1 from inside the namespace.
cc'ing Mrunal.

IP tables forwarding could be used on the host to forward traffic from a particular external port to the 127.0.0.1:<app_port>
and then gear link to access the external port from within a container.

gear daemon crashed by rest "stopped"

curl -X PUT 10.16.23.108:43273/container/rhq3-ZxLsUK1/stopped
caused gear daemon to crash.

I have no problem start/stop gears using the cli.

geard version: 0.13.git6850c8d.fc20

Listening (HTTP) on 10.16.23.108:43273 ...
job START *linux.stopContainer, cUUE78fpj1gAl6fAE24WHg: &{StoppedContainerStateRequest:0xc2100d1360 systemd:0xc2100f73c0}
alter_container_state: Failed to queue a restart Activation of org.freedesktop.systemd1 timed out
panic: Cannot call Success() after failure

goroutine 18 [running]:
runtime.panic(0x761260, 0xc210109820)
/usr/lib/golang/src/pkg/runtime/panic.c:266 +0xb6
github.com/openshift/geard/http.(_httpJobResponse).success(0xc2100fae40, 0x1, 0x0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/http/job_response.go:85 +0x6f
github.com/openshift/geard/http.(_httpJobResponse).SuccessWithWrite(0xc2100fae40, 0x1, 0xc210100000, 0x0, 0x9175d0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/http/job_response.go:71 +0xa8
github.com/openshift/geard/containers/jobs/linux.(_stopContainer).Execute(0xc210108620, 0x7f260344ac80, 0xc2100fae40)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/containers/jobs/linux/alter_container_state.go:172 +0x658
github.com/openshift/geard/dispatcher.func·001()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:45 +0x2f4
created by github.com/openshift/geard/dispatcher.(_Dispatcher).work
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:50 +0x8b

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc210000c18)
/builddir/build/BUILD/go/src/pkg/runtime/sema.goc:199 +0x30
sync.(_WaitGroup).Wait(0xc21007a840)
/usr/lib/golang/src/pkg/sync/waitgroup.go:127 +0x14b
github.com/openshift/geard/daemon/cmd.(_Command).startDaemon(0xc2100b5000, 0xc2100b6f00, 0xc2100b5500, 0x1, 0x1)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/daemon/cmd/cmd.go:82 +0x58e
github.com/openshift/geard/daemon/cmd._Command.(github.com/openshift/geard/daemon/cmd.startDaemon)·fm(0xc2100b6f00, 0xc2100b5500, 0x1, 0x1)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/daemon/cmd/cmd.go:39 +0x4e
github.com/spf13/cobra.(_Command).execute(0xc2100b6f00, 0xc21000a020, 0x1, 0x1, 0x0, ...)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/spf13/cobra/command.go:297 +0x116
github.com/spf13/cobra.(_Command).findAndExecute(0xc2100b6000, 0xc21000a010, 0x2, 0x2, 0x0, ...)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/spf13/cobra/command.go:283 +0xa8
github.com/spf13/cobra.(_Command).Execute(0xc2100b6000, 0x0, 0x0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/spf13/cobra/command.go:332 +0x66e
main.main()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/cmd/gear/main.go:56 +0x32a

goroutine 17 [chan receive]:
github.com/openshift/geard/dispatcher.func·001()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:42 +0x53
created by github.com/openshift/geard/dispatcher.(*Dispatcher).work
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:50 +0x8b

goroutine 19 [chan receive]:
github.com/openshift/geard/dispatcher.func·001()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:42 +0x53
created by github.com/openshift/geard/dispatcher.(*Dispatcher).work
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:50 +0x8b

goroutine 20 [chan receive]:
github.com/openshift/geard/dispatcher.func·001()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:42 +0x53
created by github.com/openshift/geard/dispatcher.(*Dispatcher).work
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:50 +0x8b

goroutine 21 [chan receive]:
github.com/openshift/geard/dispatcher.func·001()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:42 +0x53
created by github.com/openshift/geard/dispatcher.(*Dispatcher).work
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:50 +0x8b

goroutine 22 [chan receive]:
github.com/openshift/geard/dispatcher.func·001()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:42 +0x53
created by github.com/openshift/geard/dispatcher.(*Dispatcher).work
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:50 +0x8b

goroutine 23 [chan receive]:
github.com/openshift/geard/dispatcher.func·001()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:42 +0x53
created by github.com/openshift/geard/dispatcher.(*Dispatcher).work
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:50 +0x8b

goroutine 24 [chan receive]:
github.com/openshift/geard/dispatcher.func·001()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:42 +0x53
created by github.com/openshift/geard/dispatcher.(*Dispatcher).work
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/dispatcher/dispatcher.go:50 +0x8b

goroutine 25 [IO wait]:
net.runtime_pollWait(0x7f260344a4c0, 0x72, 0x0)
/builddir/build/BUILD/go/src/pkg/runtime/netpoll.goc:116 +0x6a
net.(_pollDesc).Wait(0xc210061680, 0x72, 0x7f2603448148, 0xb)
/usr/lib/golang/src/pkg/net/fd_poll_runtime.go:81 +0x34
net.(_pollDesc).WaitRead(0xc210061680, 0xb, 0x7f2603448148)
/usr/lib/golang/src/pkg/net/fd_poll_runtime.go:86 +0x30
net.(_netFD).accept(0xc210061620, 0x9a3f60, 0x0, 0x7f2603448148, 0xb)
/usr/lib/golang/src/pkg/net/fd_unix.go:382 +0x2c2
net.(_TCPListener).AcceptTCP(0xc210000570, 0x4c16db, 0x7f26032b4ca8, 0x4c16db)
/usr/lib/golang/src/pkg/net/tcpsock_posix.go:233 +0x47
net.(_TCPListener).Accept(0xc210000570, 0x7f260344a568, 0xc2100006b8, 0xc21007bd00, 0x0)
/usr/lib/golang/src/pkg/net/tcpsock_posix.go:243 +0x27
net/http.(_Server).Serve(0xc2100d08c0, 0x7f26034494f8, 0xc210000570, 0x0, 0x0)
/usr/lib/golang/src/pkg/net/http/server.go:1622 +0x91
net/http.(_Server).ListenAndServe(0xc2100d08c0, 0xc2100d08c0, 0x2a)
/usr/lib/golang/src/pkg/net/http/server.go:1612 +0xa0
net/http.ListenAndServe(0x7fffae18281d, 0x12, 0x0, 0x0, 0x1, ...)
/usr/lib/golang/src/pkg/net/http/server.go:1677 +0x6d
github.com/openshift/geard/http/cmd.(_Daemon).Start(0xc210036ec0, 0x7fffae182816, 0x19, 0x102ce40, 0xc2100b9e40, ...)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/http/cmd/daemon.go:57 +0x596
github.com/openshift/geard/daemon/cmd.func·001()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/daemon/cmd/cmd.go:76 +0xda
created by github.com/openshift/geard/daemon/cmd.(*Command).startDaemon
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/daemon/cmd/cmd.go:80 +0x565

goroutine 26 [chan receive]:
github.com/openshift/geard/http.func·001(0xc2100d1260, 0xc2100b5af0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/http/server.go:128 +0xa71
github.com/openshift/go-json-rest.func·004(0x7f260344a748, 0xc2100d49c0, 0xc2100d6dd0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/openshift/go-json-rest/handler.go:234 +0x387
github.com/openshift/go-json-rest.func·006(0x7f260344a6c0, 0xc21000f8c0, 0xc2100d6dd0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/openshift/go-json-rest/recorder.go:48 +0xea
github.com/openshift/go-json-rest.func·009(0x7f260344a6c0, 0xc21000f8c0, 0xc2100d6dd0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/openshift/go-json-rest/timer.go:14 +0x83
github.com/openshift/go-json-rest.func·007(0x7f260344a6c0, 0xc21000f8c0, 0xc2100d6dd0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/openshift/go-json-rest/status.go:15 +0x4b
github.com/openshift/go-json-rest.func·001(0x7f260344a6c0, 0xc21000f8c0, 0xc2100d6dd0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/openshift/go-json-rest/gzip.go:56 +0x156
github.com/openshift/go-json-rest.func·005(0x7f260344a6c0, 0xc21000f8c0, 0xc2100d6dd0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/openshift/go-json-rest/log.go:52 +0x51
github.com/openshift/go-json-rest.(_ResourceHandler).ServeHTTP(0xc2100769c0, 0x7f260344a6c0, 0xc21000f8c0, 0xc2100d6dd0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/openshift/go-json-rest/handler.go:254 +0xc6
net/http.(_ServeMux).ServeHTTP(0xc21000a840, 0x7f260344a6c0, 0xc21000f8c0, 0xc2100d6dd0)
/usr/lib/golang/src/pkg/net/http/server.go:1496 +0x163
net/http.serverHandler.ServeHTTP(0xc2100d08c0, 0x7f260344a6c0, 0xc21000f8c0, 0xc2100d6dd0)
/usr/lib/golang/src/pkg/net/http/server.go:1597 +0x16e
net/http.(_conn).serve(0xc21007bd00)
/usr/lib/golang/src/pkg/net/http/server.go:1167 +0x7b7
created by net/http.(_Server).Serve
/usr/lib/golang/src/pkg/net/http/server.go:1644 +0x28b

goroutine 27 [syscall]:
runtime.goexit()
/usr/lib/golang/src/pkg/runtime/proc.c:1394

goroutine 28 [IO wait]:
net.runtime_pollWait(0x7f260344a370, 0x72, 0x0)
/builddir/build/BUILD/go/src/pkg/runtime/netpoll.goc:116 +0x6a
net.(_pollDesc).Wait(0xc210061a70, 0x72, 0x7f2603448148, 0xb)
/usr/lib/golang/src/pkg/net/fd_poll_runtime.go:81 +0x34
net.(_pollDesc).WaitRead(0xc210061a70, 0xb, 0x7f2603448148)
/usr/lib/golang/src/pkg/net/fd_poll_runtime.go:86 +0x30
net.(_netFD).ReadMsg(0xc210061a10, 0xc210109790, 0x10, 0x10, 0xc2100fb020, ...)
/usr/lib/golang/src/pkg/net/fd_unix.go:258 +0x3c9
net.(_UnixConn).ReadMsgUnix(0xc2100d8160, 0xc210109790, 0x10, 0x10, 0xc2100fb020, ...)
/usr/lib/golang/src/pkg/net/unixsock_posix.go:154 +0x165
github.com/godbus/dbus.(_oobReader).Read(0xc2100fb000, 0xc210109790, 0x10, 0x10, 0x1100, ...)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/godbus/dbus/transport_unix.go:19 +0xd1
io.ReadAtLeast(0x7f260344aa80, 0xc2100fb000, 0xc210109790, 0x10, 0x10, ...)
/usr/lib/golang/src/pkg/io/io.go:288 +0xf6
io.ReadFull(0x7f260344aa80, 0xc2100fb000, 0xc210109790, 0x10, 0x10, ...)
/usr/lib/golang/src/pkg/io/io.go:306 +0x71
github.com/godbus/dbus.(_unixTransport).ReadMessage(0xc2100b5b80, 0xc2100d4f00, 0xc200000004, 0xc21010b990)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/godbus/dbus/transport_unix.go:79 +0x155
github.com/godbus/dbus.(_Conn).inWorker(0xc2100dc6c0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/godbus/dbus/conn.go:241 +0x3d
created by github.com/godbus/dbus.(_Conn).Auth
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/godbus/dbus/auth.go:118 +0xdc2

goroutine 29 [chan receive]:
github.com/godbus/dbus.(_Conn).outWorker(0xc2100dc6c0)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/godbus/dbus/conn.go:367 +0x41
created by github.com/godbus/dbus.(_Conn).Auth
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/godbus/dbus/auth.go:119 +0xddc

goroutine 30 [chan receive]:
github.com/openshift/go-systemd/dbus.func·003()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/openshift/go-systemd/dbus/subscription.go:75 +0x4d
created by github.com/openshift/go-systemd/dbus.(*Conn).initDispatch
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/openshift/go-systemd/dbus/subscription.go:96 +0xc2

goroutine 31 [select]:
github.com/openshift/geard/port.(_PortAllocator).findPorts(0xc210078d80)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/port/allocation.go:103 +0x49e
github.com/openshift/geard/port.(_PortAllocator).Run(0xc210078d80)
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/port/allocation.go:55 +0x27
created by github.com/openshift/geard/containers/jobs/linux.initContainers
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/_build/src/github.com/openshift/geard/containers/jobs/linux/extend.go:87 +0x16e

goroutine 32 [runnable]:
github.com/openshift/go-systemd/dbus.func·002()
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/openshift/go-systemd/dbus/methods.go:118
created by github.com/openshift/go-systemd/dbus.(*Conn).StopUnitJob
/builddir/build/BUILD/geard-6850c8d7c61a00b1e01ca67f0f55cd5d405f2005/vendor/src/github.com/openshift/go-systemd/dbus/methods.go:120 +0x17a

Vagrant provisioner hangs in chown

Trying out the vagrant version of geard. Vagrant 1.4.3/Virtualbox 4.2.18/OSX 10.9.2. Shell provisioner hangs during chown call bootstrap-dev-vm.sh. After commenting out chown, provisioner appears to work.

Purge command doesn't delete units

The recently added purge command won't delete file in /var/lib/containers/units/* this results in that gear purge will stop and disable all containers. However since the unit remains, doing gear start on one of the recently purged containers, results on the container being started and enabled again, similar to gear install. This seems like a strange behavior where start and install are overlapping and the behavior of purge seems to "soft" for it's name.

@smarterclayton do you think it's just an issue of clarification in the docs or indeed a strange functionality collision?

gear daemon does not start after reboot of system

If I do the following:
$ sudo systemctl enable geard.service
$ sudo systemctl start geard

The service starts fine, and gear daemon accepts requests.

If I reboot the machine, geard starts in a failed state:
$ sudo systemctl status geard

geard.service - Gear Provisioning Daemon (geard)
Loaded: loaded (/usr/lib/systemd/system/geard.service; enabled)
Active: failed (Result: exit-code) since Fri 2014-06-13 18:05:13 UTC; 34s ago
Docs: https://github.com/openshift/geard
Process: 427 ExecStart=/data/bin/gear daemon (code=exited, status=203/EXEC)
Main PID: 427 (code=exited, status=203/EXEC)
CGroup: /system.slice/geard.service

Jun 13 18:05:13 dev.origin.com systemd[1]: geard.service: main process exited, code=exited, status=203/EXEC
Jun 13 18:05:13 dev.origin.com systemd[1]: Unit geard.service entered failed state.

There is no additional information in the log.
If I manually do
$ sudo systemctl start geard

It functions correctly.
This is a Fedora 20 instance.

deploy command should fail on Docker errors

gear deploy command doesn't indicate any error when it can't pull docker images
version: 0.7.gitc105889.fc20

[root@vnguyen-geard1 deployment]# gear deploy jon-simple.json
==> Deploying jon-simple.json
local PortMapping: 7080 -> 7080
local Container jon-server-1 is installed
local PortMapping: 5432 -> 4005
local Container rhq-psql-1 is installed
==> Linking jon-server: 127.0.0.1:5432 -> localhost:4005
local Container jon-server-1 starting
local Container rhq-psql-1 starting

[root@vnguyen-geard1 deployment]# journalctl -u ctr-jon-server-1
May 19 12:11:10 vnguyen-geard1 sh[15318]: 2014/05/19 12:11:10 Error: Invalid Registry endpoint: Get http://** internal hostname removed ** /v1/_ping: read tcp <** internal ip removed **>
May 19 12:11:10 vnguyen-geard1 systemd[1]: ctr-jon-server-1.service: control process exited, code=exited status=1

Vagrant up for fedora?

vagrant up fails for me because I don't have access to the image for Redhat Atomic.

The docs suggest geard should work on Fedora -- could you provide an alternative in the Vagrant file that uses an appropriate Fedora base box?

Go panic when specifying local path to STI scripts

[root@dev ~]# gear build https://github.com/mfojtik/sinatra-app-example openshift/ruby-
19-centos sinatra-app -s /data/src/github.com/openshift/ruby-19-centos/.sti/bin

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x5560d8]

goroutine 15 [running]:
runtime.panic(0x80eb00, 0xff6668)
    /usr/lib/golang/src/pkg/runtime/panic.c:266 +0xb6
github.com/openshift/geard/sti.downloadFile(0xc210082d20, 0xc21007f6c0, 0x28, 0x0, 0x0, ...)
    /data/src/github.com/openshift/geard/sti/util.go:127 +0x88
github.com/openshift/geard/sti.func·001(0xc210082d20, 0xc21007f6c0, 0x28)
    /data/src/github.com/openshift/geard/sti/build.go:367 +0x7f
created by github.com/openshift/geard/sti.requestHandler.downloadScripts
    /data/src/github.com/openshift/geard/sti/build.go:376 +0x1ed

Fedora yum install: wrong docker package

On Fedora 20, performing yum install --enablerepo=updates-testing geard as per the guide results in the following packages being installed:

docker-1.5-10.fc20.x86_64.rpm
geard-0-0.7.gitc105889.fc20.x86_64.rpm

The correct docker package is docker-io-0.11.1-1.fc20.x86_64.rpm

Bugzilla 1097638 has been raised for the RPM dependency issue.

Further to this, gear does not throw an error when docker-io is missing. For example, prior to installing docker-io I ran the following which appears to succeed:

[root@localhost ~]# gear deploy redis_martini_deploy.json
==> Deploying redis_martini_deploy.json
ports: searching block 41, 4000-4099
ports: Reserved port 4000
local PortMapping: 3000 -> 4000
local Container martini-web-1 is installed
ports: Reserved port 4001
local PortMapping: 6379 -> 4001
local Container martini-redis-1 is installed
==> Linking web: 127.0.0.1:6379 -> localhost:4001
local Container martini-web-1 starting
local Container martini-redis-1 starting
==> Deployed as redis_martini_deploy.json.20140516-011811
[root@localhost ~]#

vagrant up failed on vbox with "bootstrap-dev-vm.sh: No such file or directory"

$ git clone [email protected]:openshift/geard
Cloning into 'geard'...
remote: Reusing existing pack: 9154, done.
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 9159 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (9159/9159), 4.15 MiB | 211.00 KiB/s, done.
Resolving deltas: 100% (5736/5736), done.
Checking connectivity... done.

$ cd geard

$ vagrant up
The Vagrant VMware provider requires a valid license
to run. The license provided is invalid. Please make sure you
downloaded the proper license. If you believe you're seeing
this message in error, please contact support.
Failed to load the "vagrant-vmware-fusion" plugin. View logs for more details.

Sharing GOPATH with VM
Bringing machine 'default' up with 'virtualbox' provider...
[default] Box 'fedora20' was not found. Fetching box from specified URL for
the provider 'virtualbox'. Note that if the URL does not have
a box for this provider, you should interrupt Vagrant now and add
the box yourself. Otherwise Vagrant will attempt to download the
full box prior to discovering this error.
Downloading box from URL: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_fedora-20_chef-provisionerless.box
Extracting box...te: 1229k/s, Estimated time remaining: 0:00:02)
Successfully added box 'fedora20' with provider 'virtualbox'!
[default] Importing base box 'fedora20'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 43273 => 43273 (adapter 1)
[default] -- 6060 => 2225 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] Mounting shared folders...
[default] -- /vagrant
[default] Running provisioner: shell...
[default] Running: inline script
/tmp/vagrant-shell: line 1: /vagrant/src/github.com/openshift/geard/contrib/bootstrap-dev-vm.sh: No such file or directory
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell

Stdout from the command:

Stderr from the command:

/tmp/vagrant-shell: line 1: /vagrant/src/github.com/openshift/geard/contrib/bootstrap-dev-vm.sh: No such file or directory

Customize created service files before starting them

There should be a way to customize created systemd service files before starting deploying the services, whether that's via a template file somewhere, or perhaps some additional entries in the deploy json.

geard stop/delete tasks in rapid order can hang geard

The dispatcher queue is being filled up by stop jobs, and is either hanging in the queue, or systemd itself is hanging. The end result is the gear daemon stops serving API requests. The queue is really small right now (4) so if necessary we can bump it up to get around it for now, but this needs to be debugged.

Jun 02 13:44:54 localhost.localdomain gear[25222]: job START *jobs.StoppedContainerStateRequest, spehM4t_p3GuFvWxSqLsAA: &{Id:demo-lb-1}
Jun 02 13:44:54 localhost.localdomain gear[25222]: job END spehM4t_p3GuFvWxSqLsAA
Jun 02 13:44:54 localhost.localdomain gear[25222]: 2014/06/02 13:44:54 202 2.67ms PUT /container/demo-lb-1/stopped
Jun 02 13:44:54 localhost.localdomain gear[25222]: job START *jobs.StoppedContainerStateRequest, kVWGaWWgHNoAca3L5srEvw: &{Id:demo-backend-1}
Jun 02 13:45:09 localhost.localdomain gear[25222]: alter_container_state: Timeout waiting for stop completion
Jun 02 13:45:09 localhost.localdomain gear[25222]: journal: Done
Jun 02 13:45:09 localhost.localdomain gear[25222]: job END kVWGaWWgHNoAca3L5srEvw
Jun 02 13:45:09 localhost.localdomain gear[25222]: 2014/06/02 13:45:09 202 15018.21ms PUT /container/demo-backend-1/stopped
Jun 02 13:45:09 localhost.localdomain gear[25222]: job START *jobs.StoppedContainerStateRequest, DcWonT51q6uAeKch52t9Zg: &{Id:demo-backend-2}
Jun 02 13:45:24 localhost.localdomain gear[25222]: alter_container_state: Timeout waiting for stop completion
Jun 02 13:45:24 localhost.localdomain gear[25222]: journal: Done
Jun 02 13:45:24 localhost.localdomain gear[25222]: job END DcWonT51q6uAeKch52t9Zg
Jun 02 13:45:24 localhost.localdomain gear[25222]: 2014/06/02 13:45:24 202 15004.78ms PUT /container/demo-backend-2/stopped
Jun 02 13:45:24 localhost.localdomain gear[25222]: job START *jobs.StoppedContainerStateRequest, RpacOJxSpi5AAYQwjeGCUA: &{Id:demo-backend-3}
Jun 02 13:45:24 localhost.localdomain gear[25222]: job END RpacOJxSpi5AAYQwjeGCUA
Jun 02 13:45:24 localhost.localdomain gear[25222]: 2014/06/02 13:45:24 202 2.09ms PUT /container/demo-backend-3/stopped
Jun 02 13:45:24 localhost.localdomain gear[25222]: job START *jobs.StoppedContainerStateRequest, m9nZHM4j6hXTj3W8jwZ3Sg: &{Id:demo-db-1}
Jun 02 13:45:39 localhost.localdomain gear[25222]: alter_container_state: Timeout waiting for stop completion
Jun 02 13:45:39 localhost.localdomain gear[25222]: journal: Done
Jun 02 13:45:39 localhost.localdomain gear[25222]: job END m9nZHM4j6hXTj3W8jwZ3Sg
Jun 02 13:45:39 localhost.localdomain gear[25222]: 2014/06/02 13:45:39 202 15004.99ms PUT /container/demo-db-1/stopped
Jun 02 13:45:39 localhost.localdomain gear[25222]: job START *jobs.DeleteContainerRequest, _jJ-u8mFK7K0nJECi_0JTw: &{Id:replset-db-1}
lines 202-239/239 (END)

Reproduce by quickly stopping and deleting > 4 containers in order.

Add 'quiet' option to list-units cmd

Please consider adding --quiet option to list-units command to show only gear names similar to -q option in 'docker ps'. It'd be useful to be able to stop and delete apps in batches
gear delete $(gear list-units --quiet)

REST API should support listing all units, including those that are stopped or failed

In #152 (comment) gear list-units gained an --all option.

But there isn't currently anything similar for the REST API.

On 6 July 2014 17:23, Clayton Coleman [email protected] wrote:
...

List containers is systemd focused (returns running containers by default). One tricky consequence of that is that containers that stopped cleanly are not shown - the "-a" flag scans the filesystem for missing entries. We'd need to do something similar to unify the systemd status info with the on disk info.

STI should return non-zero exit code upon failure

STI's exit code is always 0. This makes it difficult to determine if the build failed, for example, unless you scrape the invocation's output. I'd recommend that we exit non-zero when appropriate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.