GithubHelp home page GithubHelp logo

ddysart / sitecore-powercore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adoprog/sitecore-powercore

0.0 1.0 0.0 261 KB

Helper cmdlets which can be used to create simple Sitecore website deployment script in something like 50 lines of code.

Home Page: sitecoresnippets.blogspot.com

License: MIT License

sitecore-powercore's Introduction

Sitecore PowerShell Deployment Framework

Helper modules which can be used to create simple Sitecore website deployment script in something like 50 lines of code.

DBUtils.psm1

Basic DB operations - backup / restore / execute, etc.

  • Create-Database
  • Restore-Database
  • Backup-Database
  • Attach-Database
  • Execute-File

FileUtils.psm1

Used to download / extract / package files, etc.

  • Download-File
  • Extract-Package
  • Set-Permissions
  • Unzip-Archive
  • Add-HostFileContent

ConfigUtils.psm1

All about editing .config files - web.config, include files, ConnectionStrings.config

  • Uncomment-ConfigSection
  • Set-ConnectionString
  • Set-SitecoreSetting
  • Set-ConfigAttribute
  • Set-ExecutionTimeout

and many other cmdlets

IISUtils.psm1

Used to create Sites / AppPools in IIS

  • Create-AppPool
  • Create-Site

SvnUtils.psm1

Contains single commandlet which will Checkout / Revert / Update folder from specified SVN repository. It can be split into a few different ones, I plan to do it in future.

WebUtils.psm1

Includes single commandlet for invoking a web page

Deployment script example

Clear-Host

# Framework initialization
$scriptRoot = Split-Path (Resolve-Path $myInvocation.MyCommand.Path)
$env:PSModulePath = $env:PSModulePath + ";$scriptRoot\Framework"

Import-Module WebUtils
Import-Module ConfigUtils
Import-Module DBUtils
Import-Module IISUtils
Import-Module FileUtils

# Main variables
$siteName = "PowerCoreSample"
$licensePath = "C:\license.xml"
$sourcePath = "C:\Sitecore 6.5.0 rev. 120706.zip"
$targetFolder = "E:\inetpub\wwwroot"

# Additional variables
$packageFileName = [System.IO.Path]::GetFileNameWithoutExtension($sourcePath)
$dataFolder = "$destination\$packageFileName\Data"
$websiteFolder = "$destination\$packageFileName\Website"
$serverName = $env:COMPUTERNAME
$sqlServerName = "$serverName\SQLEXPRESS"

# Main Script
Unzip-Archive $sourcePath $targetFolder

$server = New-Object ("Microsoft.SqlServer.Management.Smo.Server") $sqlServerName
$databases = "core", "master", "web"
foreach ($db in $databases)
{
 Attach-Database $server "$siteName.$db" "$targetFolder\$packageFileName\Databases\Sitecore.$db.mdf" "$destination\$packageFileName\Databases\Sitecore.$db.ldf"
 Set-ConnectionString "$websiteFolder\App_Config\ConnectionStrings.config" "$db" "Trusted_Connection=Yes;Data Source=$sqlServerName;Database=$siteName.$db"
}

Set-ConfigAttribute "$websiteFolder\web.config" "sitecore/sc.variable[@name='dataFolder']" "value" $dataFolder   

Copy-Item $licensePath $dataFolder
Create-AppPool $siteName "v4.0"
Create-Site $siteName "$siteName.local"  $targetFolder\$packageFileName
Add-HostFileContent "127.0.0.1" "$siteName.local"

sitecore-powercore's People

Contributors

adoprog avatar elyseum avatar yannisgu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.