Skip to content
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

Issue/jperf 273 transplant ssh jira nodes #7

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0a4e1f0
Reduce test flakiness on WSL
dagguh Jan 22, 2021
2d91665
JPERF-273: Very very very early WIP
dagguh Mar 29, 2019
1946c51
JPERF-273: Model the Jira node flow
dagguh Apr 1, 2019
41b1f87
JPERF-273: Test `InstallableJiraIT`
dagguh Apr 2, 2019
6d1ffef
JPERF-273: Refactor the Jira lifecycle
dagguh Apr 5, 2019
ce3b38a
JPERF-273: Stop jira manually, because we can
dagguh Apr 5, 2019
f032696
Rename "track" to "flow"
dagguh Apr 15, 2019
06bee9a
Resolve DB TODO
dagguh Apr 15, 2019
336c278
Add DC hook
dagguh Apr 15, 2019
eec3e10
Let hooks be hooked in at any later stage
dagguh Apr 15, 2019
2e3a2a9
JPERF-273: Offer DB-related Jira hooks
dagguh Jul 2, 2019
d129d08
JPERF-273: Test `JiraNodeFlow` concurrency
dagguh Jul 4, 2019
58ba182
JPERF-273: Fix `JiraNodeFlowTest.shouldHookDuringListing`
dagguh Jul 4, 2019
1984d8e
JPERF-273: Add `ParallelInstallation`
dagguh Jul 4, 2019
7192b70
JPERF-273: Distinguish running hooks from hooking them in
dagguh Jul 5, 2019
fac32ba
Bump a bunch of timeouts, because my Internet is awful
dagguh Sep 6, 2019
ebf7325
JPERF-273: Poll hooks manually to avoid tail iteration
dagguh Sep 6, 2019
d311c65
JPERF-219: Block hooking to the past
wyrzyk Oct 16, 2019
c87d198
Fixup: 6ad30c059bcdcc8b05c4ec2f9c40cc0b3cdfb779
dagguh Oct 15, 2019
f036201
Extract `S3HostedJdk`
dagguh Oct 14, 2019
13a0c5c
JPERF-273: Define default `JiraNodeFlow`
dagguh Oct 16, 2019
1156aae
JPERF-273: Remove fluent hook API
dagguh Oct 16, 2019
23a7138
JPERF-273: Rename "flows" to "hooks"
dagguh Oct 16, 2019
c18a5b0
Expose `Reports.listReports`
dagguh Oct 16, 2019
26bdabb
JPERF-273 Postgres 9.6.15
Oct 18, 2019
2742b75
Refactor hooks: composition over inheritance
dagguh Jan 22, 2021
a336862
Repackage hooks
dagguh Jan 29, 2021
8dc645b
Reuse StaticBackoff
dagguh Jan 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
JPERF-273 Postgres 9.6.15
Marcin Masiorski authored and dagguh committed Jan 22, 2021
commit 26bdabbc719864d22bb2962694fb5216fb69d7ca
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.atlassian.performance.tools.infrastructure.api.database

import com.atlassian.performance.tools.infrastructure.DockerImage
import com.atlassian.performance.tools.infrastructure.api.dataset.DatasetPackage
import com.atlassian.performance.tools.ssh.api.SshConnection
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
import java.net.URI
import java.time.Duration

class PostgresDatabase(
private val source: DatasetPackage,
private val maxConnections: Int
) : Database {
private val logger: Logger = LogManager.getLogger(this::class.java)

private val image: DockerImage = DockerImage(
name = "postgres:9.6.15",
pullTimeout = Duration.ofMinutes(5)
)

constructor(
source: DatasetPackage
) : this(
source = source,
maxConnections = 200
)

override fun setup(ssh: SshConnection): String {
val data = source.download(ssh)
val containerName = image.run(
ssh = ssh,
// TODO Dataset for Postgres
// parameters = "-p 5432:5432 -v `realpath $data`:/",
parameters = "-p 5432:5432",
arguments = "-c 'listen_addresses='*'' -c 'max_connections=$maxConnections'"
)
Thread.sleep(Duration.ofSeconds(15).toMillis())
logger.debug("Postgres - creating jira user and database")
ssh.execute("sudo docker exec -u postgres $containerName psql --command \"CREATE USER jira WITH NOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB LOGIN PASSWORD 'jira';\"")
ssh.execute("sudo docker exec -u postgres $containerName createdb -E UNICODE -l C -T template0 -O jira jira")
return data
}

override fun start(jira: URI, ssh: SshConnection) {
// TODO Check logs for the following entry
// LOG: database system is ready to accept connections
Thread.sleep(Duration.ofSeconds(15).toMillis())
}

}