organize your chickens: nuget for the enterprise

38
Organize Your Chickens - NuGet for the Enterprise Maarten Balliauw @maartenballiauw RealDolmen

Upload: maarten-balliauw

Post on 13-May-2015

6.225 views

Category:

Technology


0 download

DESCRIPTION

Managing software dependencies, whether those created in-house or from third parties can be a pain in the behind. Whether dependencies feel like wild chickens or people run around like chickens dealing with dependencies, the NuGet package manager can be a cure. Let us guide you to creating enterprise (chicken) NuGets and dealing with them in a structured, easy-to-maintain manner. From developer workstation to build server, NuGet tastes great! We'll provide you the dip sauce.

TRANSCRIPT

Page 1: Organize your chickens: NuGet for the enterprise

Organize Your Chickens - NuGet for the EnterpriseMaarten Balliauw@maartenballiauwRealDolmen

Page 2: Organize your chickens: NuGet for the enterprise

NuGet for the Enterprise

Organize Your Chickens

Page 3: Organize your chickens: NuGet for the enterprise

Who am I?• Maarten Balliauw• Antwerp, Belgium• www.realdolmen.com • Focus on web

– ASP.NET, ASP.NET MVC, PHP, Azure, …– MVP Windows Azure (formerly ASP.NET)

• http://blog.maartenballiauw.be • @maartenballiauw • Author: Pro NuGet - http://amzn.to/pronuget

Page 4: Organize your chickens: NuGet for the enterprise

Agenda• NuGet• Scenarios– Host your own NuGet repository– Continuous Package Integration– Abusing NuGet– NuGet Inception

• Conclusion

Chickens?!

Page 5: Organize your chickens: NuGet for the enterprise

NuGet

Page 6: Organize your chickens: NuGet for the enterprise

Welcome to Dependency Hell“A term for the frustration of software users who have installed

software packages which have dependencies on specific

versions of other software packages.” (Wikipedia)

Page 7: Organize your chickens: NuGet for the enterprise

Cause and Effect• Reinventing the wheel

– We don’t need that dependency– “If they can do it, we can do it, but better” What happened to reuse of components?

• Marketing-Driven Versioning– People are waiting for v2 to buy– Let’s call it v4 Platform Update SP3 November Edition KB2348063 RTW

Refresh We lost ownership of AssemblyVersion ?

Page 8: Organize your chickens: NuGet for the enterprise

Package Management• NuGet to the Rescue!

• Simple concept– Find Packages– (Re)Use Packages– Produce Packages

“NuGet is a Visual Studio extension that makes it easy to install and update open source libraries and tools in Visual Studio.”

Page 9: Organize your chickens: NuGet for the enterprise

DEMOFinding & consuming a NuGet package

Page 10: Organize your chickens: NuGet for the enterprise

DEMOCreating & publishing a NuGet package

Page 11: Organize your chickens: NuGet for the enterprise

Semantic Versioning• Think about your versioning! (semver.org)

– Always specify lowerbound– Use a version range (lowerbound + upperbound) when

versioning of package you depend on is messed up

Major Breaking changes

Minor Backwards compatible API additions/changes

Patch Bugfixes not affecting the API

Page 12: Organize your chickens: NuGet for the enterprise

Hosting a repository

Page 13: Organize your chickens: NuGet for the enterprise

Hosting your own repository• NuGet = public feed– Privacy– Intellectual property

• NuGet maintained by package authors– Author removes v1.0.45 and you depend on it

Page 14: Organize your chickens: NuGet for the enterprise

Solutions• Folder / File share• NuGet.Server package• NuGet Gallery (or Orchard Gallery)• MyGet

Page 15: Organize your chickens: NuGet for the enterprise

DEMONuGet.Server

Page 16: Organize your chickens: NuGet for the enterprise

NuGet.Server limitations• Only 1 feed per installation• No UI– up to you to build it

• No granular security– only 1 API-key for entire feed

• Conclusion: requires you to develop if you want something more useful

