mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a82f75cad | ||
|
|
805afd0d28 |
@@ -12,6 +12,7 @@ import (
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
"net/netip"
|
||||
"time"
|
||||
"uncloud/cmd/uncloud/caddy"
|
||||
"uncloud/internal/cli"
|
||||
"uncloud/internal/cli/client"
|
||||
"uncloud/internal/cli/config"
|
||||
@@ -138,12 +139,18 @@ func add(ctx context.Context, uncli *cli.CLI, remoteMachine cli.RemoteMachine, o
|
||||
return fmt.Errorf("create caddy deployment: %w", err)
|
||||
}
|
||||
|
||||
return progress.RunWithTitle(ctx, func(ctx context.Context) error {
|
||||
err = progress.RunWithTitle(ctx, func(ctx context.Context) error {
|
||||
if _, err = d.Run(ctx); err != nil {
|
||||
return fmt.Errorf("deploy caddy: %w", err)
|
||||
}
|
||||
return nil
|
||||
}, uncli.ProgressOut(), fmt.Sprintf("Deploying service %s", d.Spec.Name))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
return caddy.UpdateDomainRecords(ctx, machineClient, uncli.ProgressOut())
|
||||
}
|
||||
|
||||
func waitClusterInitialised(ctx context.Context, client *client.Client) error {
|
||||
|
||||
@@ -31,7 +31,6 @@ func (cli *Client) NewCaddyDeployment(image string, filter MachineFilter) (*Depl
|
||||
image = reference.FamiliarString(latest)
|
||||
}
|
||||
|
||||
// TODO: set restart policy to always. https://github.com/psviderski/uncloud/issues/26
|
||||
spec := api.ServiceSpec{
|
||||
Container: api.ContainerSpec{
|
||||
Command: []string{"caddy", "run", "-c", "/config/caddy.json", "--watch"},
|
||||
|
||||
@@ -541,10 +541,8 @@ func (m *Machine) InitCluster(ctx context.Context, req *pb.InitClusterRequest) (
|
||||
}
|
||||
publicIP, pubIPErr := network.GetPublicIP()
|
||||
// Ignore the error if failed to get the public IP using API services.
|
||||
if pubIPErr == nil {
|
||||
if !slices.Contains(ips, publicIP) {
|
||||
ips = append(ips, publicIP)
|
||||
}
|
||||
if pubIPErr == nil && !slices.Contains(ips, publicIP) {
|
||||
ips = append(ips, publicIP)
|
||||
}
|
||||
endpoints := make([]*pb.IPPort, len(ips))
|
||||
for i, addr := range ips {
|
||||
@@ -685,7 +683,7 @@ func (m *Machine) Token(_ context.Context, _ *emptypb.Empty) (*pb.TokenResponse,
|
||||
}
|
||||
publicIP, err := network.GetPublicIP()
|
||||
// Ignore the error if failed to get the public IP using API services.
|
||||
if err == nil {
|
||||
if err == nil && !slices.Contains(ips, publicIP) {
|
||||
ips = append(ips, publicIP)
|
||||
}
|
||||
endpoints := make([]netip.AddrPort, len(ips))
|
||||
|
||||
Reference in New Issue
Block a user