Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Atlassian Stash automation

V G December 30, 2013

Hello Stashers,

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.

Thanks,

VG

1 answer

1 accepted

1 vote
Answer accepted
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 31, 2013

Hi VG,

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.

-Dstash.spring.profiles=dev

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:

https://bitbucket.org/lelik/atlassian-stash-deb

We are definitely planning on allowing for more automated installations, but that's not likely to happen in the next 6 months.

Cheers,

Charles

Newzify December 31, 2013

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?

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 31, 2013

Hi,

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.

Charles

* 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.

Newzify December 31, 2013

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.

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 31, 2013

Hi,

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.

https://jira.atlassian.com/browse/STASH-3181

Cheers,

Charles

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events