Skip to content

Charm application#21

Open
Ataku-B wants to merge 4 commits into
mainfrom
chraming
Open

Charm application#21
Ataku-B wants to merge 4 commits into
mainfrom
chraming

Conversation

@Ataku-B

@Ataku-B Ataku-B commented Jul 2, 2026

Copy link
Copy Markdown
Member

Done

  • Added necessary configuration for packing rock and charming application
  • Made tweaks to the codebase following the charming guide and applicaiton checklist

Notes / Rationale

  • I did not commit the artifacts created from packing the rock and creating the charm. I could commit those if needed as well.

QA

  • See that tests pass
  • Alternatively, check out this feature branch
  • Test the charm in accordance with the charming guide

Issue / Card

WD-36748

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds the packaging and deployment scaffolding needed to run products-api as a Rock + 12-factor (paas-charm) charm, and adjusts the app/migrations setup to work in that charm runtime.

Changes:

  • Add Rockcraft configuration (with explicit prime list) and a charm definition using the flask-framework extension.
  • Add a charm migration hook (migrate.sh) and update Alembic env resolution to rely on the Flask app’s configured DB URL.
  • Add gevent to support the existing Gunicorn --worker-class gevent entrypoint configuration.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
webapp/app.py Adds DB URL fallback to support charm-injected PostgreSQL connection string.
rockcraft.yaml Introduces Rockcraft config and overrides prime to include app + migrations assets.
requirements.txt Adds gevent dependency for the configured Gunicorn worker class.
migrations/env.py Resolves Alembic DB URL via Flask app config and updates the error message.
migrate.sh Adds paas-charm-compatible migration hook to run flask db upgrade.
charm/tox.ini Adds charm lint/format/static tox environments (plus unit/integration stanzas).
charm/src/charm.py Adds the charm entrypoint extending paas_charm.flask.Charm.
charm/requirements.txt Adds charm runtime dependencies (ops, paas-charm).
charm/pyproject.toml Adds tool configuration for ruff/codespell/pytest/coverage/pyright.
charm/charmcraft.yaml Defines the charm metadata and required PostgreSQL integration.
charm/.gitignore Ignores charm build artifacts, venvs, and fetched charm libs.

Comment thread charm/tox.ini
Comment on lines +10 to +13
[vars]
src_path = {tox_root}/src
;tests_path = {tox_root}/tests
all_path = {[vars]src_path}
Comment thread charm/pyproject.toml
Comment on lines +40 to +41
[tool.pyright]
include = ["src/**.py"]

@britneywwc britneywwc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we add a deploy.yaml action (similar to u.com here) to test that the rock / charm is packed and can be deployed as expected?

name: Pack

on:
pull_request:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note: remove before merging

Comment thread charm/charmcraft.yaml
optional: false
limit: 1

# Uncomment the integrations used by your application

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We can remove the commented chunk

Comment thread migrate.sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we summarise the comments for db upgrade to make it more readable?

Comment thread requirements.txt
SQLAlchemy-Utils>=0.41.2
Talisker>=0.16.0
gunicorn>=20.0.4
gevent>=23.9.1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this needed? We can also invoke gevent through gunicorn.gevent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants