Skip to content
This repository was archived by the owner on Apr 15, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VERSION := `cat VERSION | tr -d '\n'`
COMMIT := `git show -s --format=%h`
DATE := `date -u +%FT%T%z`
TAG := `git describe --abbrev=0 --tags 2>/dev/null || echo "0.0.0"`
Expand Down Expand Up @@ -25,10 +26,28 @@ ifndef VERBOSE
.SILENT:
endif

.PHONY: clean run release tag build dist $(SUBDIRS) get-windows-dependencies
.PHONY: clean run release tag build dist $(SUBDIRS) get-windows-dependencies install uninstall as_root

all: build

as_root:
test "$$(id -u)" -eq "0" || ( echo "Please run 'make $(MAKECMDGOALS)' as root."; return 1 )

install: as_root
systemctl stop reception || true
cp reception /usr/bin/
cp contrib/reception.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable reception
systemctl restart reception

uninstall: as_root
systemctl stop reception || true
systemctl disable reception || true
rm /usr/bin/reception || true
rm /etc/systemd/system/reception.service || true
systemctl daemon-reload

# remove the mess created by make
clean:
$(GOCLEAN)
Expand Down Expand Up @@ -85,8 +104,6 @@ $(DIST_DIR)${BINARY_NAME}_mac_x64:
$(SUBDIRTARGETS): $(SUBDIRS)
$(SUBDIRS): ; $(MAKE) -C $@ $(MAKECMDGOALS)

# only perform a release if a VERSION is defined
ifdef VERSION
tag:
# only tag on master branch!
$(BRANCH) | grep -e "^master$$" > /dev/null \
Expand All @@ -100,7 +117,3 @@ tag:
echo ""
echo "Don't forget to push the new tag!"
echo ""
else
tag:
$(error You have not defined a VERSION. Run "make $(MAKECMDGOALS) VERSION=1.2.3" to set a version)
endif
130 changes: 89 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ even as you fire up and shut down new _docker-compose_ projects.

## Requirements

We depend on at least Go 1.9. Also you need to have superuser privileges on your computer.
You need to have superuser privileges on your computer.

## Installation

Expand All @@ -27,13 +27,50 @@ But for resolving `*.docker` to `localhost` (i.e. `127.0.0.1` or `::1`), changes

### Linux

Fetch and build *reception*:
Install *reception*:

go get github.com/ninech/reception
git clone https://github.com/ninech/reception.git
make

Make sure that *reception* is responsible for resolving the `.docker` TLD:
Proceed according to your linux configuration:

sudo -s
#### Ubuntu 16.04/18.04

Instead of `.docker` as TLD it's the easiest to just use `.localhost` because that's already built-in in the `systemd-resolver.service`.

Now run *reception*:

sudo reception -tld localhost

Or install *reception* as systemd service:

sudo make install

Now try to go to http://reception.localhost.

#### Local dnsmasq resolver

If you use dnsmasq as your local resolver, add this line to your dnsmasq config:

address=/docker/127.0.0.1

It tells dnsmasq to resolve `*.docker` with the dnsserver listening at `127.0.0.1:53` (which will be *reception*).
Then restart dnsmasq:

service dnsmasq restart

And now run *reception*:

sudo reception

You should be able to http://reception.docker now.

#### Non-systemd linux

Check the content of `/etc/hosts`.
If it doesn't contain any nameservers pointing to `127.0.0.1`, `127.0.0.53` or `::1`, then this way of installation should work for you:

sudo -i
mkdir /etc/resolver
echo "nameserver ::1" > /etc/resolver/docker
echo "nameserver 127.0.0.1" >> /etc/resolver/docker
Expand All @@ -42,7 +79,7 @@ Now run *reception*:

sudo reception

Try to go to http://reception.docker.
Finally, try to go to http://reception.docker.

### macOS

Expand Down Expand Up @@ -71,7 +108,8 @@ Now try to go to http://reception.docker.

## Configuration

_reception_ is customizable to some extend. See `reception -h` for a complete list of configuration parameters.
_reception_ is customizable to some extend.
See `reception -h` for a complete list of configuration parameters.

$ reception -h
(c) 2017 Nine Internet Solutions AG
Expand Down Expand Up @@ -115,43 +153,49 @@ avoid port collisions across projects.

