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

v0.20.4 #2457

Merged
merged 15 commits into from
Jul 19, 2023
Merged

v0.20.4 #2457

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
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ body:
label: Version
description: What version are you running?
options:
- v0.20.4
- v0.20.3
- v0.20.2
- v0.20.1
Expand Down
71 changes: 6 additions & 65 deletions .github/workflows/branchtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,71 +39,12 @@ jobs:
echo branch does not exist
echo "netclientbranch=develop" >> $GITHUB_OUTPUT
fi

getserver:
runs-on: ubuntu-latest
needs: skip-check
if: ${{ needs.skip-check.outputs.skip != 'true' }}
outputs:
netmakerserver: ${{ steps.getserver.outputs.server }}
steps:
- name: setup ssh
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/id_devops
chmod 600 ~/.ssh/id_devops
cat >>~/.ssh/config <<END
Host *.clustercat.com
User root
IdentityFile ~/.ssh/id_devops
StrictHostKeyChecking no
END
env:
SSH_KEY: ${{ secrets.TESTING_SSH_KEY }}
- name: getserver
id: getserver
run: |
server=""
for arg in "branch1" "branch2" "branch3" "branch4" "branch5"; do
echo checking $arg
result=$( ssh root@server.${arg}.clustercat.com '~/branchtesting/check.sh')
echo $result
if [ "$result" == "pass" ]
then
server=$arg
echo $server >> /tmp/server
break
fi
done
echo server is $server
if [ "$server" == "" ]
then
echo server not set
exit 1
fi
echo "netmakerserver=${ server }" >> $GITHUB_OUTPUT
- name: save server name
uses: actions/upload-artifact@v3
with:
name: server
path: /tmp/ping
retention-days: 3

terraform:
needs: [getbranch, getserver]
uses: gravitl/devops/.github/workflows/terraform.yml@master
with:
netmakerbranch: ${{ github.head_ref }}
netclientbranch: ${{ needs.getbranch.outputs.netclientbranch }}
server: ${{ needs.getserver.outputs.netmakerserver }}
secrets: inherit


testbranch:
needs: [getbranch, terraform]
uses: gravitl/devops/.github/workflows/branchtest.yml@master
branchtest:
uses: gravitl/devops/.github/workflows/testdeploybranch.yml@master
needs: [getbranch, skip-check]
with:
netclientbranch: ${{ needs.getbranch.outputs.netclientbranch }}
netmakerbranch: ${{ github.head_ref }}
tag: ${{ github.run_id }}-${{ github.run_attempt }}
network: netmaker
secrets: inherit

secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/deletedroplets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
color: "#42f545"
username: "GitHub Bot"
message: "${{ github.repository }}: ${{ github.event.workflow_run.name }} on dashboard.${{ env.SERVER }}.clustercat.com was successful: droplets from this workflow (tag ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}) will be deleted in 15 min"
message: " ${{ github.repository }}:${{ github.event.workflow_run.name }}:PR ${{ env.pull_request }} was successful: droplets from this workflow (tag ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt}}) will be deleted in 15 min"
file: ./results/results.log
- name: delete droplets
if: success() || failure()
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
color: "#990000"
username: "GitHub Bot"
message: "${{ github.repository }}: ${{ github.event.workflow_run.name }} failed: droplets from this workflow (tag ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt}}) will be deleted in 3 hours"
message: " ${{ github.repository}}:${{ github.event.workflow_run.name }}:PR ${{ env.pull_request}} failed: droplets from this workflow (tag ${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}) will be deleted in 3 hours"
file: ./results/results.log
- name: discord error message
uses: appleboy/discord-action@master
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<p align="center">
<a href="https://github.com/gravitl/netmaker/releases">
<img src="https://img.shields.io/badge/Version-0.20.3-informational?style=flat-square" />
<img src="https://img.shields.io/badge/Version-0.20.4-informational?style=flat-square" />
</a>
<a href="https://hub.docker.com/r/gravitl/netmaker/tags">
<img src="https://img.shields.io/docker/pulls/gravitl/netmaker?label=downloads" />
Expand Down Expand Up @@ -47,18 +47,22 @@
| :heavy_check_mark: Mesh VPNs | :heavy_check_mark: Private DNS | :heavy_check_mark: Mac |
| :heavy_check_mark: Site-to-Site | :heavy_check_mark: Access Control Lists | :heavy_check_mark: Windows |

# Get Started in 5 Minutes
# Try Online

