Ejemplo n.º 1
0
current_pod_ip = sp.getoutput('hostname -i')

match = re.match("^(\d{0,3})\.(\d{0,3})\.(\d{0,3})\.(\d{0,3})$",
                 service_output)

if match:
    bitbucket_cluster_peers = f'{current_pod_ip},{service_output}'
else:
    bitbucket_cluster_peers = f'{current_pod_ip}'

# Find and replace confluence.cluster.peers values with current pods IP along with the cluster peers if exists
import configparser

config = configparser.RawConfigParser()
config.read(f'{BITBUCKET_HOME}/shared/bitbucket.properties')

ip = config.get('CONFIG', 'hazelcast.network.tcpip.members')
print("ip is " + ip)
config.set('CONFIG', 'hazelcast.network.tcpip.members',
           bitbucket_cluster_peers)

with open(f'{BITBUCKET_HOME}/shared/bitbucket.properties', 'w') as configfile:
    config.write(configfile)

start_cmd = f"{BITBUCKET_INSTALL_DIR}/bin/start-bitbucket.sh -fg"
if str2bool(env['elasticsearch_enabled']
            ) is False or env['application_mode'] == 'mirror':
    start_cmd += ' --no-search'

start_app(start_cmd, BITBUCKET_HOME, name='Bitbucket Server')
Ejemplo n.º 2
0
# Getting the current pod IP and assign it to an ENV variable
current_pod_ip = sp.getoutput('hostname -i')

gen_container_id()
if os.stat('/etc/container_id').st_size == 0:
    gen_cfg('container_id.j2',
            '/etc/container_id',
            user=RUN_USER,
            group=RUN_GROUP,
            overwrite=True)
gen_cfg('server.xml.j2', f'{JIRA_INSTALL_DIR}/conf/server.xml')
gen_cfg('dbconfig.xml.j2',
        f'{JIRA_HOME}/dbconfig.xml',
        user=RUN_USER,
        group=RUN_GROUP,
        overwrite=False)
if str2bool(env.get('clustered')):
    gen_cfg('cluster.properties.j2',
            f'{JIRA_HOME}/cluster.properties',
            user=RUN_USER,
            group=RUN_GROUP,
            overwrite=True)

# Find and replace text @@ehcache_listener_hostname@@ with current pods IP
os.system(
    f"sed -i 's|@@ehcache_listener_hostname@@|'{current_pod_ip}'|g' {JIRA_HOME}/cluster.properties"
)

start_app(f'{JIRA_INSTALL_DIR}/bin/start-jira.sh -fg', JIRA_HOME, name='Jira')