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

Platform with multiple servers control #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

balakhonoff
Copy link
Contributor

Goal: create a convenient class to manage multiple VPN servers wrapped in the outline-vpn-api class, without worrying about servers that suddenly stop working and distributing users across servers. Additionally, there should be no need to administer databases (the service is completely stateless). After restarting the service, it should only gather up-to-date data on VPN servers, remove duplicate keys (keeping only the most recent one), and grant access to keys based on the username (only one key per user is available at all times).

Solution:
Two files have been added, which do not affect the core functionality but add a new capability to manage an array of servers, increasing the reliability of the system that remains operational even if any of the servers fail.

  1. File outline_vpn/platform.py - the Platform class allows creating an instance that manages multiple servers. The servers should be provided as three lists: servers (server names - arbitrary), apis (API URLs from the outline server), certs (certificates from the outline server).

This file describes methods for updating data from servers, creating new keys (on an arbitrary or explicitly specified server), deleting keys (without explicitly searching for the server on which the key is currently located), and adding or increasing user limits.

  1. File outline_vpn/example_platform.py - an example of using the Platform class. In this file:
  • Necessary values (server names, API URLs, certificates) are imported from the .env file.
  • An instance of the Platform class is created.
  • Test keys are created.
  • Limits are checked.
  • Limits are updated.
  • Users are deleted.

An example of the .env file looks as follows:

SERVER_1="server1"
CERT_1="xxx"
API_1="xxx"

SERVER_2="server2"
CERT_2="xxx"
API_2="xxx"

SERVER_3="server1"
CERT_3="xxx"
API_3="xxx"

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@jadolg jadolg self-requested a review July 21, 2023 07:13
@jadolg
Copy link
Owner

jadolg commented Jul 21, 2023

Hi @balakhonoff 👋
Thanks for contributing.
My thoughts about this right now are that even when it's very useful, I see it as a different project on top of the wrapper.
The objective of this lib is to create a simple abstraction on top of the outline manager API and nothing else.
This way we can have a real vanilla experience while building other projects with it.
I'd love to see this become a new lib but I'd rather not merge it with the current project.

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.

2 participants