Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

waveywaves
Copy link
Contributor

@waveywaves waveywaves commented Nov 11, 2022

Pull Request

Related discussion (was created as an issue initially)

https://github.com/meilisearch/meilisearch/discussions/2883

What does this PR do?

This PR adds gha workflows to create preview environments on every PR. This workflow also posts the preview url as a comment on the PR.
This PR created against my fork of meilisearch demonstrates how this change behaves.

In the demo preview you can run the meilisearch binary built from the PR and can access meilisearch running from the PR by adding /meilisearch to the url of the PR.

eg: I go to the demo preview at the URL https://app.uffizzi.com/github.com/waveywaves/meilisearch/pull/2, run meilisearch in the terminal. I can access this running instance of meilisearch in the preview env fromhttps://pr-2-deployment-7396-meilisearch.app.uffizzi.com/meilisearch

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

@curquiza
Copy link
Member

Hello @waveywaves thanks a lot for this PR

I will review as soon as I can. We have a lot to do for the moment, so it can takes time, sorry in advance for this.
So my questions will arrive later 😄

Thanks again!

@curquiza curquiza added the tooling Not directly project related, like Docker, Homebrew... label Nov 14, 2022
@waveywaves waveywaves force-pushed the uffizzi branch 2 times, most recently from 654a5aa to 8e2a1ba Compare December 6, 2022 17:52
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

Hello @waveywaves,
Sorry again for the time I took to review

I have multiples questions

  • when I click on the preview I have "no such file or directory" error. I guess it's because I took too much time to review 😅

Capture d’écran 2022-12-21 à 18 50 16

  • What should I activate to have the same comment you got in your PR? A uffizi integration?
  • does it mean a new image and so a new comment will be created for each commit pushed? Can't we just have a single comment, and the provided container is updated by keeping the same link?

Thanks again for your time, I'm trying to check if it will concretely meet the needs of the team 😊

workflows:
- "Build PR Image"
types:
- completed
Copy link
Member

Choose a reason for hiding this comment

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

Since you need the previous workflow to be completed, can't we make them in the same workflow instead? The cache-compose-file could only start when build-pr-image is done.
It complexity to have two separated files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is part of the two stage workflow. Conisdering this question comes up a lot, we have written a blog post about it !

@waveywaves waveywaves force-pushed the uffizzi branch 2 times, most recently from beef775 to 37f07fb Compare December 23, 2022 12:28
@waveywaves
Copy link
Contributor Author

@curquiza https://app.uffizzi.com/github.com/waveywaves/meilisearch/pull/2 check this link for the updated preview from the PR!

@waveywaves
Copy link
Contributor Author

Happy New Year 2023 team ! :)

@curquiza I have updated the PR, let me know what you think.

@curquiza
Copy link
Member

curquiza commented Jan 12, 2023

Hello @waveywaves

Happy new year as well!

If I'm correct you did not answer my questions

  • What should I activate to have the same comment you got in your PR? A uffizi integration?

  • does it mean a new image and so a new comment will be created for each commit pushed? Can't we just have a single comment, and the provided container is updated by keeping the same link?

@waveywaves
Copy link
Contributor Author

@curquiza sorry looks like I missed them

What should I activate to have the same comment you got in your PR? A uffizi integration?

The merge and run of the github workflow will create an account for the org automatically. We cannot get the same comment in this PR because that comment is generated by the uffizzi-deploy step, and for it to run it needs to be in the default branch of the repo (main branch). Check out this article to learn about why the workflow is written the way it is.

does it mean a new image and so a new comment will be created for each commit pushed? Can't we just have a single comment, and the provided container is updated by keeping the same link?

New image will be pushed and the old comment will be updated but the link for the PR preview will stay the same. It will look like https://app.uffizzi.com/github.com/meilisearch/meilisearch/pull/

After this PR is merged, I will open a test PR to this repo to see if the previews are working as expected.

@curquiza
Copy link
Member

Also, I'm not able to reach Meilisearch:

curl -X GET 'https://pr-2-deployment-7396-meilisearch.app.uffizzi.com/meilisearch'

<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

Do I miss something?

@waveywaves
Copy link
Contributor Author

@curquiza app.uffizzi.com/github.com/waveywaves/meilisearch/pull/2 is a dynamic link which points to the current working preview, the link you tried reaching is an older preview looks like

@curquiza
Copy link
Member

Thanks @waveywaves
Once I've made Meilisearch run inside the container, I would like to reach Meilisearch outside the container, via an HTTP request. How can I do this?

@waveywaves
Copy link
Contributor Author

@curquiza

Once I've made Meilisearch run inside the container, I would like to reach Meilisearch outside the container, via an HTTP request. How can I do this?

Open a tab, run the meilisearch command in the container. It will start listening on port 7700
app.uffizzi.com/github.com/waveywaves/meilisearch/pull/2

Then, use app.uffizzi.com/github.com/waveywaves/meilisearch/pull/2/meilisearch which will forward all requests to the port 7700 of the container.

@curquiza
Copy link
Member

curquiza commented Jan 12, 2023

The problem with the https://app.uffizzi.com/github.com/waveywaves/meilisearch/pull/2/meilisearch URL is I definitely reach Meilisearch (I can see it in the log) but the wrong way.
I get

[2023-01-12T13:37:34Z INFO  actix_web::middleware::logger] 127.0.0.1 "GET /meilisearch/stats HTTP/1.0" 404 0 "https://app.uffizzi.com/github.com/waveywaves/meilisearch/pull/2/meilisearch/stats" "PostmanRuntime/7.30.0" 0.000245

I should see GET /stats

@waveywaves
Copy link
Contributor Author

@curquiza I understand, I'll fix this

@waveywaves waveywaves force-pushed the uffizzi branch 2 times, most recently from 6028d46 to dba5a4b Compare January 12, 2023 20:35
@waveywaves
Copy link
Contributor Author

waveywaves commented Jan 12, 2023

@curquiza the url rewrite in nginx is fixed now. I tested and am getting the following log on the terminal. I tested it with running meilisearch at https://pr-2-deployment-9614-meilisearch.app.uffizzi.com/ first and then going to https://app.uffizzi.com/github.com/waveywaves/meilisearch/pull/2/meilisearch/stats URL. I am also getting an expected error
which I have captured in the image below.

[2023-01-12T21:01:55Z INFO  actix_web::middleware::logger] 127.0.0.1 "GET /stats HTTP/1.0" 401 221 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0" 0.000393

image

Let me know if this works for you.

@waveywaves
Copy link
Contributor Author

@curquiza The preview has been fixed now, let me know what you think !

@curquiza
Copy link
Member

Thanks @waveywaves it is now work.
I also so you set a master key by default named dev. This is something we expect not be present if possible (no master key at all is ok), but I guess it's only about details

Thank you so much for your time and answering our questions. I will now discuss with the team since the prototype is available, to know if this is something we want to integrate now or not 😊

FROM uffizzi/ttyd:alpine

ENV MEILI_HTTP_ADDR 0.0.0.0:7700
ENV MEILI_SERVER_PROVIDER docker
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ENV MEILI_SERVER_PROVIDER docker
ENV MEILI_SERVER_PROVIDER docker
ENV MEILI_NO_ANALYTICS

Copy link
Member

Choose a reason for hiding this comment

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

Hey @waveywaves and @curquiza 👋

I'm just passing by to add the MEILI_NO_ANALYTICS so we don't forget it 🪄

Copy link
Contributor Author

@waveywaves waveywaves Jan 30, 2023

Choose a reason for hiding this comment

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

@gmourier I have updated the PR, the preview will get updated as well.

@waveywaves
Copy link
Contributor Author

I also see you set a master key by default named dev. This is something we expect not be present if possible (no master key at all is ok), but I guess it's only about details

@curquiza Is it preferrable to remove the master key then ?

@curquiza
Copy link
Member

@curquiza Is it preferrable to remove the master key then ?

yes

@waveywaves
Copy link
Contributor Author

@curquiza done !

Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

Let's try this!
thanks @waveywaves for your patience and your help!

bors merge

@bors
Copy link
Contributor

bors bot commented Feb 2, 2023

🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

@curquiza curquiza modified the milestones: v1.0.0, v1.1.0 Feb 2, 2023
@curquiza
Copy link
Member

curquiza commented Feb 2, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented Feb 2, 2023

Already running a review

@bors
Copy link
Contributor

bors bot commented Feb 2, 2023

Build succeeded:

@bors bors bot merged commit 734a9ec into meilisearch:main Feb 2, 2023
@meili-bot meili-bot added the v1.1.0 PRs/issues solved in v1.1.0 released on 2023-04-03 label Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling Not directly project related, like Docker, Homebrew... v1.1.0 PRs/issues solved in v1.1.0 released on 2023-04-03
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants