Skip to content

Commit

Permalink
Moved webapp deployment code into pkispawn.
Browse files Browse the repository at this point in the history
Previously the WAR files were generated at build time, so it would
include theme files that were installed on the build machine.

The code has been changed such that instead of generating WAR files
pkispawn will copy the webapp files from the theme folders and combine
them with subsystem webapp files at deployment time. This way it will
use the actual theme files installed on the deployment machine.

Ticket #89
  • Loading branch information
edewata committed Sep 5, 2012
1 parent 1637107 commit 63ac959
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 53 deletions.
10 changes: 5 additions & 5 deletions base/deploy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ install(
src/scriptlets/selinux_setup.py
src/scriptlets/slot_substitution.py
src/scriptlets/subsystem_layout.py
src/scriptlets/war_explosion.py
src/scriptlets/webapp_deployment.py
DESTINATION
${PYTHON_SITE_PACKAGES}/pki/deployment
PERMISSIONS
Expand Down Expand Up @@ -149,8 +149,8 @@ foreach(TOMCAT_SUBSYSTEM ${TOMCAT_SUBSYSTEMS})
)
install(CODE "execute_process(COMMAND
${CMAKE_COMMAND} -E create_symlink
\"${PYTHON_SITE_PACKAGES}/pki/deployment/war_explosion.py\"
\"\$ENV{DESTDIR}${DATA_INSTALL_DIR}/deployment/spawn/${TOMCAT_SUBSYSTEM}/040_war_explosion\")"
\"${PYTHON_SITE_PACKAGES}/pki/deployment/webapp_deployment.py\"
\"\$ENV{DESTDIR}${DATA_INSTALL_DIR}/deployment/spawn/${TOMCAT_SUBSYSTEM}/040_webapp_deployment\")"
)
install(CODE "execute_process(COMMAND
${CMAKE_COMMAND} -E create_symlink
Expand Down Expand Up @@ -192,8 +192,8 @@ foreach(TOMCAT_SUBSYSTEM ${TOMCAT_SUBSYSTEMS})
)
install(CODE "execute_process(COMMAND
${CMAKE_COMMAND} -E create_symlink
\"${PYTHON_SITE_PACKAGES}/pki/deployment/war_explosion.py\"
\"\$ENV{DESTDIR}${DATA_INSTALL_DIR}/deployment/destroy/${TOMCAT_SUBSYSTEM}/940_war_explosion\")"
\"${PYTHON_SITE_PACKAGES}/pki/deployment/webapp_deployment.py\"
\"\$ENV{DESTDIR}${DATA_INSTALL_DIR}/deployment/destroy/${TOMCAT_SUBSYSTEM}/940_webapp_deployment\")"
)
# install(CODE "execute_process(COMMAND
# ${CMAKE_COMMAND} -E create_symlink
Expand Down
4 changes: 0 additions & 4 deletions base/deploy/config/pkideployment.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ pki_ocsp_signing_token=
pki_subordinate=False
pki_subsystem=CA
pki_subsystem_name=
pki_war_file=ca.war
###############################################################################
## 'KRA' Data: ##
## ##
Expand All @@ -182,7 +181,6 @@ pki_transport_nickname=
pki_transport_signing_algorithm=SHA256withRSA
pki_transport_subject_dn=
pki_transport_token=
pki_war_file=kra.war
###############################################################################
## 'OCSP' Data: ##
## ##
Expand All @@ -200,7 +198,6 @@ pki_ocsp_signing_subject_dn=
pki_ocsp_signing_token=
pki_subsystem=OCSP
pki_subsystem_name=
pki_war_file=ocsp.war
###############################################################################
## 'RA' Data: ##
## ##
Expand All @@ -220,7 +217,6 @@ pki_subsystem_name=
[TKS]
pki_subsystem=TKS
pki_subsystem_name=
pki_war_file=tks.war
###############################################################################
## 'TPS' Data: ##
## ##
Expand Down
6 changes: 3 additions & 3 deletions base/deploy/src/scriptlets/pkimessages.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,6 @@
SUBSYSTEM_DESTROY_1 = "depopulating '%s'"
SUBSYSTEM_RESPAWN_1 = "repopulating '%s'"
SUBSYSTEM_SPAWN_1 = "populating '%s'"
WAR_EXPLOSION_DESTROY_1 = "removing '%s'"
WAR_EXPLOSION_RESPAWN_1 = "redeploying '%s'"
WAR_EXPLOSION_SPAWN_1 = "deploying '%s'"
WEBAPP_DEPLOYMENT_DESTROY_1 = "removing '%s'"
WEBAPP_DEPLOYMENT_RESPAWN_1 = "redeploying '%s'"
WEBAPP_DEPLOYMENT_SPAWN_1 = "deploying '%s'"
7 changes: 0 additions & 7 deletions base/deploy/src/scriptlets/pkiparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,17 +406,10 @@ def compose_pki_master_dictionary():
"lib")
config.pki_master_dict['pki_tomcat_systemd'] =\
config.PKI_DEPLOYMENT_TOMCAT_SYSTEMD
config.pki_master_dict['pki_war_source_dir'] =\
os.path.join(config.PKI_DEPLOYMENT_SOURCE_ROOT,
config.pki_master_dict['pki_subsystem'].lower(),
"war")
config.pki_master_dict['pki_source_webapps_path'] =\
os.path.join(config.PKI_DEPLOYMENT_SOURCE_ROOT,
config.pki_master_dict['pki_subsystem'].lower(),
"webapps")
config.pki_master_dict['pki_war'] =\
os.path.join(config.pki_master_dict['pki_war_source_dir'],
config.pki_master_dict['pki_war_file'])
config.pki_master_dict['pki_source_catalina_properties'] =\
os.path.join(config.pki_master_dict['pki_source_shared_path'],
"catalina.properties")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
# All rights reserved.
#

# System Imports
import os


# PKI Deployment Imports
import pkiconfig as config
from pkiconfig import pki_master_dict as master
Expand All @@ -27,18 +31,38 @@
import pkiscriptlet


# PKI Deployment War Explosion Scriptlet
# PKI Web Application Deployment Scriptlet
class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
rv = 0

def spawn(self):
if master['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS:
config.pki_log.info(log.WAR_EXPLOSION_SPAWN_1, __name__,
config.pki_log.info(log.WEBAPP_DEPLOYMENT_SPAWN_1, __name__,
extra=config.PKI_INDENTATION_LEVEL_1)
# deploy war file
util.directory.create(master['pki_tomcat_webapps_subsystem_path'])
util.war.explode(master['pki_war'],
master['pki_tomcat_webapps_subsystem_path'])
util.directory.copy(
os.path.join(
config.PKI_DEPLOYMENT_SOURCE_ROOT,
"common-ui"),
master['pki_tomcat_webapps_subsystem_path'],
overwrite_flag=True)
util.directory.copy(
os.path.join(
config.PKI_DEPLOYMENT_SOURCE_ROOT,
master['pki_subsystem'].lower() + "-ui",
"webapps",
master['pki_subsystem'].lower()),
master['pki_tomcat_webapps_subsystem_path'],
overwrite_flag=True)
util.directory.copy(
os.path.join(
config.PKI_DEPLOYMENT_SOURCE_ROOT,
master['pki_subsystem'].lower(),
"webapps",
master['pki_subsystem'].lower()),
master['pki_tomcat_webapps_subsystem_path'],
overwrite_flag=True)
util.directory.create(
master['pki_tomcat_webapps_subsystem_webinf_classes_path'])
util.directory.create(
Expand All @@ -62,12 +86,32 @@ def spawn(self):

def respawn(self):
if master['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS:
config.pki_log.info(log.WAR_EXPLOSION_RESPAWN_1, __name__,
config.pki_log.info(log.WEBAPP_DEPLOYMENT_RESPAWN_1, __name__,
extra=config.PKI_INDENTATION_LEVEL_1)
# redeploy war file
util.directory.modify(master['pki_tomcat_webapps_subsystem_path'])
util.war.explode(master['pki_war'],
master['pki_tomcat_webapps_subsystem_path'])
util.directory.copy(
os.path.join(
config.PKI_DEPLOYMENT_SOURCE_ROOT,
"common-ui"),
master['pki_tomcat_webapps_subsystem_path'],
overwrite_flag=True)
util.directory.copy(
os.path.join(
config.PKI_DEPLOYMENT_SOURCE_ROOT,
master['pki_subsystem'].lower() + "-ui",
"webapps",
master['pki_subsystem'].lower()),
master['pki_tomcat_webapps_subsystem_path'],
overwrite_flag=True)
util.directory.copy(
os.path.join(
config.PKI_DEPLOYMENT_SOURCE_ROOT,
master['pki_subsystem'].lower(),
"webapps",
master['pki_subsystem'].lower()),
master['pki_tomcat_webapps_subsystem_path'],
overwrite_flag=True)
# update Tomcat webapps subsystem WEB-INF lib symbolic links
if master['pki_subsystem'] == "CA":
util.symlink.modify(master['pki_ca_jar_link'])
Expand All @@ -83,7 +127,7 @@ def respawn(self):

def destroy(self):
if master['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS:
config.pki_log.info(log.WAR_EXPLOSION_DESTROY_1, __name__,
config.pki_log.info(log.WEBAPP_DEPLOYMENT_DESTROY_1, __name__,
extra=config.PKI_INDENTATION_LEVEL_1)
util.directory.delete(master['pki_tomcat_webapps_subsystem_path'])
return self.rv
30 changes: 4 additions & 26 deletions specs/pki-core.spec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

Name: pki-core
Version: 10.0.0
Release: %{?relprefix}26%{?prerel}%{?dist}
Release: %{?relprefix}27%{?prerel}%{?dist}
Summary: Certificate System - PKI Core Components
URL: http://pki.fedoraproject.org/
License: GPLv2
Expand Down Expand Up @@ -73,12 +73,6 @@ BuildRequires: tomcatjss >= 2.0.0
%endif
%endif
%endif
# Add the following build-time requirements to support the "pki-server" package
BuildRequires: pki-common-theme >= 10.0.0
BuildRequires: pki-ca-theme >= 10.0.0
BuildRequires: pki-kra-theme >= 10.0.0
BuildRequires: pki-ocsp-theme >= 10.0.0
BuildRequires: pki-tks-theme >= 10.0.0

Source0: http://pki.fedoraproject.org/pki/sources/%{name}/%{name}-%{version}%{?prerel}.tar.gz

Expand Down Expand Up @@ -786,21 +780,6 @@ if [ -d /etc/sysconfig/pki/%i ]; then \
fi \
)

# Create PKI subsystem "war" files
for subsystem in ca kra ocsp tks; do
echo "Constructing '${subsystem}.war' . . ."
%{__mkdir_p} %{buildroot}%{_datadir}/pki/${subsystem}/war
%{__cp} -r %{_datadir}/pki/common-ui/admin %{buildroot}%{_datadir}/pki/${subsystem}/war
%{__cp} -r %{_datadir}/pki/common-ui/css %{buildroot}%{_datadir}/pki/${subsystem}/war
%{__cp} -r %{_datadir}/pki/common-ui/img %{buildroot}%{_datadir}/pki/${subsystem}/war
%{__cp} -r %{_datadir}/pki/${subsystem}-ui/webapps/${subsystem}/* %{buildroot}%{_datadir}/pki/${subsystem}/war
%{__cp} -r %{buildroot}%{_datadir}/pki/${subsystem}/webapps/${subsystem}/WEB-INF %{buildroot}%{_datadir}/pki/${subsystem}/war
cd %{buildroot}%{_datadir}/pki/${subsystem}/war
jar -cvMf ../${subsystem}.war *
%{__rm} -rf %{buildroot}%{_datadir}/pki/${subsystem}/war/*
%{__mv} ../${subsystem}.war %{buildroot}%{_datadir}/pki/${subsystem}/war
done

%pre -n pki-selinux
%saveFileContext targeted

Expand Down Expand Up @@ -1259,7 +1238,6 @@ fi
%dir %{_datadir}/pki/ca/profiles
%{_datadir}/pki/ca/profiles/ca/
%{_datadir}/pki/ca/setup/
%{_datadir}/pki/ca/war/
%{_datadir}/pki/ca/webapps/
%dir %{_localstatedir}/lock/pki/ca
%dir %{_localstatedir}/run/pki/ca
Expand Down Expand Up @@ -1288,7 +1266,6 @@ fi
%dir %{_datadir}/pki/kra
%{_datadir}/pki/kra/conf/
%{_datadir}/pki/kra/setup/
%{_datadir}/pki/kra/war/
%{_datadir}/pki/kra/webapps/
%dir %{_localstatedir}/lock/pki/kra
%dir %{_localstatedir}/run/pki/kra
Expand Down Expand Up @@ -1317,7 +1294,6 @@ fi
%dir %{_datadir}/pki/ocsp
%{_datadir}/pki/ocsp/conf/
%{_datadir}/pki/ocsp/setup/
%{_datadir}/pki/ocsp/war/
%{_datadir}/pki/ocsp/webapps/
%dir %{_localstatedir}/lock/pki/ocsp
%dir %{_localstatedir}/run/pki/ocsp
Expand Down Expand Up @@ -1346,7 +1322,6 @@ fi
%dir %{_datadir}/pki/tks
%{_datadir}/pki/tks/conf/
%{_datadir}/pki/tks/setup/
%{_datadir}/pki/tks/war/
%{_datadir}/pki/tks/webapps/
%dir %{_localstatedir}/lock/pki/tks
%dir %{_localstatedir}/run/pki/tks
Expand All @@ -1370,6 +1345,9 @@ fi


%changelog
* Thu Aug 30 2012 Endi S. Dewata <[email protected]> 10.0.0-0.27.a1
- Moved webapp creation code into pkispawn.

* Mon Aug 20 2012 Endi S. Dewata <[email protected]> 10.0.0-0.26.a1
- Split pki-client.jar into pki-certsrv.jar and pki-tools.jar.

Expand Down

0 comments on commit 63ac959

Please sign in to comment.