I'm looking to automate Atlassian Stash installation using scripts. Currently, when Stash first comes up, a license needs to be added, and an admin account also needs to be created.
Is it possible to automate the two steps using the rest api? The rest api's need authentication, and I've not been able to find out if there's an api call that can be made to create the first admin user.
Unfortunately there isn't anything that directly does what you want.
I'm fairly sure we don't have a REST api that would function before an admin user has been created. You would have to POST the form data for both the database and admin user.
Some other alternatives.
We have a 'dev' profile that is used in development mode, which you can enable directly with the following system property. This creates a 3 day license and adds the default 'admin' user.
Before you start the server add a stash-config.properties file to your intended stash home directory (ie can be empty), and set the required database properties:
jdbc.driver=org.postgresql.Driver jdbc.url=jdbc:postgresql://localhost:5432/stash jdbc.user=user jdbc.password=password
Once Stash has started you can then use the hard-coded admin username/password to now update the license via REST.
Alternatively you could pre-seed a database with the correct base information, much like this customer has done for their deb scripts:
We are definitely planning on allowing for more automated installations, but that's not likely to happen in the next 6 months.
dev profile worked like a charm. Thanks Charles. A couple of quick follow up questions:
1. What additional (side)effects does stash have while running in dev profile?
2. After making the required changes, i.e., adding a license, and creating a new admin user, if i restart stash without the dev profile, would effects of #1 (if any) go away?
Glad that worked for you.
1. Nothing. At the moment dev profile only creates the admin user and sets the license once, after that it will not have any effect.*
2. Removing or leaving the profile won't change anything after the initial run. It's really only meant as a simple way to bootstrap the application for development.
* Not to be confused with dev mode which changes the behaviour of the application for enabling developers to work on the Atlassian platform. Dev profile is not the same thing.
Thanks for the clarifications Charles. One last thing, I dont see any documentation around the dev profile. Is this feature something that's expected to be continued/extended, or something that just the wizzards like ya know :), and could be pulled out any time?
It would be really nice to be able to simply have a similar defined fetureset in the rest api, where in, during first boot, the endpoints are available to create the admin user. Subsequently, once the first admin user is created, the endpoint could be disabled. This would greatly help in automation integration with toolsets like chef/puppet.
While it's not a publicly document feature/property, it's something that we have had since Stash 1.0 and I don't see changing any time soon.
I agree that we need a better (and official) way of bootstrapping an instance. I think it may take the form of a number of system properties or more likely a configuration file, but that's only a hunch.
You may want to follow the following, which I suspect is where this work would eventually be done under and then announced.
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs