Skip to content

Peer configuration management#69

Merged
braginini merged 16 commits intomainfrom
peer-configuration-management
Jul 30, 2021
Merged

Peer configuration management#69
braginini merged 16 commits intomainfrom
peer-configuration-management

Conversation

@braginini
Copy link
Copy Markdown
Collaborator

No description provided.

@braginini braginini marked this pull request as ready for review July 27, 2021 14:06
@braginini braginini requested review from andpar83 and mlsmaycon July 27, 2021 14:06
andpar83
andpar83 previously approved these changes Jul 28, 2021
Comment thread management/server/file_store.go Outdated
if peer.AccountId == accountId {
peers = append(peers, peer)
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you move peers outside of account? It's ok for now but previous version was better

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it to make it a bit more explicit and clearly separate the Account entity from Peer in the store (so that they are handled separately).
But I agree it looked better before, so I've changed it back and removed a couple of store methods


account, accountFound := s.Accounts[accountId]
if !accountFound {
return nil, status.Errorf(codes.Internal, "account not found")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With Go, this function doesn't make a lot of sense because every call to it is exact function implementation anyway. Only error message is standard

	account, err := s.GetAccount(accountId)
	if err != nil {
		return nil, err
	}

	return account, nil

Copy link
Copy Markdown
Collaborator Author

@braginini braginini Jul 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with return s.GetAccount(accountId)

Comment thread management/cmd/management.go Outdated
func init() {
mgmtCmd.Flags().IntVar(&mgmtPort, "port", 33073, "server port to listen on")
mgmtCmd.Flags().StringVar(&mgmtDataDir, "datadir", "/var/lib/wiretrustee/", "server data directory location")
mgmtCmd.Flags().StringVar(&mgmtHostsConfig, "hosts-config", "/etc/wiretrustee/hosts-config.json", "Wiretrustee system hosts config (STUN, TURN, Signal, etc). These will be advertised to peers ")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't go with a config file only for hosts. A single config file with all the parameters makes more sense and follows more the standard of services we see, like MySQL, Apache, and Nginx.

The tricky part is to balance what you have in the config file and the flags you are providing at runtime, which should take precedence over the configuration from the file. e.g., port and letsencrypt-domain.

For hosts configuration, I understand the issue is the way we are providing them, but the way it is presented in the JSON file is not friendly and we could use the URL scheme to indicate TCP and UDP protocols. This would allow us to keep the scheme of the CLI when running the init command.

An improvement for making it more flexible to run in containers is to support configs provided by environment variables.

@braginini braginini merged commit 2c2c1e1 into main Jul 30, 2021
@braginini braginini deleted the peer-configuration-management branch July 30, 2021 15:46
pulsastrix pushed a commit to pulsastrix/netbird that referenced this pull request Dec 24, 2023
* feature: add config properties to the SyncResponse of the management gRpc service

* fix: lint errors

* chore: modify management protocol according to the review notes

* fix: management proto fields sequence

* feature: add proper peer configuration to be synced

* chore: minor changes

* feature: finalize peer config management

* fix: lint errors

* feature: add management server config file

* refactor: extract hosts-config to a separate file

* refactor: review notes applied to correct file_store usage

* refactor: extract management service configuration to a file

* refactor: simplify management config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend Management Service to distribute Peer configurations (Wireguard configurations)

3 participants