Different websites per environment scenario

Hi Dalmiro,
We have one server in each enviromnet. However each server has multiple web sites. And each web site uses a different connection string. What is the best way to set this up in octopus.

Kindly advice.
Manoj

Hi Manoj,

Thanks for getting in touch! I’ve caught up with your conversation with Dalmiro, and I see you’ve created a role per website already. I’ll pick up your question from here!

Regarding using a different connection string for each website, this can be done using scoped variables. Create multiple variables with the same name, and define each value to be an individual connection string to be used for your websites, and scope them accordingly to your roles. And then when you deploy, the variable that is used will be determined by which role you’re deploying to.

I’d recommend you giving a read through our documentation on variable scoping, as I think that’ll help. :slight_smile:
https://octopus.com/docs/deploying-applications/variables/scoping-variables

Specifically for the connection string, you’re able to define variables in your project and replace the connection string in your config file with your variable values. Scoping your variables will mean a different connection string value will be used depending on where you’re deploying. Check out our docs on this as well for more info and examples.
https://octopus.com/docs/deploying-applications/configuration-files

I hope this helps. Don’t hesitate to reach out if you have any further questions.

Best regards,

Kenny

Thanks Ken.

Regards
Manoj

Hi Kenneth,
How can I use an octopus variable inside the project variable? I want to do something like this. Where the file dir is based on the role.

Regards
Manoj
[cid:image001.png@01D2EA86.3C1545B0]

Hi Kenneth,
Is there an easier way to duplicate a variable set ? We have 8 websites having slightly different variables
Manoj

Hi Manoj,

Thanks for following up! I’m sorry about the delay in getting back to you. It looks like you’ve gotten your syntax correct for your variable value. I tested it out with a simple PowerShell script step using write-host '#{LogPath}', and I got the correct result. Does that work for you? We also have a documentation page on troubleshooting Octopus variables which could help. :slight_smile:
https://octopus.com/docs/how-to/debug-problems-with-octopus-variables

While there’s no built-in way to duplicate a variable set. , we have an example PowerShell script that will duplicate variables within a set into a project. It’s not exactly what you need but may provide a good starting point.

I hope this helps! Don’t hesitate to reach out if you have any further questions!

Kenny

Hi Kenneth,
Sorry to bother you. I see this in TeamCity Logs but I do not see the package in Octopus Server Web Library->Packages Page. However I do see it on the server file system under C:\Octopus\Packages\SQ.NextGen.Service

Kindly advice. It’s a showstopper for up now.

[09:37:40][Octopus Deploy] Running command: octo.exe push --server http://tx-buildserver.surequest.cloudstorm:8888http://tx-buildserver.surequest.cloudstorm:8888/ --apikey SECRET --package C:\TeamCity\buildAgent\work\fe9581692fa40e03\Project\NextGen\SQ.NextGen.Service\bin\SQ.Nextgen.Service.1.0.0.10.nupkg
[09:37:40][Octopus Deploy] Pushing packages to Octopus server
[09:37:40][Octopus Deploy] Octopus Deploy Command Line Tool, version 4.15.5
[09:37:40][Octopus Deploy]
[09:37:40][Octopus Deploy] Handshaking with Octopus server: http://tx-buildserver.surequest.cloudstorm:8888http://tx-buildserver.surequest.cloudstorm:8888/
[09:37:40][Octopus Deploy] Handshake successful. Octopus version: 3.14.1; API version: 3.0.0
[09:37:40][Octopus Deploy] Authenticated as: sqoctopus <>
[09:37:40][Octopus Deploy] Pushing package: C:\TeamCity\buildAgent\work\fe9581692fa40e03\Project\NextGen\SQ.NextGen.Service\bin\SQ.Nextgen.Service.1.0.0.10.nupkg…
[09:37:40][Octopus Deploy] Push successful
[09:37:40][Octopus Deploy] Octo.exe exit code: 0

Regards
Manoj

It work now. My bad. Typo.

From: Manoj Patil
Sent: Monday, June 26, 2017 1:51 PM
To: ‘Kenneth Bates’ tender2+dd8974db81@tenderapp.com
Subject: RE: Different websites per environment scenario [Problems #55342]

Hi Kenneth,
Sorry to bother you. I see this in TeamCity Logs but I do not see the package in Octopus Server Web Library->Packages Page. However I do see it on the server file system under C:\Octopus\Packages\SQ.NextGen.Service

Kindly advice. It’s a showstopper for up now.

[09:37:40][Octopus Deploy] Running command: octo.exe push --server http://tx-buildserver.surequest.cloudstorm:8888http://tx-buildserver.surequest.cloudstorm:8888/ --apikey SECRET --package C:\TeamCity\buildAgent\work\fe9581692fa40e03\Project\NextGen\SQ.NextGen.Service\bin\SQ.Nextgen.Service.1.0.0.10.nupkg
[09:37:40][Octopus Deploy] Pushing packages to Octopus server
[09:37:40][Octopus Deploy] Octopus Deploy Command Line Tool, version 4.15.5
[09:37:40][Octopus Deploy]
[09:37:40][Octopus Deploy] Handshaking with Octopus server: http://tx-buildserver.surequest.cloudstorm:8888http://tx-buildserver.surequest.cloudstorm:8888/
[09:37:40][Octopus Deploy] Handshake successful. Octopus version: 3.14.1; API version: 3.0.0
[09:37:40][Octopus Deploy] Authenticated as: sqoctopus <>
[09:37:40][Octopus Deploy] Pushing package: C:\TeamCity\buildAgent\work\fe9581692fa40e03\Project\NextGen\SQ.NextGen.Service\bin\SQ.Nextgen.Service.1.0.0.10.nupkg…
[09:37:40][Octopus Deploy] Push successful
[09:37:40][Octopus Deploy] Octo.exe exit code: 0

Regards
Manoj

Hi Manoj,

Great to hear it’s working now! I see you’re working with Dalmiro on a different thread, so I’ll let you work with him on your questions over there. :slight_smile:

Best regards,

Kenny