-
Notifications
You must be signed in to change notification settings - Fork 652
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
feat(server): support socket path in server config #389
feat(server): support socket path in server config #389
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl looks good to me! want to create another copy of mysql or postgres server test suite that uses an environment variable for the socket path to use?
it would look pretty similar to https://github.com/GoogleChrome/lighthouse-ci/blob/master/packages/server/test/mysql-server.test.js just with your new sqlSocketPath
option
@patrickhulce thank you for the suggestions! Will address the comments and add tests |
365619c
to
ffe5500
Compare
@patrickhulce maybe you have a bit more context regarding how to use the |
Well we'll need to start another copy of mysql that exposes the socket path, right now it's just running in a docker container on port 33306, so that socket file won't exist. Looks like it's not too bad though https://superuser.com/questions/1411402/how-to-expose-linux-socket-file-from-docker-container-mysql-mariadb-etc-to So steps...
|
885a79b
to
79fb77a
Compare
79fb77a
to
7f7954e
Compare
.github/workflows/ci.yml
Outdated
@@ -74,12 +89,17 @@ jobs: | |||
echo "::set-env name=CHROME_PATH::$(which google-chrome-stable)" | |||
echo "::set-env name=POSTGRES_DB_URL::postgres://postgres:postgres@localhost/lighthouse_ci_test" | |||
echo "::set-env name=MYSQL_DB_URL::mysql://root:[email protected]:33306/lighthouse_ci_test" | |||
echo "::set-env name=MYSQL_SOCKET_PATH::/mnt/mysqld.sock" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi @MaximeHeckel you might want to create subdirs so the docker mount doesn't try to clobber an existing directory with the mount I don't think setting /mnt
for both postgres and mysql will work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry this is such a pain to debug 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you might want to create subdirs so the docker mount doesn't try to clobber an existing directory
Yeah ran into that issue originally with /tmp
sorry this is such a pain to debug 😅
and haha no worries I'm used to use gh action and spending hours of trial and error until a workflow works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way wit gh actions to create the directories before the service starts? I believe the directories of the host need to be present before the service start right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm I'm not sure to be honest. I would assume there should be but I haven't tried before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a bit of investigation yesterday night, it doesn't look like it's possible sadly. (Couldn't find a lot of documentations around volumes, tried to work around it but didn't find any satisfying solution to this)
What we can do maybe is use another path than /mnt
? Do you have any suggestions? (I tried /tmp
as well but yarn
wouldn't be able to successfully run after putting the sockets there)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you tried using the workspace dir yet? something like ${{ github.workspace }}/mysql:/var/run/mysqld
? we just need it to be predictable and accessible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just gave it a try, but like in the previous attempt the mysqlsocket
service doesn't seem to be able to start: https://github.com/GoogleChrome/lighthouse-ci/pull/389/checks?check_run_id=919336503
dc2b2cf
to
62574f7
Compare
Oof, yeah this is really rough @MaximeHeckel I'm about to give up as well I'm inclined to just skip the test here at this point since there's not explicit configuration involved if things are working on your end. sockets through docker just seem rough :/ leave the test file in play at least and maybe I'll play around with github actions some more on the subject later. just remove the environment variable for now in the github actions config I guess |
@googlebot I consent. |
yeah not an easy one (funny thing is that I used to work for Docker, and I remember struggling as much back then, seems that things haven't improved)
Will do that right now The tests were passing and locally I didn't have any issues
|
62574f7
to
fa6dd16
Compare
fa6dd16
to
8a7d195
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait you got it working!? That's amazing! Ignore my removal comment if you fixed it I thought we were stuck in failing limbo :)
thank you very much for your effort here! 🎉
happy to do it in a followup though if you're just done with this PR 😆
Oh sorry, I might have caused some confusion here:
But like we investigated yesterday, we couldn't get it to work by mounting a volume in As it stands now this PR has the tests for both mysql and postgres socket path but they are just not running because like you suggested I removed the environment variable for their respective socket paths and thus the tests are skipped. |
Ah ok gotcha 👍 |
Fixes #385
sqlSocketPath
option support in the configsqlSocketPath
indocs/configuration.md
As mentioned in the ticket, my team and I were looking to set up lighthouse-ci server on Google Cloud Run (serverless containers) with a Google Cloud SQL database (Postgres) and our only possibility to link the two was to use a socket path instead of a connection URL.
Let me know what you think of this config, there's probably a few things that still need to be done or validated in terms of how you want the config to look like.
Also @patrickhulce mentioned that testing might be quite hard for this one, so I'm looking for any proposal on how I could tackle this 😄