Skip to content

Commit

Permalink
Merge pull request #30 from lpsinger/dockerode
Browse files Browse the repository at this point in the history
Fall back to Docker for sandbox mode
  • Loading branch information
dakota002 authored Dec 6, 2023
2 parents be7c145 + 3b53fbe commit ac3db4f
Show file tree
Hide file tree
Showing 8 changed files with 453 additions and 102 deletions.
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

0 comments on commit ac3db4f

Please sign in to comment.