Skip to content

[65] scheduled build #66

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

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.8.6
current_version = 0.9.0
commit = True
tag = True

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/deploy-to-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9.17"
python-version: "3.10"

- name: Install and configure Poetry
uses: GNS-Science/install-poetry@main
Expand All @@ -28,10 +28,10 @@ jobs:
virtualenvs-in-project: true
installer-parallel: true

- name: Use Node.js (18 latest)
uses: actions/setup-node@v3
- name: Use Node.js )
uses: actions/setup-node@v4
with:
node-version: 18.17
node-version: 20
check-latest: true

- name: upgrade NPM
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Dev workflow

on:
schedule:
- cron: '45 6 * * 0' # At 06:45 on Sunday
pull_request:
branches: [main, deploy-test]

Expand All @@ -9,5 +11,9 @@ on:

jobs:
call-test-workflow:
#https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow
uses: ./.github/workflows/run-tests.yml
uses: GNS-Science/nshm-github-actions/.github/workflows/python-run-tests.yml@main
with:
operating-systems: "['ubuntu-latest']"
python-versions: "['3.10']"
delete-poetry-lock: ${{ github.event_name == 'schedule' }} # the scheduled build tests against newer dependencies
secrets: inherit
63 changes: 0 additions & 63 deletions .github/workflows/run-tests.yml

This file was deleted.

23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
# Changelog

## [0.9.0] - 2024-07-22

### Changed
- Composite archive now loaded from data_store package (reduces deployment footprint)
- data_store package provides the PynamoDB model BinaryLargeObject and a wrapper
that class that provides manages the blob storage with S3.
- AWS runtime is now python3.10

### Added
- a cli script for uploading CompositeSolution archives

## [0.8.7] - 2024-07-04
### Changed
- updated dependencies
-solvis=0.12.3
- solvis_store=2.0.4
- nzshm-model = ">=0.6.0"
- nzshm-common = ">=0.7.0"
- using new wrapped solvis functions / enums
- fixed test bug with clear_cache()


## [0.8.6] - 2024-06-12
### Added
- More type hinting for composite_solution/cached.py
- Testing against Python 3.10, 3.11

### Changed
- Update to use solvis 0.11.1
- Update to use solvis-store 2.0.3
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,30 @@ The API documentation is served by default from the service root.

```
poetry install
npm install --save serverless
npm install --save serverless-python-requirements
npm install --save serverless-wsgi
npm install --save serverless-plugin-warmup
npm install
```

### WSGI
### Run full stack locally

```
sls wsgi serve
npx serverless dynamodb start --stage local &\
npx serverless s3 start &\
SLS_OFFLINE=1 npx serverless wsgi serve
```

### Run full stack locally
then

```
SLS_OFFLINE=1 npx serverless wsgi serve
AWS_PROFILE=*** SLS_OFFLINE=1 cli WORKING/NSHM_v1.0.4_CompositeSolution.zip NSHM_v1.0.4 -R
```

### Unit tests

`poetry run pytest` note that some environment variables are set in `setup.cfg`.


### Push a composite solution

```
AWS_PROFILE=*** REGION=ap-southeast-4 DEPLOYMENT_STAGE=dev S3_BUCKET_NAME=nzshm22-solvis-graphql-api-dev cli WORKING/NSHM_v1.0.4_CompositeSolution.zip NSHM_v1.0.4 -R
```
15 changes: 15 additions & 0 deletions data_store/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
this **data_store** package may be merged with **solvis_store** eventually or generalised to its own repo.

It provides a hybrid class BinaryLargeObject which uses dynamodb for searching/indexing/identity** features
and s3 for the blob storage. The blob can be any binary object up to around 1GB.

Much larger file sizes can be supported by S3 but additional (multipart) download options will be needed.

Examples:

```
TODO

```
"""
26 changes: 26 additions & 0 deletions data_store/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
This module exports comfiguration for the current package
"""

import os


def boolean_env(environ_name, default='FALSE'):
return bool(os.getenv(environ_name, default).upper() in ["1", "Y", "YES", "TRUE"])


IS_OFFLINE = boolean_env('SLS_OFFLINE') # set by serverless-wsgi plugin
TESTING = boolean_env('TESTING')

if IS_OFFLINE:
DB_ENDPOINT = "http://localhost:8000"
else:
DB_ENDPOINT = os.getenv("DB_ENDPOINT", '')

REGION = os.getenv('REGION', 'us-east-1')
DEPLOYMENT_STAGE = os.getenv('DEPLOYMENT_STAGE', 'LOCAL').upper()
STACK_NAME = os.getenv('STACK_NAME')
CW_METRICS_RESOLUTION = os.getenv('CW_METRICS_RESOLUTION', 60) # 1 for high resolution or 60
S3_BUCKET_NAME = os.environ.get('S3_BUCKET_NAME', "nzshm22-solvis-graphql-api-local")

LOGGING_CFG = os.getenv('LOGGING_CFG', 'logging_aws.yaml')
Loading