Good Morning all, hope everyone is having a good day!
I am trying to setup git sync between a production and dev instance using the PSU in-built sync but all the documentation focuses only on Github / Remote repos.
What I am trying to do is setup a production instance that pushes certain configs back to the dev instance (Ignoring things like auth.ps1 etc) as well as allowing me to push changes from the dev instance to the production instance manually.
Currently the production and dev instances are not ālinkedā at all (This is another aspect of the documentation that confuses me. It mentions āattaching an instance to the databaseā but nowhere does it tell you how to do that as far as I can find.). At the moment Iām manually making any changes in my dev instance to make it match the production instance and then manually copying any changes back from dev to production and re-configuring all the paths, variables, creds, etc etc.
How is this designed to be used so we can have a dev instance that can push changes to a production instance as well as pull certain configs from production? Are we expected to do what I mentioned above and manually copy / edit the code between the two instances?
I guess to sum it up, ignoring what is being asked for now, how are we MEANT to be utilizing this feature properly?
Iām not sure how things are meant to be done, but I can try to detail what I do, which does require a remote Git repository. For starters, as I said in the PowerShell Discord on this topic, I donāt use Git sync with the database.
The Git Setup
Create a Git repository containing the contents of the $env:ProgramData\UniversalAutomation\Repository folder.
Create a new branch from main called dev.
Host that repository on a web service accessible to the PSU server (I use CodeCommit, but GitHub would be much easier).
Install Git on the PSU server, because this method requires an external Git client.
Configure Git credentials:
Ummā¦ I forgot how I did this, and I didnāt document it. Iām probably doing something weird, because itās CodeCommit.
Add $env:ProgramData\UniversalAutomation\Repository as a safe folder in your Git configuration: git config --global --add safe.directory "$env:ProgramData/UniversalAutomation/Repository"
For secrets, I use the PSUSecretStore vault for those variables in my variables.ps1 file like this: New-PSUVariable -Name "MyApiKey" -Vault "PSUSecretStore" -Type "System.String"
Then I set the secrets through the web UI. This kind of sucks when youāre destroying the environment frequently.
Caveats, etc.
The biggie: Your web UI basically becomes read-only. I think the only things you can change through the UI are Git settings and secret values.
You and anyone else working on PSU kind of have to learn how to use Git. Itās a great tool to have in your toolbelt, but itās not simple.
I donāt like working with a dev and main branch, but you might not have to. For me, itās the only way I could come up with to put a āreview gateā before deploying to production without the overhead of a release pipeline. In my case, changes to main have to be approved in CodeCommit. If you donāt have that same need, you can configure Git settings in your production environment for Manual synchronization. Then you can use a trunk-based development strategy, and only sync production after you have things working in dev.
Sometimes, variables created in the PSUHeader region get duplicated (unless thatās been fixed recently).
In the future, I might switch to pulling secrets from our external secret store so I donāt have to reset them in PSU when I rebuild the environment.
I know thatās not exactly what youāre askin for, but thatās how Iām doing a dev environment.
Hi guys!
I am very new to PSU. Currently I am in a testing phase for implementation of PSU, but I do not really know (and maybe it is a stupid question) do I need separate databases (SQL) for prod and dev instances?
So an example would be: 3 instances for production environment do have 1 common sql database, 4 instances for development need another common sql database?
We do also have a gitlab server in the company and would use that to implement main and dev branches. So prod and dev environments could be connected to that server to the correct branches.
Am I correct or completely wrong?