-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deployment): spruce up scripts with some Node and ShellCheck
- Loading branch information
1 parent
1791164
commit aa551d6
Showing
5 changed files
with
108 additions
and
89 deletions.
There are no files selected for viewing
This file contains 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,70 @@ | ||
#! /usr/bin/env node | ||
/* global process */ | ||
// Get a deployment.json for a 2-node docker setup. | ||
|
||
const DEFAULT_NUM_VALIDATORS = 2; | ||
const DEFAULT_NETWORK_NAME = 'localtest'; | ||
|
||
const NUM_VALIDATORS = process.argv[2] || DEFAULT_NUM_VALIDATORS; | ||
|
||
const NETWORK_NAME = process.env.NETWORK_NAME || DEFAULT_NETWORK_NAME; | ||
|
||
// Add in DOCKER_VOLUMES=host_path:container_path,host_path2:container_path2,... | ||
const ADD_VOLUMES = (process.env.DOCKER_VOLUMES || '') | ||
.split(',') | ||
.flatMap(volumeSpec => { | ||
const splitVolumeSpec = volumeSpec.split(':'); | ||
if (splitVolumeSpec.length < 2) { | ||
// No specification found. | ||
return []; | ||
} | ||
|
||
const [hostPath, ...rest] = splitVolumeSpec; | ||
return [ | ||
{ | ||
host_path: hostPath, | ||
container_path: rest.join(':'), | ||
}, | ||
]; | ||
}); | ||
|
||
const deployment = { | ||
PLACEMENTS: [ | ||
[ | ||
'docker1', | ||
{ | ||
default: 2, | ||
}, | ||
], | ||
], | ||
PLACEMENT_PROVIDER: { | ||
docker1: 'docker', | ||
}, | ||
SSH_PRIVATE_KEY_FILE: 'id_ecdsa', | ||
DETAILS: { | ||
VOLUMES: { | ||
docker1: [ | ||
{ | ||
host_path: '/sys/fs/cgroup', | ||
container_path: '/sys/fs/cgroup', | ||
}, | ||
...ADD_VOLUMES, | ||
], | ||
}, | ||
}, | ||
OFFSETS: { | ||
docker1: 0, | ||
}, | ||
ROLES: { | ||
docker1: 'validator', | ||
}, | ||
DATACENTERS: { | ||
docker1: new Array(NUM_VALIDATORS).fill('default'), | ||
}, | ||
PROVIDER_NEXT_INDEX: { | ||
docker: 1, | ||
}, | ||
NETWORK_NAME, | ||
}; | ||
|
||
process.stdout.write(`${JSON.stringify(deployment, null, 2)}\n`); |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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