Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Remap ports to the non-conflicting range #844

Merged
merged 16 commits into from
Aug 17, 2022
Merged

Remap ports to the non-conflicting range #844

merged 16 commits into from
Aug 17, 2022

Conversation

dhruvkb
Copy link
Member

@dhruvkb dhruvkb commented Aug 3, 2022

Fixes

Addresses WordPress/openverse#200

Description

This PR

  • removes binding for ports that are only used for internal communication
  • changes port mappings to ports in the 502xx range to prevent any conflicts with services running on the host
  • updates documentation and tests to keep up with the changes
  • fixes some small side issues along the way
    • removing unused settings
    • using env vars in the run.sh entrypoint code and aligning it with the justfile
    • using the _api-up recipe in more places
    • converting the NGINX conf into a template to use env vars

Testing Instructions

  1. Check out the PR and run the dev server.
  2. Visit some endpoints that can help gauge the communication between processes e.g.
    • the stats endpoint, to test ES and cache
    • the thumbnails endpoint, to test the thumbnails service

Apart from this, a passing CI is pretty good proof of inter-process communication working normally.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@dhruvkb dhruvkb added 🟨 priority: medium Not blocking but should be addressed soon ✨ goal: improvement Improvement to an existing user-facing feature 🤖 aspect: dx Concerns developers' experience with the codebase labels Aug 3, 2022
@github-actions
Copy link

github-actions bot commented Aug 3, 2022

API Developer Docs Preview: Ready

https://wordpress.github.io/openverse-api/_preview/844

Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again.

You can check the GitHub pages deployment action list to see the current status of the deployments.

@dhruvkb dhruvkb marked this pull request as ready for review August 4, 2022 08:52
@dhruvkb dhruvkb requested a review from a team as a code owner August 4, 2022 08:52
Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM! Tested fine locally. Only one of the suggestions I'm strong-ish on is mapping the Postgres and Redis ports. Otherwise this is great.

Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM!

@dhruvkb
Copy link
Member Author

dhruvkb commented Aug 9, 2022

@obulat could you please review the PR when you have some time? Thanks!

@krysal
Copy link
Member

krysal commented Aug 9, 2022

@dhruvkb After Olga's review, be sure to merge this PR after the v2.5.10 is cut, please. This is looking like a non-trivial change.

@sarayourfriend
Copy link
Contributor

sarayourfriend commented Aug 9, 2022

Good point @krysal. Should just hold off on merging this at all until the ES situation is resolved? We sort of agreed to not merge anything that wasn't directly related to it. We did merge some other PRs I guess though, but they were not modifying the API code... 🤔

@dhruvkb
Copy link
Member Author

dhruvkb commented Aug 10, 2022

We did agree to no merge anything unrelated to ES but my interpretation was to not touch the ES-related bits. I can definitely hold off on merging this but this only affects the dev setup, there is no change to the code itself.

I'll wait for the v2.5.10 to be cut before merging and block it till then.

@dhruvkb dhruvkb added the ⛔ status: blocked Blocked & therefore, not ready for work label Aug 10, 2022
@sarayourfriend
Copy link
Contributor

We did agree to no merge anything unrelated to ES but my interpretation was to not touch the ES-related bits. I can definitely hold off on merging this but this only affects the dev setup, there is no change to the code itself.

Sure. Part of the issue is that we don't know what effects ES 🙂 At least that is one of the fundamental take-aways for myself over the last three months.

This is probably fine, so yeah, blocking until we have the current release cut with the changes we explicitly want to make seems like a good compromise to me. I personally do want this PR in sooner than later because the problem is a thorn in my side. I appreciate you working on it!

@dhruvkb dhruvkb removed the ⛔ status: blocked Blocked & therefore, not ready for work label Aug 11, 2022
@dhruvkb
Copy link
Member Author

dhruvkb commented Aug 15, 2022

@obulat could you please review this? I am aiming to merge this since 2.5.10 has been cut and deployed to production.

Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

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

Looks and works great!

Comment on lines +162 to +181
name: Check for API consumer docs
runs-on: ubuntu-latest
needs:
- build-images
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup just
uses: extractions/setup-just@v1

- name: Download all images
uses: actions/download-artifact@v2
with:
path: /tmp

- name: Load all images
run: |
docker load --input /tmp/api/api.tar
docker load --input /tmp/ingestion_server/ingestion_server.tar
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this is possible with GHA, but it would be really cool to have this as a set of steps that we could just reference as a precursor to specific tasks! Since this does appear to be reused elsewhere in this file.

Copy link
Contributor

@sarayourfriend sarayourfriend Aug 16, 2022

Choose a reason for hiding this comment

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

It is possible using YAML anchors but actionlint does not support them yet: rhysd/actionlint#133

It's also possible with composite actions as we use in the frontend repository.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🤖 aspect: dx Concerns developers' experience with the codebase ✨ goal: improvement Improvement to an existing user-facing feature 🟨 priority: medium Not blocking but should be addressed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants