Skip to content

Commit

Permalink
fix(jans-linux-setup): start jans-auth after backend (#3975)
Browse files Browse the repository at this point in the history
  • Loading branch information
devrimyatar committed Feb 23, 2023
1 parent 81cc059 commit 4afbcee
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion jans-linux-setup/jans_setup/setup_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ def init(self, install_dir=INSTALL_DIR):
self.jetty_user = self.jetty_group = 'jetty'
self.root_user = self.root_group = 'root'
self.ldap_user = self.ldap_group = 'ldap'

self.start_auth_after = 'network.target'
self.dump_config_on_error = False

if not self.output_dir:
self.output_dir = os.path.join(install_dir, 'output')

Expand Down
13 changes: 10 additions & 3 deletions jans-linux-setup/jans_setup/setup_app/installers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def start_installation(self):
pbar_text = self.pbar_text
self.logIt(pbar_text, pbar=self.service_name)

self.pre_install()

if self.needdb:
self.dbUtils.bind()

Expand All @@ -35,10 +37,11 @@ def start_installation(self):

self.create_folders()

# copy unit file
unit_file = os.path.join(Config.staticFolder, 'system/systemd', self.service_name + '.service')
# render unit file
unit_files_dir = os.path.join(Config.staticFolder, 'system/systemd')
unit_file = os.path.join(unit_files_dir, self.service_name + '.service')
if os.path.exists(unit_file):
self.copyFile(unit_file, Config.unit_files_path)
self.renderTemplateInOut(unit_file, unit_files_dir, Config.unit_files_path)

self.install()
self.copy_static()
Expand Down Expand Up @@ -160,6 +163,10 @@ def reload_daemon(self, service=None):
elif base.os_name == 'ubuntu16':
self.run([paths.cmd_update_rc, service, 'defaults'])

def pre_install(self):
"""Installer may require some settings before installation"""
pass

def generate_configuration(self):
pass

Expand Down
4 changes: 2 additions & 2 deletions jans-linux-setup/jans_setup/setup_app/installers/couchbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def install(self):

def couchbaseInstall(self):
coucbase_package = None

Config.start_auth_after = 'couchbase-server.service'
cb_package_list = glob.glob(os.path.join(self.couchbasePackageFolder, 'couchbase-server-enterprise*'))

if not cb_package_list:
Expand All @@ -103,7 +103,7 @@ def couchbaseInstall(self):

package_name = max(cb_package_list)
self.logIt("Found package '%s' for install" % package_name)
Config.pbar.progress(self.service_name, "Importing Couchbase package", incr=False)
Config.pbar.progress(self.service_name, "Installing Couchbase package", incr=False)
if base.clone_type == 'deb':
apt_path = shutil.which('apt')
self.chown(self.couchbasePackageFolder, '_apt', 'nogroup', recursive=True)
Expand Down
2 changes: 2 additions & 0 deletions jans-linux-setup/jans_setup/setup_app/installers/opendj.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def create_user(self):
def install_opendj(self):
self.logIt("Running OpenDJ Setup")

Config.start_auth_after = 'opendj.service'

# Copy opendj-setup.properties so user ldap can find it in /opt/opendj
setup_props_fn = os.path.join(Config.ldap_base_dir, 'opendj-setup.properties')
shutil.copy("%s/opendj-setup.properties" % Config.output_dir, setup_props_fn)
Expand Down
8 changes: 8 additions & 0 deletions jans-linux-setup/jans_setup/setup_app/installers/rdbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,16 @@ def local_install(self):
self.restart('mariadb')
self.fix_unit_file('mariadb')
self.enable('mariadb')
Config.start_auth_after = 'mariadb.service'

elif base.clone_type == 'rpm':
self.restart('mysqld')
self.enable('mysqld')
Config.start_auth_after = 'mysqld.service'

else:
Config.start_auth_after = 'mysql.service'

result, conn = self.dbUtils.mysqlconnection(log=False)
if not result:
sql_cmd_list = [
Expand All @@ -117,8 +123,10 @@ def local_install(self):
elif Config.rdbm_type == 'pgsql':
if base.clone_type == 'rpm':
self.run(['postgresql-setup', 'initdb'])
Config.start_auth_after = 'postgresql.service'
elif base.clone_type == 'deb':
self.run([paths.cmd_chmod, '640', '/etc/ssl/private/ssl-cert-snakeoil.key'])
Config.start_auth_after = 'postgresql.service'

self.restart('postgresql')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=Janssen Auth Server
After=opendj.service
After=%(start_auth_after)s

[Service]
Type=forking
Expand Down

0 comments on commit 4afbcee

Please sign in to comment.