Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated build to be compatible with Go 1.12 #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1 AS build-env
FROM arm32v7/golang:1.12 AS build-env

WORKDIR /go/src/github.com/uxbh/ztdns
WORKDIR /go/src/github.com/davidwatkins/ztdns
# Add source
COPY . .

Expand Down
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ If you prefer the traditional installation route:
If you do not want to store your API access token in the configuration file you can also run the
server with the `env` command: `env 'ZTDNS_ZT.API=<<APIToken>>' ./ztdns server`
4. Run `ztdns mkconfig` to generate a sample configuration file.
5. Add your API access token, Network names and IDs, and interface name to the configuration.
5. Add your API access token, Network names and IDs, and interface name to the configuration. Make sure you call ifconfig to determine your zerotier interface name. It won't always be zt0.
6. Start the server using `ztdns server`.
7. Add a DNS entry in your ZeroTier members pointing to the member running ztdns.

Expand All @@ -41,6 +41,51 @@ dig @serveraddress member.domain.zt AAAA
ping member.domain.zt
```

### Service

If you want to create a service so this starts on boot for Ubuntu, first add a bash script which spins up the server. I called mine `start-ztdns-server`:

```bash
#!/bin/sh
/path/to/ztdns server
```

Then add `ztdns.service` to `/etc/systemd/system/`. Make sure whatever you set `WorkingDirectory` to contains the .ztdns.toml configuration file.

```bash
[Unit]
Description=Zerotier DNS Server
[Service]
User=<user_name>
# The configuration file application.properties should be here:
#change this to your workspace
WorkingDirectory=/path/containing/ztdns_config/
#path to executable.
#executable is a bash script which calls jar file
ExecStart=/path/to/start-ztdns-server
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
```

Then run systemctl enable and start:

```bash
sudo systemctl daemon-reload
sudo systemctl enable ztdns.service
sudo systemctl start ztdns.service
```

If you want to stop the service

```bash
sudo systemctl stop ztdns.service
sudo systemctl disable ztdns.service
```

### Docker

If you prefer to run the server with Docker:
Expand Down
2 changes: 1 addition & 1 deletion cmd/mkconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package cmd
import (
"os"

log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"net"
"time"

log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/uxbh/ztdns/dnssrv"
"github.com/uxbh/ztdns/ztapi"
"github.com/davidwatkins/ztdns/dnssrv"
"github.com/davidwatkins/ztdns/ztapi"
)

// serverCmd represents the server command
Expand Down
2 changes: 1 addition & 1 deletion dnssrv/dnssrv.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net"
"time"

log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/miekg/dns"
)

Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
version: '3'
version: '2'
services:
ztdns:
build: .
restart: always
ports:
- "5356:53/udp"
volumes:
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

package main

import "github.com/uxbh/ztdns/cmd"
import "github.com/davidwatkins/ztdns/cmd"

func main() {
cmd.Execute()
Expand Down