**Do**

version: '2'
services:
app:
image: nginx
depends_on: pgsql
ports:
- 80 <----- like this
pgsql:
image: postgresql
```yaml
version: '2'
services:
app:
image: nginx
depends_on: pgsql
ports:
- 80 <----- like this
pgsql:
image: postgresql
```

**Don't**

version: '2'
services:
app:
image: nginx
depends_on: pgsql
ports:
- 80:80 <----- and _not_ like this (local port)
pgsql:
image: postgresql
ports:
- 5432:5432 <----- and _not_ like this (unnecessary port)
```yaml
version: '2'
services:
app:
image: nginx
depends_on: pgsql
ports:
- 80:80 <----- and _not_ like this (local port)
pgsql:
image: postgresql
ports:
- 5432:5432 <----- and _not_ like this (unnecessary port)
```

### HTTP Port

In order to detect which port of you container "the http port" is, *reception* looks for the well-known ports
80, 8080 and 3000. You can override this behaviour by setting the label `reception.http-port` to a port of your choice:

version: '2'
services:
app:
image: special
labels:
reception.http-port: '1234' <--- like this
ports:
- 1234
```yaml
version: '2'
services:
app:
image: special
labels:
reception.http-port: '1234' <--- like this
ports:
- 1234
```

## Troubleshooting

Expand All @@ -161,23 +205,23 @@ You must run *reception* as privileged user (i.e. `root`) for it to be able to b

### _docker-compose_ projects can't start because of port conflicts

Most probably you assigned a fixed port mapping for any exposed ports. Look for something like the following:
Most probably you assigned a fixed port mapping for an exposed port. Look for something like the following:

```yml
version: 2
services:
app:
ports:
- "80:80"
- "8000:80" <---- like this
```

In the case above, you would just replace `"80:80"` with `80`.
In the case above, you would just replace `"8000:80"` with `80`.

### `reception.docker` does not resolve

First, check if *reception* is actually running.

Then see if `nslookup reception.docker` resolves to `127.0.0.1` or `::1`.
Then see if `nslookup reception.docker` resolves to `127.0.0.1` or `::1` (respectively `nslookup reception.localhost` on Ubuntu).

If it doesn't, please flush the DNS cache:

Expand All @@ -193,8 +237,12 @@ systemctl restart nscd

## Development

We depend on at least Go 1.11.

There is a `Makefile` with targets for any common task.

**Don't just use `go build`, as it will not bundle the resources!**

### Build

To build the project, run:
Expand All @@ -209,9 +257,9 @@ To run a snapshot of the project, run:

### Release

To cut a release of the project, run:
To cut a release of the project, adjust the `VERSION` file and run:

make release VERSION=2.3.4
make release

### Debug the Makefile

Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.0.0
14 changes: 14 additions & 0 deletions contrib/reception.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=This program shows all docker-compose projects that are running on a handy overview page.

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/reception -tld localhost
Restart=on-success
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
1 change: 0 additions & 1 deletion docker/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func (client *Client) Launch() error {
return err
}
}
return nil
}

// handles an event emitted by Docker
Expand Down
17 changes: 17 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module github.com/ninech/reception

require (
github.com/GeertJohan/go.incremental v0.0.0-20161212213043-1172aab96510 // indirect
github.com/GeertJohan/go.rice v0.0.0-20170420135705-c02ca9a983da
github.com/akavel/rsrc v0.0.0-20170831122431-f6a15ece2cfd // indirect
github.com/daaku/go.zipexe v0.0.0-20150329023125-a5fe2436ffcb // indirect
github.com/fsouza/go-dockerclient v1.3.1
github.com/jessevdk/go-flags v1.4.0 // indirect
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect
github.com/miekg/dns v1.0.13
github.com/tdewolff/minify v2.3.5+incompatible
github.com/tdewolff/parse v2.3.3+incompatible // indirect
github.com/tdewolff/test v0.0.0-20171106182207-265427085153 // indirect
golang.org/x/lint v0.0.0-20181011164241-5906bd5c48cd // indirect
golang.org/x/tools v0.0.0-20181013145246-13216ffa54f0 // indirect
)
Loading