Skip to content

Commit

Permalink
kamu-api-server: error if specialized config is not found + `kamu-d…
Browse files Browse the repository at this point in the history
…ev-api-server:` image (#149)

* kamu-api-server:dev-$(TAG): introduce for debugging

* kamu-api-server, load_config(): error if specialized config is not found

* kamu-api-server:dev-$(TAG): use cross tool for building

* RUSTSEC-2024-0376: fix

* dev-api-server: use separate image for dev builds

* images: add "kamu-" prefix

* Cargo: fix yanked crate (url)
  • Loading branch information
s373r authored Nov 25, 2024
1 parent 155e2db commit 36b2ada
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 20 deletions.
30 changes: 17 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- `kamu-api-server`: error if specialized config is not found

## [0.43.1] - 2024-11-22
Upgrade kamu-cli version to `0.208.1` (minor updates in data image)

## [0.43.0] - 2024-11-22
### Changed
Introduced `DatasetRegistry` abstraction, encapsulating listing and resolution of datasets (kamu-cli version to `0.208.0`):
- Registry is backed by database-stored dataset entries, which are automatically maintained
- Scope for `DatasetRepository` is now limited to support `DatasetRegistry` and in-memory dataset dependency graph
- New concept of `ResolvedDataset`: a wrapper arround `Arc<dyn Dataset>`, aware of dataset identity
- Query and Dataset Search functions now consider only the datasets accessible for current user
- Core services now explicitly separate planning (transactional) and execution (non-transactional) processing phases
- Similar decomposition introduced in task system execution logic
- Batched form for dataset authorization checks
- Ensuring correct transactionality for dataset lookup and authorization checks all over the code base
- Passing multi/single tenancy as an enum configuration instead of boolean
- Renamed outbox "durability" term to "delivery mechanism" to clarify the design intent
- Introduced `DatasetRegistry` abstraction, encapsulating listing and resolution of datasets (kamu-cli version to `0.208.0`):
- Registry is backed by database-stored dataset entries, which are automatically maintained
- Scope for `DatasetRepository` is now limited to support `DatasetRegistry` and in-memory dataset dependency graph
- New concept of `ResolvedDataset`: a wrapper arround `Arc<dyn Dataset>`, aware of dataset identity
- Query and Dataset Search functions now consider only the datasets accessible for current user
- Core services now explicitly separate planning (transactional) and execution (non-transactional) processing phases
- Similar decomposition introduced in task system execution logic
- Batched form for dataset authorization checks
- Ensuring correct transactionality for dataset lookup and authorization checks all over the code base
- Passing multi/single tenancy as an enum configuration instead of boolean
- Renamed outbox "durability" term to "delivery mechanism" to clarify the design intent

## [0.42.3] - 2024-11-22
### Fixed
Expand Down Expand Up @@ -77,8 +81,8 @@ Introduced `DatasetRegistry` abstraction, encapsulating listing and resolution o

## [0.40.1] - 2024-09-24
### Changed
Upgrade kamu-cli version to `0.203.1`:
- Added database migration & scripting to create an application user with restricted permissions
- Upgrade kamu-cli version to `0.203.1`:
- Added database migration & scripting to create an application user with restricted permissions

## [0.40.0] - 2024-09-22
### Added
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions images/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ api-server:
--build-arg KAMU_VERSION=$(KAMU_VERSION) \
--build-arg NODE_VERSION=$(NODE_VERSION) \
-t $(IMAGE_REPO)/kamu-api-server:$(NODE_VERSION) \
api-server/
kamu-api-server/


.PHONY: api-server-push
Expand All @@ -29,7 +29,7 @@ api-server-with-data:
--build-arg KAMU_VERSION=latest-with-data \
--build-arg NODE_VERSION=$(NODE_VERSION) \
-t $(IMAGE_REPO)/kamu-api-server:latest-with-data \
api-server/
kamu-api-server/


.PHONY: api-server-with-data-push
Expand All @@ -45,7 +45,7 @@ api-server-with-data-mt:
--build-arg KAMU_VERSION=latest-with-data-mt \
--build-arg NODE_VERSION=$(NODE_VERSION) \
-t $(IMAGE_REPO)/kamu-api-server:latest-with-data-mt \
api-server-with-data-mt/
kamu-api-server-with-data-mt/


.PHONY: api-server-with-data-mt-push
Expand All @@ -61,7 +61,7 @@ oracle-provider:
--build-arg KAMU_VERSION=$(KAMU_VERSION) \
--build-arg NODE_VERSION=$(NODE_VERSION) \
-t $(IMAGE_REPO)/kamu-oracle-provider:$(NODE_VERSION) \
oracle-provider/
kamu-oracle-provider/


.PHONY: oracle-provider-push
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions images/kamu-dev-api-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG KAMU_VERSION
FROM ghcr.io/kamu-data/kamu-base:${KAMU_VERSION}

WORKDIR /opt/kamu

COPY ./tmp/kamu-api-server /opt/kamu/

ENTRYPOINT ["/usr/bin/tini", "--"]

CMD ["/opt/kamu/kamu-api-server", "run", "--address=0.0.0.0", "--http-port=8080"]

EXPOSE 8080/tcp
32 changes: 32 additions & 0 deletions images/kamu-dev-api-server/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
KAMU_VERSION=$(shell cargo metadata --format-version 1 | jq -r '.packages[] | select( .name == "kamu-core") | .version')
IMAGE_REPO=ghcr.io/kamu-data
IMAGE_NAME=kamu-dev-api-server
TARGET=x86_64-unknown-linux-gnu
# Branch name
TAG=$(shell git rev-parse --abbrev-ref HEAD | sed 's/\//-/g')


################################################################################

.PHONY: build
build:
# cargo binstall cross
cd ../../ && RUSTFLAGS="" cross build -p kamu-api-server --release --target=$(TARGET)


.PHONY: image
image: build
mkdir -p ./tmp
cp ../../target/$(TARGET)/release/kamu-api-server tmp/kamu-api-server
docker build \
--build-arg KAMU_VERSION=$(KAMU_VERSION) \
-t $(IMAGE_REPO)/$(IMAGE_NAME):$(TAG) \
.
rm -rf ./tmp


.PHONY: image-push
image-push:
docker push $(IMAGE_REPO)/$(IMAGE_NAME):$(TAG)

################################################################################
4 changes: 4 additions & 0 deletions images/kamu-dev-api-server/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
repo:
repoUrl: file:///opt/kamu/workspace/.kamu/datasets
datasetEnvVars:
encryptionKey: i6boyWa8hYAuO5Fb2h64cOVy9eEusEkt
File renamed without changes.
4 changes: 4 additions & 0 deletions src/app/api-server/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ pub fn load_config(path: Option<&PathBuf>) -> Result<ApiServerConfig, InternalEr
));

if let Some(path) = path {
if !path.is_file() {
return InternalError::bail(format!("Config file '{}' not found", path.display()));
}

figment = figment.merge(figment::providers::Yaml::file(path));
};

Expand Down

0 comments on commit 36b2ada

Please sign in to comment.