Couple days ago, I had a post (http://help.octopusdeploy.com/discussions/questions/2836-error-with-deploychangesto) asking question on following http://octopusdeploy.com/blog/howto/deploy-a-sql-database for Octopus DB deployment, Vanessa said the link was old, which implied (to me) that I should not follow the link.
I checked Octopus 2.0 documents and below is the topic about DB deployment with Octopus - http://docs.octopusdeploy.com/display/OD/SQL+Server+databases
At the end, it has an 8min video for Octopus DB deployment with DbUp, the video started with an existing project which looks like the same as that from the old link (http://octopusdeploy.com/blog/howto/deploy-a-sql-database), is that correct? I hope the video also include how to setup the project.
If the project was created the same as that form the old link, then it should be a ‘Console Application’. With the project, after a successful build, I could see ‘DbUp.dll’, ‘DbUp.xml’, ‘OctoDBDeployDbup.exe’ (equivalent to ‘OctoSample.Databaase.exe’ in the link), and some other files (.config, .vshot.exe, .manifest), but I can’t see the .nupkg package created in that folder.
I have checked that both DbUp (3.0.6) and OctoPack (3.0.31) are installed in the project, then how can it not get the .nupkg package built?
I am attaching the packages.config file in case just in case. Other parts of the project are basically the same as that in the old link (http://octopusdeploy.com/blog/howto/deploy-a-sql-database).
I successfully configured and deployed my sample service and website projects, but not the DB project. We need the DB parts done before we move on to buy the license.
Thanks in advance for any suggestions/inputs.
Another question about DbUp installation.
The built db package (equivalent to ‘OctoSample.Database.exe’) with my testing project can’t be executed on my DB server (different machine from the project) because DbUp has not been installed on the DB server.
My question is: how can I install DbUp on the DB server? I only know how to do it through VS project, but we don’t have VS on the DB server and we do’t want to install VS on it.
Another update is that I now can build .nupkg - I missed the MSBuild options to generate Octo package.
I have been following your posts. So to try to understand where you are at currently, please let me know if I have any details wrong.
You have both DbUp and Octopack in your database solution, and (I have to assume here) some scripts named sequentially in a scripts folder.
You have managed to generate the NuGet package, (and can browse this file and see an executable and executable config very similar to my screenshot).
So to run this in Octopus to deploy it to your database server.
A package step is created and can find your database package. Your configuration files have a database connection string that is valid for the server you are deploying to.
You also need a deploy.ps1 that calls your executable such as:
This is the part that calls the executable that runs your scripts and updates your database.
The package deployment is what installs DbUp on your server, and the deploy.ps1 is what calls the executable to run your scripts all within the Octopus Deploy package step when it is deployed.
To understand this package step, there is an example on https://demo.octopusdeploy.com/app#/users/sign-in if you go to the OctoFX RateService project there is a step for the database, this is what you also need in your Octopus project.
Please let me know if I have made some bad assumptions or have missed any steps that you think I can explain further. Also if you could show a screenshot of your VS solution with the file structure including the scripts folder expanded this may help if we need to dig deeper.
Thanks for your following up, I now can build the correct nuget package (verified with the pkg explorer).
However I am facing another Octopus issue -
When I execute the following command (quotes with […]):
C:\Users…>“C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe” OctoDBDeployDbup.sln /t:Rebuild /p:RunOctoPack=true /p:OctoPackPublishPackageToFileShare=D:\Octopus_Builds /p:OctoPackPublishPackageToHttp=http://prdbuild01/Octopus/nuget/packages /p:OctoPackPublishApiKey=ED4491B8B08AFDEC30140F1849EF4A2166C22CBB
I got the following error:
Pushing OctoDBDeployDbup 22.214.171.124 to 'http://prdbuild01/Octopus/nuget/packages’…
Please provide credentials for: http://prdbuild01/Octopus/nuget/packages/
Object reference not set to an instance of an object.
94,5): error MSB3073: The command "“C:…\OctoPack.3.0.31\tools\NuGet.exe” push “C:…\OctoDBDeployDbup.126.96.36.199.nupkg” ED4491B8B08AFDEAAAA40F1849EF4A2166C22CBB -s http://prdbuild01/Octop
us/nuget/packages " exited with code 1. [C:…\OctoDBDeployDbup.csproj]
Done Building Project “C:…\OctoDBDeployDbup.csproj” (Rebuild target(s)) – FAILED.
Done Building Project “C:…\OctoDBDeployDbup.sln” (Re
build target(s)) – FAILED.
However if I removed the nuget/packages’ from the push path (i.e. made it as ‘http://prdbuild01/Octopus/’), the error is gone.
My questions -
- Why did Octopus ask for the credentials?
- How can I specify username/password in the commandline?
- I had a project setup using the same account for website/service deployment (with Octopus) and it works fine, then what’s wrong with this project?
Can you please try it without the Octopus part of your http such as:
http://prdbuild01/nuget/packages as your destination.
DbDeploy.NET is another solution similar to DbUp, but has more functionality and logging. You may want to try that as well.
Here is a link: