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

Dockerfile should build rules-engine #116

Open
9 tasks
thadk opened this issue Dec 1, 2023 · 3 comments
Open
9 tasks

Dockerfile should build rules-engine #116

thadk opened this issue Dec 1, 2023 · 3 comments
Labels
good first issue Good for newcomers

Comments

@thadk
Copy link
Member

thadk commented Dec 1, 2023

Right now the web app deployment only deploys an obsolete no-dependency python rules-engine file.
With the newest version of the Rules Engine in the repository, it is using a python package wheel (whl) file which needs to be built on every deployment.

The whl file is already getting built for use in the unit tests. The test is committed and passing.

But we can't use the Rules Engine whl file yet in the browser, and we'd like to. You can help.

We don't want to check in the whl file, but to build it "just-in-time" at the key places. There is a reference example to help you start. It runs whenever we do npm run test app/utils/pyodide.test.ts

Dockerfile build of the Python whl

  • Practice with local deployment of Docker first but after you get comfortable, instead of mv Dockerfile ./heat-stack as it instructs, try moving it to the root of the project.
  • Modify the heat-stack Dockerfile in a way so the ../rules-engine folder can do a build.
    • You need to figure out how to get the rules-engine folder into the built docker image.
  • In the Dockerfile, add a line to run the equivalent of these build commands that are running before vitest in the other package.json example:
    "test": "cd ../rules-engine && python3 -m venv venv && . venv/bin/activate && pip install -q build && python3 -m build && cd ../heat-stack && vitest",
  • Copy the generated file from rules-engine/dist/rules_engine-*-py3-none-any.whl
    • to heat-stack/public/pyodide-env

Optional: Package.json enable npm run dev to build & copy the whl

  • As a bonus task, modify the package.json dev line to build the whl just in time and place it in the same folder.
  • add the built file to .gitignore

Fix Github Actions to match

  • Fork the repository into your GitHub account so you can do tests of Github Actions silently.
  • Ask for the flyio staging deploy key for your GHA tests. Put the key in secrets as the documentation describes in step 5.
  • Instead of moving the Dockerfile and .dockerignore to . which is currently ./heat-stack move it to the project root at
    mv ./other/Dockerfile ./Dockerfile
    mv ./other/.dockerignore ./.dockerignore
@thadk thadk added the good first issue Good for newcomers label Dec 1, 2023
@zganger
Copy link

zganger commented Jan 17, 2024

I'm looking to onboard on this project and I have experience in python and in automation. I could take this one.

@thadk
Copy link
Member Author

thadk commented Feb 4, 2024

Hi @zganger, thanks for that note and welcome! Let me know what parts sound interesting.

I think Greg (@thatoldplatitude ) from the Rules Engine python team started on the Dockerfile part of this in #146 . @thatoldplatitude if you could compare and contrast your PR to what is described above that would be helpful.

I would like to pursue this issue as a subgroup and would be happy to set up non-tuesday night meeting(s) this next week or answer any questions on moving forward for the tasks above.

@thatoldplatitude
Copy link
Collaborator

Just getting to these tags.
We could for sure setup a non-tuesday meet -- sry wasn't available much this week.
But there are for sure a few ways to go about this. I assumed a few things:

  • We'd be keeping the heat-stack & rules-engine workflow files separate (not needed, just did cause they are currently)
  • Not moving the Dockerfile from the root heat-stack
  • Using the pyodide-lock.json for pyodide imports(no changes I did impacted this)

But if we want to have separate meet, it may be easier for us to review options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants