sqlfluff / sqlfluff-online

An online SQL formatter, via SQLFluff.
https://online.sqlfluff.com/
34 stars 14 forks source link

Add Github Package's image for docker image #392

Closed fey closed 1 month ago

fey commented 2 months ago

From PR https://github.com/sqlfluff/sqlfluff-online/pull/390#issuecomment-2385539528

problem / context

A couple of days ago the site was down and it was unclear how soon it would be fixed. https://github.com/sqlfluff/sqlfluff-online/issues/389 So I thought it would be a good idea to embed the service on our site so that we could use it temporarily. But the Dockerfile was missing, so I added it. maybe someone else will want to deploy the service on their site, or the whole service will migrate to the Docker image

Proposed solution

Create a public Docker image on Github. It's free for public repositories. And it's a convenient way to deploy an application. Example from a fork https://github.com/hexlet-components/sqlfluff-online/pkgs/container/sqlfluff-online

 $ docker run --rm -e FLASK_ENV=development -e PORT=8081 -p 8081:8081 ghcr.io/hexlet-components/sqlfluff-online:latest  
# Go open http://localhost:8081

Github documentation https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-docker-registry https://docs.github.com/en/packages/learn-github-packages/introduction-to-github-packages

Once the public image is created, I, or someone else, can add in REAMDE instructions for the Docker image

nolanbconaway commented 1 month ago

Hi @fey ! I am looking into this now. From 10mins work it seems that this is a little more complicated than I thought; just publishing an image does not make it a whole lot easier to run the app locally as users need to know which ports are used, which envvars to override, etc.

I think it would help for me to understand the use case you are considering in greater depth! This app was not written so as to become infrastructure, since the python package itself would be better for that. So i wonder why a person would want to self host it. What are you trying to solve?

fey commented 1 month ago

Hi. We teaching students data analysis, programming and qa. Our students write queries that are linted using sqlfluff. They use the site to lint their SQL code before submitting it to Github. Because online.sqlfluff.com wasn't working for a while, students were experiencing pain when completing assignments, so we had to make a mirror. The idea is that anyone can deploy a copy of online sqlfluff locally or in the cloud

nolanbconaway commented 1 month ago

Hi. We teaching students data analysis, programming and qa. Our students write queries that are linted using sqlfluff. They use the site to lint their SQL code before submitting it to Github. Because online.sqlfluff.com wasn't working for a while, students were experiencing pain when completing assignments, so we had to make a mirror. The idea is that anyone can deploy a copy of online sqlfluff locally or in the cloud

Hi @fey ! I've thought this over and I think the issue for which you are solving is a little beyond the scope of the sqlfluff-online repo. It was never meant to be a primary means through which actual sql is linted, rather a test site so that new users can see examples of sqlfluff on their own queries without having to install anything.

Any "real" use of sqlfluff is much better done via local install of the package or using one of the CICD setups on GitHub.

You're of course welcome to continue using the site with your students! But if reliability is key, then i think it makes more sense for you to maintain a fork of the service; and that way you can brand the site, etc.