Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7df59dcf2a | |||
| 8053c63973 | |||
| bd2f05e922 | |||
| 78f3ba4318 | |||
| baf252ee0a | |||
| e5786be62b |
@@ -4,7 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
consul "github.com/hashicorp/consul/api"
|
consul "github.com/hashicorp/consul/api"
|
||||||
@@ -23,8 +22,6 @@ type Service struct {
|
|||||||
var ErrServiceUnavailable = fmt.Errorf("Service is unavailable")
|
var ErrServiceUnavailable = fmt.Errorf("Service is unavailable")
|
||||||
|
|
||||||
func NewService(serverAddr, appID, appName, ip, domain string, appPort int) (*Service, error) {
|
func NewService(serverAddr, appID, appName, ip, domain string, appPort int) (*Service, error) {
|
||||||
hostname, _ := os.Hostname()
|
|
||||||
fmt.Println("hostname:" + hostname)
|
|
||||||
s := new(Service)
|
s := new(Service)
|
||||||
s.AppID = appID
|
s.AppID = appID
|
||||||
s.Name = appName
|
s.Name = appName
|
||||||
@@ -111,7 +108,8 @@ func (s *Service) check() (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) getTags() []string {
|
func (s *Service) getTags() []string {
|
||||||
fullName := fmt.Sprintf("%s_%s", s.Name, s.AppID)
|
fullName := fmt.Sprintf("%s-%s", s.Name, s.AppID)
|
||||||
|
bFullAddr := fmt.Sprintf("http://%s:%d/", s.IP, s.Port) // FIXME: declare one once - dont need to refresh....
|
||||||
|
|
||||||
tags := []string{
|
tags := []string{
|
||||||
"traefik.enable=true",
|
"traefik.enable=true",
|
||||||
@@ -122,8 +120,8 @@ func (s *Service) getTags() []string {
|
|||||||
"traefik.http.routers." + s.Name + ".tls=true",
|
"traefik.http.routers." + s.Name + ".tls=true",
|
||||||
// "traefik.http.services." + s.Name + ".loadbalancer.server.scheme=http",
|
// "traefik.http.services." + s.Name + ".loadbalancer.server.scheme=http",
|
||||||
// "traefik.http.services." + s.Name + ".loadbalancer.server.port=" + port,
|
// "traefik.http.services." + s.Name + ".loadbalancer.server.port=" + port,
|
||||||
"traefik.http.services." + s.Name + ".loadbalancer.servers." + fullName + "=" + s.Address,
|
|
||||||
"traefik.http.services." + s.Name + ".loadbalancer.passhostheader=false",
|
"traefik.http.services." + s.Name + ".loadbalancer.passhostheader=false",
|
||||||
|
"traefik.http.services." + s.Name + ".loadbalancer.server.url=" + bFullAddr,
|
||||||
"traefik.http.middlewares.compress.compress=true",
|
"traefik.http.middlewares.compress.compress=true",
|
||||||
"traefik.http.middlewares.requestid.plugin.requestid.headerName=X-Request-ID",
|
"traefik.http.middlewares.requestid.plugin.requestid.headerName=X-Request-ID",
|
||||||
// "traefik.http.services." + fullName + ".loadbalancer.healthcheck.path=/health",
|
// "traefik.http.services." + fullName + ".loadbalancer.healthcheck.path=/health",
|
||||||
|
|||||||
7
push-tag.sh
Executable file
7
push-tag.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
git tag -d dev
|
||||||
|
git push origin develop
|
||||||
|
git tag dev
|
||||||
|
git push origin dev --force
|
||||||
|
|
||||||
Reference in New Issue
Block a user