Skip to content
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

Fall back to Docker for sandbox mode #30

Merged
merged 1 commit into from
Dec 6, 2023
Merged
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This is a [plugin](https://arc.codes/docs/en/guides/plugins/overview) for [Architect](https://arc.codes/) that provisions managed [Amazon OpenSearch](https://aws.amazon.com/opensearch-service/) for the application.

When you are using Architect's [sandbox](https://arc.codes/docs/en/reference/cli/sandbox) mode, the plugin [downloads and runs Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html#elasticsearch-install-packages) or [OpenSearch](https://opensearch.org/downloads.html#opensearch) locally.
When you are using Architect's [sandbox](https://arc.codes/docs/en/reference/cli/sandbox) mode, the plugin [downloads and runs Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html#elasticsearch-install-packages) or [OpenSearch](https://opensearch.org/downloads.html#opensearch) locally. If search engine binaries are not available for your platform, then the plugin falls back to trying to launch them in a container using [Docker](https://www.docker.com).

Pair this pacakge with [@nasa-gcn/architect-functions-search](https://github.com/nasa-gcn/architect-functions-search) to connect to the service from your Node.js Lambda function code.

Expand Down
3 changes: 1 addition & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import { launch } from './run.js'
import type { LocalSearch } from './run.js'
import { populate } from './data.js'
import {
cloudformationResources as serverlessCloudformationResources,
Expand Down Expand Up @@ -66,7 +65,7 @@ export const deploy = {
},
}

let local: LocalSearch
let local: Awaited<ReturnType<typeof launch>>

function getEngine(name?: string) {
if (name?.toLowerCase() === 'opensearch') return 'opensearch'
Expand Down
3 changes: 2 additions & 1 deletion install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export async function install(engine: SandboxEngine) {
entry.engine === engine && entry.arch === arch && entry.type === type
)?.url
if (!url) {
throw new Error(
console.warn(
`No ${engine} binary is available for your OS type (${type}) and architecture (${arch}).`
)
return
}

const archiveFilename = posix
Expand Down
Loading