-
Notifications
You must be signed in to change notification settings - Fork 39
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
Update docker alias migrations #1589
Conversation
DAppNode bot has built and pinned the release to an IPFS node, for commit: a85751c This is a development version and should only be installed for testing purposes, install link
(by dappnodebot/build-action) |
638e576
to
768c78b
Compare
* and do docker inspect. | ||
* and do docker inspect. This migration tries to assure that: | ||
* Having a package name "example.dnp.dappnode.eth" the aliases should be: | ||
* "example.dappnode" if the package is mono service |
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.
// Adds "root" alias to multiservice container if it is the main service | ||
// "root" alias is always "dappnodename.dappnode", as if it was a mono service | ||
if (isMainServiceOfMultiServicePackage(container)) { | ||
aliasesToMigrate.push(getPrivateNetworkAlias({ dnpName: container.dnpName, serviceName: '' })); |
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.
Make sure the function works as intended when passing serviceName=""
return false; | ||
} | ||
|
||
function updateEndpointConfig(currentEndpointConfig: Dockerode.NetworkInfo | null, alias: string) { |
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.
I would call this function addAliasToEndpointConfig
}; | ||
} | ||
|
||
async function updateContainerNetwork(networkName: string, container: any, endpointConfig: Partial<Dockerode.NetworkInfo>): Promise<void> { |
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.
Maybe reconnectContainerToNetwork
?
); | ||
|
||
// 2. Get compose service network settings | ||
const composeService = compose.services()[container.serviceName]; |
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.
I liked this better, looks cleaner, but as you prefer
isCore: false, | ||
}; | ||
|
||
const containers = [containerMain, containerNotMain, monoContainer]; |
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.
I think there are other cases right?
Public/Dnp
Monoservice/Multiservice
MainService/NoMainService
We might need to take all combinations into account (if there are equivalent combinations they can be omitted)
await shellSafe(`docker-compose -f ${TEST_ALIAS_PATH_MONO}/docker-compose.yml up -d`); | ||
|
||
const [containerMainExists, containerNotMainExists, monoContainerExists, networkExists] = await Promise.all([ | ||
shellSafe(`docker container ls --filter name=${containerMain.containerName}`), |
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.
There must be a way to avoid repeating this line 3 times
} | ||
|
||
await Promise.all([ | ||
shellSafe(`docker network connect ${DNCORE_NETWORK} ${containerMain.containerName}`), |
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.
Same as above
const monoContainerAliases = await getContainerAliasesOnNetwork(monoContainer.containerName, DNCORE_NETWORK); | ||
|
||
// Define the expected aliases. These should match the aliases added by the `addAliasToGivenContainers` function. | ||
const expectedMainAliases = ["mainService.logger.dappnode", "logger.dappnode"]; |
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.
You could skip this var declaration and set the values directly
|
||
after("Cleanup", async () => { | ||
await Promise.all([ | ||
shellSafe(`docker stop ${containerMain.containerName}`), |
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.
Same, try to avoid repetition if possible
0f4d52e
to
a2d9350
Compare
a2d9350
to
f87a247
Compare
f87a247
to
a85751c
Compare
Overridden by #1632 |
No description provided.