Page 17: Organize your chickens: NuGet for the enterprise

Meet MyGet• www.myget.org• NaaS– Register and off you go!

• Supports Enterprise scenarios– Granular security– Package mirroring– Proxying

Page 18: Organize your chickens: NuGet for the enterprise

DEMOMyGet

Page 19: Organize your chickens: NuGet for the enterprise

Continuous Package Integration

Page 20: Organize your chickens: NuGet for the enterprise

Typical source control...• Contains /References (if you are lucky)– ...and also Project/_bin_deployable_assemblies

– ...and also /References/old– ...and also /..././../.././References

• Usually references GAC-ed assemblies

Page 21: Organize your chickens: NuGet for the enterprise

Dependencies• Software has dependencies. Deal with it.

• But are those YOUR intellectual property?– YOUR reason to build software?– YOUR product?

• No. They are dependencies. And they don’t belong in source control.

Page 22: Organize your chickens: NuGet for the enterprise

Continuous Package Integration• Can I get rid of all these referenced assemblies

duplicated all-over my source control system?Yes!

• Do I need to install and maintain NuGet on all my build agents?No!

Page 23: Organize your chickens: NuGet for the enterprise

DEMOPackage Restore

Page 24: Organize your chickens: NuGet for the enterprise

3rd parties don’t belong in your VCS• Replace them with NuGet packages• Do commit packages\repositories.config

file• Use Enable-PackageRestore

Page 25: Organize your chickens: NuGet for the enterprise

Problem!• NuGet feed is subject to change...– PackageSource msbuild property to the rescue(NuGet.settings.targets in $(SolutionDir)\.nuget folder)

• Now what...– Host your own feed and mirror packages– Or use MyGet for that

Page 26: Organize your chickens: NuGet for the enterprise

Organize your chickens• Feed structuring– Scoped by quality: Build, QA, Production, …– Scoped by audience: public, restricted access– Other: • Scoped by product version, milestone…• Scoped by target platform

Page 27: Organize your chickens: NuGet for the enterprise

Guidance• Publishing a package brings great

responsibility– Breaking changes in your packages should be

versioned accordingly!– Consumers might choose to no longer consume

any packages you published

Page 28: Organize your chickens: NuGet for the enterprise

Guidance• Package Integration ≠ Integration Testing– CI builds reflect output of source control input– Same input always produces same output

Do not auto-update packages during automated builds

Page 29: Organize your chickens: NuGet for the enterprise

Abusing NuGet

Page 30: Organize your chickens: NuGet for the enterprise

Abusing NuGet?Change of perspective

NuGet is a package managerNuGet is a protocol for distributing packages

Page 31: Organize your chickens: NuGet for the enterprise

NuGet as a Protocol

Page 32: Organize your chickens: NuGet for the enterprise

Automate deployments• Build results in .nupkg• Octopus deploys to its tentacles– Test tentacles– Staging tentacles– Production tentacles

• www.octopusdeploy.com

Page 33: Organize your chickens: NuGet for the enterprise
Page 34: Organize your chickens: NuGet for the enterprise

Chocolatey• NuGet– developer library packages

• Chocolatey– applications and tools packager– “yum” or “apt-get” for Windows

• www.chocolatey.org

Page 35: Organize your chickens: NuGet for the enterprise

DEMOChocolatey

Page 36: Organize your chickens: NuGet for the enterprise

DEMOContinuous Delivery

Build

Test

Package

Push

Release / Publish

Deploy

Continuous Delivery of the MyGet website using:

TeamCity NuGet MyGet Octopus

Page 37: Organize your chickens: NuGet for the enterprise

Dependencies & people are chickensDeal with them! NuGet can help

Set up your own NuGet repository

Continuous package integration

NuGet is a package managerNuGet is a protocol

Conclusion

Page 38: Organize your chickens: NuGet for the enterprise

THANK YOU!

http://blog.maartenballiauw.be@maartenballiauw

http://amzn.to/pronugetor Install-Package ProNuGet

#tdvs