I'm using Chef to automate the development, CI, QA, and deployment pipeline of our company. However, when writing the TeamCity cookbook recipe, it becomes obvious that the installation process for TeamCity can't be fully automated, as there are manual steps required in order to do so, especially when installing and configuring TeamCity to use an external database - a necessity for production use.
1. When TeamCity has been installed and started, the data directory (.BuildServer) isn't created until the op uses a browser to go to the web interface and creates the first admin. There doesn't seem to be a way of programmatically creating the first admin. This, in itself, makes it impossible to fully automate the installation and setup process, as the REST API can't be used until there's an admin account whose credentials can be used.
2. To set up an external database, such as MySQL, the .BuildServer directory must exist, as the installation process involves modifying its contents.
As it is now, the Chef recipe has to work in several stages, some of which can be automated and some which cannot. The following comments are an excerpt from the Chef TeamCity recipe and describe the process in detail. The basic installation (download, unpack, set up init.d scripts, start, etc) is automatic. The comments pertain to what happens next:
# At this point, TeamCity must be bootstrapped manually - it can't be done programmatically. :-(
# Do the following:
# 1. Surf to http://teamcity.example.com:8111
# 2. Create an admin. Username and password don't matter - this is just to generate the DB.
# 3. Don't bother with creating anything else. All info will be erased, including the admin.
# 4. Run chef-client again on the TeamCity server. This will download, install and set up
# the MySQL connection.
# 5. Surf to http://teamcity.example.com:8111 once more. The page will tell you that an admin
# needs to rescue the DB. This is normal. To find the admin token it asks for, follow
# the instructions on screen. You need to examine the tail of a log file on the server.
# 6. Input the token and press the button.
# 7. After a few seconds, the TeamCity server becomes available again.
# 8. Create your admins, projects, etc.
# From this point on, Chef will keep everything in shape for you.
My question is the following: is there a way to accomplish all this programmatically? Scouring the documentation hasn't yielded anything so far.
Thanks for any ideas,
/ Peter Bengtson