Skip to content

Commit

Permalink
Merge changes from topic "myfixes"
Browse files Browse the repository at this point in the history
* changes:
  Add bulk delete API
  Update project goals in README
  Fix docker-compose manifest
  • Loading branch information
jumpojoy authored and Gerrit Code Review committed Oct 8, 2024
2 parents 2550787 + 6219d7a commit b1a20df
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 12 deletions.
46 changes: 37 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,38 @@ why

Need a reference application which is:
- as minimal as possible re consumed resources
- touches as much of cloud services while created or used
- involves many cloud services while created or used
- can be used in validation of user workloads surviving cloud LCM operations
(update, upgrade)
- allows for automation (has an API to work with from tests/scripts)

what
====

Will consist of database backend (single node for now), actual data on Cinder
volume, multiple frontends with simple rest api behind Octavia
load balancer, possibly with custom TLS cert thru Barbican and domain name
via Designate.
Implemented as Heat template(s).
Current version consists of:

- **Neutron** networks, subnets, routers and floating IPs for servers
- 3 **Nova** instances running MySQL Galera cluster as Database

- Database files are kept on a separately attached **Cinder** volumes

- 3 **Nova** instances running this app as API
- **Octavia** load balancer for Database instances
- **Octavia** load balancer for API instances
- DNS zones and records created for the instances in **Designate**

**Keystone** and **Glance** are involved implicitly.

Implemented two deployment scenarios:

- as OpenStack Orchestration (**Heat**) template(s)
- as Terraform/OpenTofu configuration

todo
----

- involve **Barbican** into the mix by using TLS-terminating
Octavia load balancer with user-supplied certificate.

API ref
=======
Expand Down Expand Up @@ -110,13 +129,22 @@ Show record by its id::
{"record": {"id": 2, "created_at": "2020-04-06T12:12:52.000", "host": "f1f66c9fb4b3", "data": null}}

DELETE /records/{id}
-----------------
--------------------

Delete record by its id::
Delete single record by its id::

$ curl -X DELETE http://<host:port>/records/2

DELETE /records
---------------

Delete all records in one go, cleanup the database::

$ curl -X DELETE http://<host:port>/records


Used external components
========================

`wait-for` script courtesy of https://github.com/Eficode/wait-for (MIT License)
`wait-for` script used in docker compose setup
courtesy of https://github.com/Eficode/wait-for (MIT License)
6 changes: 4 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ services:
build: .
environment:
OS_REFAPP_DB_URL: mysql+pymysql://refapp:supersecret@database:3306/refapp
volumes:
- ./wait-for:/wait-for:ro
entrypoint:
- "./wait-for"
- "/wait-for"
- "database:3306"
- "--timeout=60"
- "--"
- "gunicorn"
- "-c"
- "gunicorn.conf.py"
- "/opt/app/gunicorn.conf.py"
- "openstack_refapp.app:create_app()"
ports:
- "8000:8000"
Expand Down
6 changes: 6 additions & 0 deletions openstack_refapp/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ def on_post(self, req, resp):
LOG.info(f"Created record {new_rec.id} with data {new_rec.data}")
resp.media = new_rec.to_dict()

def on_delete(self, req, resp):
result = req.context.session.query(Record).delete()
if result:
req.context.session.commit()
LOG.warning("All record were deleted")


class RecordResource:
def on_get(self, req, resp, id):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ requires = ["setuptools>=30.3.0", "wheel", "pbr>=5.0.0"]

[tool.black]
line-length = 79
target_version = ['py36']
target_version = ['py38']

0 comments on commit b1a20df

Please sign in to comment.