To deploy
LS application, we need AppPool and WebSite on the IIS Server, so we can create
TemplateNewAppPool, TemplateNewWebSite and batch file with msdeploy commands in
it.
Please find
the reference to create both templates as following;
(Note:
we have skips the steps which required for https)
So we get
following files for creating template for AppPool;
TemplateAppPoolPackage.zip
AppPoolParameters.xml and
DeployNewAppPool.cmd
And
following files for creating template for website
TemplateWebSitePackage.zip
WebSiteParameters.xml and
DeployNewWebSite.cmd
Batch
file to run msdeploy command
Create new
batch file which will have commands to execute packages to create template for
new App pool, new Web Site and deploying our Systembolaget.Web.Admin web site.
Following
commands will be included in batch file;
echo
create new appPool
@echo
off
CALL
E:\Published\DeployBatch\DeployNewAppPool.cmd
echo
create new webSite
@echo
off
CALL
E:\Published\DeployBatch\DeployNewWebSite.cmd
echo
replace SetParameter.xml file with stage/prod SetParameter.xml file
@echo
off
COPY
E:\Published\DeployBatch\LSApplicationSample.SetParameters.xml
E:\Published\LSApplication /Y
echo
SetParameter.xml replaced!
echo
Run deployment package..
@echo
off
CALL
E:\Published\LSApplication\LSApplicationSample.deploy.cmd /Y
echo
replace authorization.xml file with stage/prod authorization.xml file
COPY
E:\Published\DeployBatch\authorization.config E:\WebSites\LSApplication /Y
echo
authorization.xml replaced!
echo LSApplication website created successfully!
Lets
name the batch file as “DeployLSAppPackage.bat”
Authorization.config
for prodtest/prod environment
Add new
config file “authorization.config” as per the environment where we are going to
deploy this package.
For example
for stage we have following groups;
<authorization>
<allow roles="my-roles\AdminGroupStage"/>
<deny
users="*"/>
</authorization>
And for
prod we have following groups;
<authorization>
<allow
roles="my-roles\AdminGroupProd"/>
<deny
users="*"/>
</authorization>
So keep the
group name as per environment given by admin team.
LSApplicationSample.SetParameter.xml
By default,
when you open ‘LSApplicationSample.SetParameters.xml’ file from Published
folder you will get following options to set values;
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter
name="DatabaseServer" value="" />
<setParameter
name="DatabaseName" value="LSApplicationSample" />
<setParameter
name="DatabaseUserName" value="" />
<setParameter name="DatabaseUserPassword"
value="" />
<setParameter
name="LSApplicationSample_IisWebApplication" value="Default
Web Site/LSApplication" />
<setParameter
name="MyData" value="" />
</parameters>
So copy above “LSApplicationSample.SetParameters.xml”
file in “DeployBatch” folder and keep only required parameters as follows;
Delete
unwanted params
As you can
see, we have different name/value pair options to set the parameter value, but
here we have attached existing database and also we are following windows
authentication, in that case we don’t required values for Database related settings.
So here we
can delete top 4 params related to database.
Set
Custom Application Pool
By default
for "LSApplicationSample_IisWebApplication"
we have value as "Default Web
Site/LSApplication", so we can change Default Web Site to ‘myAppPool’ or any app pool name which we
are going to create.
So for an
example here we can change it to
<setParameter
name="LSApplicationSample_IisWebApplication" value="myAppPool/LSApplication" />
Set
Connection String
So finally
we can set different connection string for different environment, add the value
for MyData param as
follows;
<setParameter
name="MyData" value="new
connection string for stage/prod environment" />