-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It fails due to: ``` 2021-04-23T16:36:59,942Z DEBUG Test worker [] [com.atlassian.performance.tools.ssh.SshjConnection] root$ sudo service nfs-kernel-server restart 2021-04-23T16:37:00,977Z DEBUG Test worker [] [com.atlassian.performance.tools.ssh.WaitingCommand.Companion] * Stopping NFS kernel daemon ...done. * Unexporting directories for NFS kernel daemon... ...done. * Exporting directories for NFS kernel daemon... ...fail! 2021-04-23T16:37:00,979Z WARN Test worker [] [com.atlassian.performance.tools.ssh.WaitingCommand.Companion] exportfs: /home/ubuntu/jira-shared-home does not support NFS export ``` Options: * keep trying NFS in Docker (in WSL) * try other FS sharing (FUSE? SAN?) * use different FS sharing in Docker (volumes?) and different in AWS (so SPI, but what is default? maybe no default or maybe bound to `Infrastructure` SPI itself)
- Loading branch information
Showing
23 changed files
with
126 additions
and
63 deletions.
There are no files selected for viewing
10 changes: 7 additions & 3 deletions
10
src/main/kotlin/com/atlassian/performance/tools/infrastructure/api/Infrastructure.kt
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 |
---|---|---|
@@ -1,11 +1,15 @@ | ||
package com.atlassian.performance.tools.infrastructure.api | ||
|
||
import com.atlassian.performance.tools.infrastructure.api.jira.install.TcpHost | ||
import com.atlassian.performance.tools.ssh.api.Ssh | ||
|
||
interface Infrastructure : AutoCloseable { // TODO rename to ServerRoom | ||
|
||
val subnet: String | ||
|
||
interface Infrastructure : AutoCloseable { | ||
|
||
/** | ||
* @return can be reached by the caller via [TcpHost.publicIp] and by the rest of the infra via [TcpHost.privateIp] | ||
*/ | ||
fun serve(port: Int, name: String): TcpHost | ||
fun serveTcp(name: String): TcpHost | ||
fun serveSsh(name: String): Ssh | ||
} |
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
26 changes: 0 additions & 26 deletions
26
...in/com/atlassian/performance/tools/infrastructure/api/jira/install/hook/DataCenterHook.kt
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
62 changes: 62 additions & 0 deletions
62
...kotlin/com/atlassian/performance/tools/infrastructure/api/jira/instance/SharedHomeHook.kt
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,62 @@ | ||
package com.atlassian.performance.tools.infrastructure.api.jira.instance | ||
|
||
import com.atlassian.performance.tools.infrastructure.api.Infrastructure | ||
import com.atlassian.performance.tools.infrastructure.api.jira.JiraHomeSource | ||
import com.atlassian.performance.tools.infrastructure.api.jira.install.InstalledJira | ||
import com.atlassian.performance.tools.infrastructure.api.jira.install.hook.PostInstallHook | ||
import com.atlassian.performance.tools.infrastructure.api.jira.install.hook.PostInstallHooks | ||
import com.atlassian.performance.tools.infrastructure.api.jira.install.hook.PreInstallHooks | ||
import com.atlassian.performance.tools.infrastructure.api.jira.report.Reports | ||
import com.atlassian.performance.tools.infrastructure.api.os.RemotePath | ||
import com.atlassian.performance.tools.infrastructure.api.os.Ubuntu | ||
import com.atlassian.performance.tools.ssh.api.SshConnection | ||
|
||
internal class SharedHomeHook( | ||
private val jiraHomeSource: JiraHomeSource, | ||
private val infrastructure: Infrastructure | ||
) : PreInstanceHook { | ||
private val localHome = "/home/ubuntu/jira-shared-home" | ||
|
||
override fun call(nodes: List<PreInstallHooks>, hooks: PreInstanceHooks, reports: Reports) { | ||
val server = infrastructure.serveSsh("shared-home") | ||
server.newConnection().use { ssh -> | ||
download(ssh) | ||
export(ssh) | ||
} | ||
val sharedHome = RemotePath(server.host, localHome) | ||
nodes.forEach { it.postInstall.insert(SharedHomeMount(sharedHome)) } | ||
} | ||
|
||
private fun download(ssh: SshConnection) { | ||
ssh.execute("sudo mkdir -p $localHome") | ||
val jiraHome = jiraHomeSource.download(ssh) | ||
ssh.execute("sudo mv $jiraHome/{data,plugins,import,export} $localHome") | ||
ssh.safeExecute("sudo mv $jiraHome/logos $localHome") | ||
} | ||
|
||
private fun export(ssh: SshConnection): SshConnection.SshResult { | ||
Ubuntu().install(ssh, listOf("nfs-kernel-server")) | ||
val options = "rw,sync,no_subtree_check,no_root_squash" | ||
ssh.execute("sudo echo '$localHome ${infrastructure.subnet}($options)' | sudo tee -a /etc/exports") | ||
return ssh.execute("sudo service nfs-kernel-server restart") | ||
} | ||
|
||
private class SharedHomeMount( | ||
private val sharedHome: RemotePath | ||
) : PostInstallHook { | ||
|
||
override fun call(ssh: SshConnection, jira: InstalledJira, hooks: PostInstallHooks, reports: Reports) { | ||
Ubuntu().install(ssh, listOf("nfs-common")) | ||
val mountSource = "${sharedHome.host.ipAddress}:${sharedHome.path}" | ||
val mountTarget = "mounted-shared-home" | ||
ssh.execute("mkdir -p $mountTarget") | ||
ssh.execute("sudo mount -o soft,intr,rsize=8192,wsize=8192 $mountSource $mountTarget") | ||
ssh.execute("sudo chown ubuntu:ubuntu $mountTarget") | ||
val mountedPath = "`realpath $mountTarget`" | ||
val jiraHome = jira.home.path | ||
ssh.execute("echo ehcache.object.port = 40011 >> $jiraHome/cluster.properties") | ||
ssh.execute("echo jira.node.id = ${jira.host.name} >> $jiraHome/cluster.properties") | ||
ssh.execute("echo jira.shared.home = $mountedPath >> $jiraHome/cluster.properties") | ||
} | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.