(For production-grade installations, visit the [Install Docs](https://netmaker.readthedocs.io/en/master/install.html).)
If you're just looking to use Netmaker, you can create an account for free at [netmaker.io](https://account.netmaker.io).

# Self-Hosted Quick Start

These are the instructions for deploying a Netmaker server on your own cloud VM as quickly as possible. For more detailed instructions, visit the [Install Docs](https://netmaker.readthedocs.io/en/master/install.html).

1. Get a cloud VM with Ubuntu 22.04 and a public IP.
2. Open ports 443, 80, and 51821-51830/udp on the VM firewall and in cloud security settings.
3. (optional) Prepare DNS - Set a wildcard subdomain in your DNS for Netmaker, e.g. *.netmaker.example.com
2. Open ports 443, 80, 3479, 8089 and 51821-51830/udp on the VM firewall and in cloud security settings.
3. (recommended) Prepare DNS - Set a wildcard subdomain in your DNS settings for Netmaker, e.g. *.netmaker.example.com, which points to your VM's pubic IP.
4. Run the script:

`sudo wget -qO /root/nm-quick.sh https://raw.githubusercontent.com/gravitl/netmaker/master/scripts/nm-quick.sh && sudo chmod +x /root/nm-quick.sh && sudo /root/nm-quick.sh`

This script gives you the option to deploy the Community or Enterprise version of Netmaker. If deploying Enterprise, you get a free account with a 50 node limit by default. It also gives you the option to use your own domain (recommended) or an auto-generated domain.
This script gives you the option to deploy the Community or Enterprise version of Netmaker. It also gives you the option to use your own domain (recommended) or an auto-generated domain.

<p float="left" align="middle">
<img src="https://raw.githubusercontent.com/gravitl/netmaker-docs/master/images/netmaker-github/readme.gif" />
Expand Down
2 changes: 1 addition & 1 deletion compose/docker-compose.netclient.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.4"
services:
netclient:
container_name: netclient
image: 'gravitl/netclient:v0.20.3'
image: 'gravitl/netclient:v0.20.4'
hostname: netmaker-1
network_mode: host
restart: on-failure
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type ServerConfig struct {
MetricsExporter string `yaml:"metrics_exporter"`
BasicAuth string `yaml:"basic_auth"`
LicenseValue string `yaml:"license_value"`
NetmakerAccountID string `yaml:"netmaker_account_id"`
NetmakerTenantID string `yaml:"netmaker_tenant_id"`
IsEE string `yaml:"is_ee"`
StunPort int `yaml:"stun_port"`
StunList string `yaml:"stun_list"`
Expand Down
2 changes: 1 addition & 1 deletion controllers/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
// Schemes: https
// BasePath: /
// Version: 0.20.3
// Version: 0.20.4
// Host: netmaker.io
//
// Consumes:
Expand Down
45 changes: 31 additions & 14 deletions controllers/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/gorilla/mux"
"github.com/gravitl/netmaker/logger"
"github.com/gravitl/netmaker/logic"
"github.com/gravitl/netmaker/logic/hostactions"
"github.com/gravitl/netmaker/models"
"github.com/gravitl/netmaker/mq"
"github.com/gravitl/netmaker/servercfg"
Expand Down Expand Up @@ -199,14 +198,16 @@ func updateHost(w http.ResponseWriter, r *http.Request) {
func deleteHost(w http.ResponseWriter, r *http.Request) {
var params = mux.Vars(r)
hostid := params["hostid"]
forceDelete := r.URL.Query().Get("force") == "true"

// confirm host exists
currHost, err := logic.GetHost(hostid)
if err != nil {
logger.Log(0, r.Header.Get("user"), "failed to delete a host:", err.Error())
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
return
}
if err = logic.RemoveHost(currHost); err != nil {
if err = logic.RemoveHost(currHost, forceDelete); err != nil {
logger.Log(0, r.Header.Get("user"), "failed to delete a host:", err.Error())
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
return
Expand Down Expand Up @@ -259,18 +260,14 @@ func addHostToNetwork(w http.ResponseWriter, r *http.Request) {
return
}
logger.Log(1, "added new node", newNode.ID.String(), "to host", currHost.Name)
hostactions.AddAction(models.HostUpdate{
Action: models.JoinHostToNetwork,
Host: *currHost,
Node: *newNode,
})
if servercfg.IsMessageQueueBackend() {
go func() {
mq.HostUpdate(&models.HostUpdate{
Action: models.RequestAck,
Action: models.JoinHostToNetwork,
Host: *currHost,
Node: *newNode,
})
}

mq.PublishPeerUpdate()
}()
logger.Log(2, r.Header.Get("user"), fmt.Sprintf("added host %s to network %s", currHost.Name, network))
w.WriteHeader(http.StatusOK)
}
Expand All @@ -291,6 +288,7 @@ func deleteHostFromNetwork(w http.ResponseWriter, r *http.Request) {
var params = mux.Vars(r)
hostid := params["hostid"]
network := params["network"]
forceDelete := r.URL.Query().Get("force") == "true"
if hostid == "" || network == "" {
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("hostid or network cannot be empty"), "badrequest"))
return
Expand All @@ -309,18 +307,37 @@ func deleteHostFromNetwork(w http.ResponseWriter, r *http.Request) {
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
return
}
if node.IsRelayed {
// cleanup node from relayednodes on relay node
relayNode, err := logic.GetNodeByID(node.RelayedBy)
if err == nil {
relayedNodes := []string{}
for _, relayedNodeID := range relayNode.RelayedNodes {
if relayedNodeID == node.ID.String() {
continue
}
relayedNodes = append(relayedNodes, relayedNodeID)
}
relayNode.RelayedNodes = relayedNodes
logic.UpsertNode(&relayNode)
}
}
if node.IsRelay {
// unset all the relayed nodes
logic.SetRelayedNodes(false, node.ID.String(), node.RelayedNodes)
}
node.Action = models.NODE_DELETE
node.PendingDelete = true
logger.Log(1, "deleting node", node.ID.String(), "from host", currHost.Name)
if err := logic.DeleteNode(node, false); err != nil {
if err := logic.DeleteNode(node, forceDelete); err != nil {
logic.ReturnErrorResponse(w, r, logic.FormatError(fmt.Errorf("failed to delete node"), "internal"))
return
}
// notify node change

runUpdates(node, false)
go func() { // notify of peer change
if err := mq.PublishPeerUpdate(); err != nil {
err = mq.PublishDeletedNodePeerUpdate(node)
if err != nil {
logger.Log(1, "error publishing peer update ", err.Error())
}
if err := mq.PublishDNSDelete(node, currHost); err != nil {
Expand Down
16 changes: 6 additions & 10 deletions controllers/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ func deleteNode(w http.ResponseWriter, r *http.Request) {
// get params
var params = mux.Vars(r)
var nodeid = params["nodeid"]
forceDelete := r.URL.Query().Get("force") == "true"
fromNode := r.Header.Get("requestfrom") == "node"
node, err := logic.GetNodeByID(nodeid)
if err != nil {
Expand Down Expand Up @@ -754,13 +755,13 @@ func deleteNode(w http.ResponseWriter, r *http.Request) {
relayNode.RelayedNodes = relayedNodes
logic.UpsertNode(&relayNode)
}

}
if node.IsRelay {
// unset all the relayed nodes
logic.SetRelayedNodes(false, node.ID.String(), node.RelayedNodes)
}
if err := logic.DeleteNode(&node, fromNode); err != nil {
purge := forceDelete || fromNode
if err := logic.DeleteNode(&node, purge); err != nil {
logic.ReturnErrorResponse(w, r, logic.FormatError(fmt.Errorf("failed to delete node"), "internal"))
return
}
Expand All @@ -770,25 +771,20 @@ func deleteNode(w http.ResponseWriter, r *http.Request) {
if !fromNode { // notify node change
runUpdates(&node, false)
}
go func(deletedNode *models.Node, fromNode bool) { // notify of peer change
go func() { // notify of peer change
var err error
if fromNode {
err = mq.PublishDeletedNodePeerUpdate(deletedNode)
} else {
err = mq.PublishPeerUpdate()
}
err = mq.PublishDeletedNodePeerUpdate(&node)
if err != nil {
logger.Log(1, "error publishing peer update ", err.Error())
}

host, err := logic.GetHost(node.HostID.String())
if err != nil {
logger.Log(1, "failed to retrieve host for node", node.ID.String(), err.Error())
}
if err := mq.PublishDNSDelete(&node, host); err != nil {
logger.Log(1, "error publishing dns update", err.Error())
}
}(&node, fromNode)
}()
}

func runUpdates(node *models.Node, ifaceDelta bool) {
Expand Down
6 changes: 3 additions & 3 deletions ee/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func AddLicenseHooks() {
// if license is not valid, server should terminate
func ValidateLicense() error {
licenseKeyValue := servercfg.GetLicenseKey()
netmakerAccountID := servercfg.GetNetmakerAccountID()
netmakerTenantID := servercfg.GetNetmakerTenantID()
logger.Log(0, "proceeding with Netmaker license validation...")
if len(licenseKeyValue) == 0 || len(netmakerAccountID) == 0 {
if len(licenseKeyValue) == 0 || len(netmakerTenantID) == 0 {
logger.FatalLog0(errValidation.Error())
}

Expand All @@ -65,7 +65,7 @@ func ValidateLicense() error {
}

licenseSecret := LicenseSecret{
AssociatedID: netmakerAccountID,
AssociatedID: netmakerTenantID,
Limits: getCurrentServerLimit(),
}

Expand Down
Loading