-
Notifications
You must be signed in to change notification settings - Fork 16
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
Command to start a local container #491
Changes from all commits
ccd6dab
e05a084
7a4e80a
06d063f
51c17be
0e9cc78
faad2ad
0556605
7c7a880
cdca61b
79b729f
62f5af4
7cde7de
b46dd05
1e19e25
99b1ff6
6b8e3f7
f4a8ab6
920c381
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,55 @@ | ||||||
import { ensureContainerRunning } from "../lib/docker-containers.mjs"; | ||||||
|
||||||
/** | ||||||
* Starts the local Fauna container | ||||||
* @param {import('yargs').Arguments} argv The arguments from yargs | ||||||
* @returns {Promise<void>} a promise that resolves when the container is ready. | ||||||
* It will reject if the container is not ready after the maximum number of attempts. | ||||||
*/ | ||||||
async function startLocal(argv) { | ||||||
await ensureContainerRunning({ | ||||||
imageName: argv.image, | ||||||
containerName: argv.name, | ||||||
hostPort: argv.hostPort, | ||||||
containerPort: argv.containerPort, | ||||||
pull: argv.pull, | ||||||
}); | ||||||
} | ||||||
|
||||||
/** | ||||||
* Builds the yargs command for the local command | ||||||
* @param {import('yargs').Argv} yargs The yargs instance | ||||||
* @returns {import('yargs').Argv} The yargs instance | ||||||
*/ | ||||||
function buildLocalCommand(yargs) { | ||||||
return yargs.options({ | ||||||
containerPort: { | ||||||
describe: "The port inside the container Fauna listens on.", | ||||||
type: "number", | ||||||
default: "8443", | ||||||
}, | ||||||
hostPort: { | ||||||
describe: | ||||||
"The port on the host machine mapped to the container's port. This is the port you'll connect to Fauna on.", | ||||||
type: "number", | ||||||
default: "8443", | ||||||
}, | ||||||
name: { | ||||||
describe: "The name to give the container", | ||||||
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.
Suggested change
|
||||||
type: "string", | ||||||
default: "faunadb", | ||||||
}, | ||||||
pull: { | ||||||
describe: "Pull the latest image before starting the container.", | ||||||
type: "boolean", | ||||||
default: true, | ||||||
}, | ||||||
}); | ||||||
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. We can do this in a future PR, but I really love to see FSL directory flag and a database name flag that this command creates and pushes into. 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. That's good idea for starting up dev and test environments. |
||||||
} | ||||||
|
||||||
export default { | ||||||
command: "local", | ||||||
describe: "Start a local Fauna container", | ||||||
builder: buildLocalCommand, | ||||||
handler: startLocal, | ||||||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tl;dr: What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some node modules like low level crypto libraries esbuild does not bundle by default. This instructs esbuild to do so by copying the files it needs into the bundle.