Skip to content

Commit

Permalink
Quickfix - mount a discrete dir on local host to CN file-storage to keep
Browse files Browse the repository at this point in the history
fs in containers separate
  • Loading branch information
csjiang committed Nov 5, 2021
1 parent 900044e commit 0d60281
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion creator-node/compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
- '${CREATOR_NODE_HOST_PORT}:${CREATOR_NODE_HOST_PORT}'
- '${CREATOR_NODE_DEBUGGER_PORT}:${CREATOR_NODE_DEBUGGER_PORT}'
volumes:
- ../file_storage:/file_storage
- env/tmp/file-storage-${serviceNumber}:/file_storage
- ..:/usr/src/app
# Prevent hiding node_modules on container with host volume
# From https://github.com/barrysteyn/node-scrypt/issues/148
Expand Down
1 change: 1 addition & 0 deletions creator-node/compose/env/commonEnv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export delegatePrivateKey=DELEGATE_PRIVATE_KEY
export creatorNodeEndpoint=CREATOR_NODE_ENDPOINT
export spOwnerWallet=SP_OWNER_WALLET
export COMPOSE_HTTP_TIMEOUT=200
export serviceNumber=SERVICE_NUMBER
11 changes: 6 additions & 5 deletions libs/initScripts/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ const run = async () => {
const delegateWallet = ownerWallet
let endpoint = makeCreatorNodeEndpoint(serviceCount)

await _updateCreatorNodeConfig(ownerWallet, templatePath, writePath, endpoint, /* isShell */ true, delegateWallet)
await _updateCreatorNodeConfig(ownerWallet, templatePath, writePath, endpoint, /* isShell */ true, delegateWallet, serviceCount)
break
}

Expand Down Expand Up @@ -474,7 +474,7 @@ const _updateCNodeDelegateOwnerWallet = async (ethAccounts, serviceNumber) => {
await updateServiceDelegateOwnerWallet(audiusLibs, contentNodeType, endpoint, ethAccounts[serviceNumber + 10])
}

const _updateCreatorNodeConfig = async (ownerWallet, templatePath, writePath, endpoint = null, isShell = false, delegateWallet) => {
const _updateCreatorNodeConfig = async (ownerWallet, templatePath, writePath, endpoint = null, isShell = false, delegateWallet, serviceCount) => {
delegateWallet = (delegateWallet || ownerWallet).toLowerCase()
ownerWallet = ownerWallet.toLowerCase()

Expand All @@ -484,7 +484,7 @@ const _updateCreatorNodeConfig = async (ownerWallet, templatePath, writePath, en
let ownerWalletPrivKey = ganacheEthAccounts['private_keys'][`${ownerWallet}`]
let delegateWalletPrivKey = ganacheEthAccounts['private_keys'][`${delegateWallet}`]

await _updateCreatorNodeConfigFile(templatePath, writePath, ownerWallet, ownerWalletPrivKey, delegateWallet, delegateWalletPrivKey, endpoint, isShell)
await _updateCreatorNodeConfigFile(templatePath, writePath, ownerWallet, ownerWalletPrivKey, delegateWallet, delegateWalletPrivKey, endpoint, isShell, serviceCount)
}

const _deregisterAllSPs = async (audiusLibs, ethAccounts) => {
Expand Down Expand Up @@ -541,12 +541,13 @@ const _configureDiscProv = async (ethAccounts, serviceNumber, templatePath, writ
}

// Write an update to shell env file for creator nodes or docker env file
const _updateCreatorNodeConfigFile = async (templatePath, writePath, ownerWallet, ownerWalletPkey, delegateWallet, delegateWalletPrivKey, endpoint, isShell) => {
const _updateCreatorNodeConfigFile = async (templatePath, writePath, ownerWallet, ownerWalletPkey, delegateWallet, delegateWalletPrivKey, endpoint, isShell, serviceCount) => {
const replaceMap = {
DELEGATE_OWNER_WALLET: delegateWallet,
DELEGATE_PRIVATE_KEY: delegateWalletPrivKey,
CREATOR_NODE_ENDPOINT: endpoint,
SP_OWNER_WALLET: ownerWallet
SP_OWNER_WALLET: ownerWallet,
SERVICE_NUMBER: serviceCount
}
writeEnvConfigFromTemplate({ templatePath, writePath, replaceMap })
}
Expand Down
4 changes: 2 additions & 2 deletions service-commands/src/commands/service-commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@
"port": 4000,
"health_check_endpoint": "health_check",
"up": [
"cd creator-node; . compose/env/tmp/shellEnv#.sh; docker-compose -f compose/docker-compose.yml up --build -d",
"cd creator-node; mkdir compose/env/tmp/file-storage-#; . compose/env/tmp/shellEnv#.sh; docker-compose -f compose/docker-compose.yml up --build -d",
"cd creator-node; . compose/env/unsetShellEnv.sh"
],
"down": [
"cd creator-node; . compose/env/tmp/shellEnv#.sh; docker-compose -f compose/docker-compose.yml down --remove-orphans"
"cd creator-node; . compose/env/tmp/shellEnv#.sh; rm -rf compose/env/tmp/file-storage-#; docker-compose -f compose/docker-compose.yml down --remove-orphans"
],
"restart": [
"cd creator-node; . compose/env/unsetShellEnv.sh",
Expand Down
2 changes: 1 addition & 1 deletion service-commands/src/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const getServiceCommands = (service, serviceNumber) => {
// If it's an array of commands, try interpolating
let val = commands[cur]
if (Array.isArray(val)) {
val = val.map(command => command.replace('#', serviceNumber))
val = val.map(command => command.replace(/#/g, serviceNumber))
}
return {
...acc,
Expand Down

0 comments on commit 0d60281

Please sign in to comment.