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

MySQL Support #2837

Merged
merged 93 commits into from
Dec 23, 2024
Merged

MySQL Support #2837

merged 93 commits into from
Dec 23, 2024

Conversation

ismail0234
Copy link
Contributor

@ismail0234 ismail0234 commented Nov 4, 2024

Describe your changes

MySQL support for Netbird. Still in draft stage. I have never used the “GO” language before, so if I have any mistakes you can help me to correct them.

Issue ticket number and link

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

@CLAassistant
Copy link

CLAassistant commented Nov 4, 2024

CLA assistant check
All committers have signed the CLA.

@ismail0234
Copy link
Contributor Author

I'm working on it, and from what I've seen, adding mysql support seems to be pretty straightforward. But I haven't tested it yet and I'm not sure if it will work, so it's still in draft stage. Can someone tell me how to compile and test on the server side?

@mlsmaycon
Copy link
Collaborator

Thanks for the submission @ismail0234. Can you enable github action tests for MySQL as well?

See the current ones here:

@mlsmaycon
Copy link
Collaborator

@bcmmbaga can you share how to add a testcontainer for MySQL?

@bcmmbaga
Copy link
Contributor

bcmmbaga commented Nov 4, 2024

@ismail0234 To add a MySQL test container, you will need to add MySQL support in the NewTestStoreFromSQL

func NewTestStoreFromSQL(ctx context.Context, filename string, dataDir string) (Store, func(), error) {

To spin up a new MySQL test container, you can follow the same approach we used for PostgreSQL

func CreatePGDB() (func(), error) {

@ismail0234
Copy link
Contributor Author

The “security/snyk” step seems to have failed but I can't see what caused it.

@bcmmbaga
Copy link
Contributor

bcmmbaga commented Nov 4, 2024

The “security/snyk” step seems to have failed but I can't see what caused it.

Go modules seem out of sync with the codebase. Could you run go mod tidy and push the changes?

@ismail0234
Copy link
Contributor Author

hmm, the result still seems to be the same.

@ismail0234
Copy link
Contributor Author

ismail0234 commented Nov 5, 2024

Is this part used for testing? Do I need to add mysql values?

store: [ 'sqlite', 'postgres' ]

if [ "${{ matrix.store }}" == "postgres" ]; then
echo "NETBIRD_STORE_ENGINE_POSTGRES_DSN=host=$(hostname -I | awk '{print $1}') user=netbird password=postgres dbname=netbird port=5432" >> $GITHUB_ENV
else
echo "NETBIRD_STORE_ENGINE_POSTGRES_DSN==" >> $GITHUB_ENV
fi

@ismail0234
Copy link
Contributor Author

@mlsmaycon @bcmmbaga @pascal-fischer Can you check the Pull Request to merge?

@ismail0234 ismail0234 closed this Dec 4, 2024
@ismail0234
Copy link
Contributor Author

If you want to merge PR, I reopened it. But if you don't want to merge, you can close or delete PR. @mlsmaycon

@ismail0234 ismail0234 reopened this Dec 17, 2024
@bcmmbaga
Copy link
Contributor

@ismail0234, could you please run the following commands and push the changes?

 go get -u github.com/containerd/containerd && go mod tidy 

@ismail0234
Copy link
Contributor Author

@ismail0234, could you please run the following commands and push the changes?

 go get -u github.com/containerd/containerd && go mod tidy 

The vulnerability appears to be in the go-jose module. The vulnerability has been fixed on version v4.0.1. Even if containerd is updated, the issue still seems to persist.

@bcmmbaga
Copy link
Contributor

The vulnerability appears to be in the go-jose module. The vulnerability has been fixed on version v4.0.1. Even if containerd is updated, the issue still seems to persist.

You can revert the changes since they broke the gRPC. However, the Snyk issue seems to be a false positive, as we don't import the go-jose module at all. You can confirm with:

go mod why -m github.com/go-jose/go-jose

I'll take a closer look into this as well

@ismail0234
Copy link
Contributor Author

The vulnerability appears to be in the go-jose module. The vulnerability has been fixed on version v4.0.1. Even if containerd is updated, the issue still seems to persist.

You can revert the changes since they broke the gRPC. However, the Snyk issue seems to be a false positive, as we don't import the go-jose module at all. You can confirm with:

go mod why -m github.com/go-jose/go-jose

I'll take a closer look into this as well

@bcmmbaga yes, it says the module is not in use.

@ismail0234
Copy link
Contributor Author

@bcmmbaga It seems that the module you mentioned is not used because it is a different module. But there is a “go-jose” module with a different name in the modules list.

netbird/go.mod

Line 228 in 37ad370

gopkg.in/square/go-jose.v2 v2.6.0 // indirect

This module appears to be in use.

image

@bcmmbaga bcmmbaga changed the base branch from main to feature/mysql-support December 23, 2024 09:48
@bcmmbaga bcmmbaga merged commit 215c904 into netbirdio:feature/mysql-support Dec 23, 2024
34 of 35 checks passed
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.

5 participants