-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add cpp test server v2 #10
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
167cdb7
implement test server for c++ V2
ajewellamz 3000858
m
ajewellamz 9ad923c
m
ajewellamz 35cc7e2
m
ajewellamz c8cdae4
m
ajewellamz c9224b5
m
ajewellamz db69245
Merge branch 'fireegg-test-servers' into ajewell/cpp-test-server
ajewellamz 7cdf7e6
m
ajewellamz 6b6bcd7
m
ajewellamz f133f01
m
ajewellamz a2ed825
m
ajewellamz 7157850
m
ajewellamz a21bc8e
m
ajewellamz dc3b274
Merge branch 'fireegg-test-servers' into ajewell/cpp-test-server
ajewellamz e2bab00
m
ajewellamz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ on: | |
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| runs-on: macos-13 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code works well overall, but the main things to watch out for are thread safety with client_cache and the manual new/delete handling. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| cmake_minimum_required(VERSION 3.16) | ||
| project(s3ec-cpp-v2-server) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 17) | ||
|
|
||
| # Configure AWS SDK build options | ||
| set(BUILD_ONLY "kms;s3;s3-encryption" CACHE STRING "Build only KMS, S3, and S3-encryption components") | ||
| set(ENABLE_TESTING OFF CACHE BOOL "Disable testing") | ||
| set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libraries") | ||
|
|
||
| # Add AWS SDK as subdirectory | ||
| add_subdirectory(aws-sdk-cpp) | ||
|
|
||
| find_package(PkgConfig REQUIRED) | ||
| pkg_check_modules(LIBMICROHTTPD REQUIRED libmicrohttpd) | ||
|
|
||
| find_package(nlohmann_json REQUIRED) | ||
|
|
||
| add_executable(s3ec-server main.cpp) | ||
|
|
||
| target_include_directories(s3ec-server PRIVATE | ||
| ${LIBMICROHTTPD_INCLUDE_DIRS} | ||
| /opt/homebrew/include | ||
| ) | ||
|
|
||
| target_link_directories(s3ec-server PRIVATE | ||
| ${LIBMICROHTTPD_LIBRARY_DIRS} | ||
| /opt/homebrew/lib | ||
| ) | ||
|
|
||
| target_link_libraries(s3ec-server | ||
| ${LIBMICROHTTPD_LIBRARIES} | ||
| aws-cpp-sdk-core | ||
| aws-cpp-sdk-kms | ||
| aws-cpp-sdk-s3 | ||
| aws-cpp-sdk-s3-encryption | ||
| nlohmann_json::nlohmann_json | ||
| uuid | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Makefile for S3 Encryption Client Testing | ||
|
|
||
| .PHONY: start-server stop-server wait-for-server | ||
|
|
||
| PID_FILE := server.pid | ||
| PORT := 8085 | ||
|
|
||
| build/s3ec-server: | ||
| brew install libmicrohttpd nlohmann-json ossp-uuid | ||
| git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp.git | ||
| cd aws-sdk-cpp && git checkout --track remotes/origin/ajewell/ec-for-get-object | ||
| mkdir -p build && cd build && cmake .. | ||
|
|
||
| start-server: | build/s3ec-server | ||
| @echo "Starting Cpp V2 server..." | ||
| cd build && make && \ | ||
| AWS_ACCESS_KEY_ID="$$AWS_ACCESS_KEY_ID" \ | ||
| AWS_SECRET_ACCESS_KEY="$$AWS_SECRET_ACCESS_KEY" \ | ||
| AWS_SESSION_TOKEN="$$AWS_SESSION_TOKEN" \ | ||
| AWS_REGION="us-west-2" \ | ||
| ./s3ec-server & echo $$! > $(PID_FILE) | ||
| @echo "Cpp V2 server starting..." | ||
|
|
||
| stop-server: | ||
| @if [ -f $(PID_FILE) ]; then \ | ||
| kill $$(cat $(PID_FILE)) 2>/dev/null || true; \ | ||
| rm $(PID_FILE); \ | ||
| fi | ||
|
|
||
| wait-for-server: | ||
| $(MAKE) -C .. wait-for-port PORT=$(PORT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # C++ S3 Encryption Test Server | ||
|
|
||
| Minimal C++ implementation of the S3 Encryption test server. | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - libmicrohttpd | ||
| - AWS SDK for C++ | ||
| - nlohmann/json | ||
| - uuid | ||
|
|
||
| On MacOS you can | ||
| ```bash | ||
| brew install libmicrohttpd nlohmann-json ossp-uuid | ||
| ``` | ||
|
|
||
| ## Build | ||
|
|
||
| ```bash | ||
| mkdir build && cd build | ||
| cmake .. | ||
| make | ||
| ``` | ||
|
|
||
| ## Run | ||
|
|
||
| ```bash | ||
| ./s3ec-server | ||
| ``` | ||
|
|
||
| Server runs on localhost:8085 | ||
|
|
||
| ## API Endpoints | ||
|
|
||
| - `POST /client` - Create S3 encryption client | ||
| - `GET /object/{bucket}/{key}` - Get encrypted object | ||
| - `PUT /object/{bucket}/{key}` - Put encrypted object |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.