This is a template to be used when creating new spring boot microservices.
It provides a simple rest controller as an example. When running, you can access the rest endpoint with:
curl http://localhost:8080/config
The script requires rename & gnu-sed applications, install via brew.
brew install rename gnu-sed
The new app uses gradle 4.0, you will likely need IntelliJ 2016.3.6 or newer.
If you get the following error:
Gradle project error - java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
You need to upgrade.
export APP_NAME_PREFIX=simple
# Clone the template repo
git clone git@github.com:turo/coroutine-demo-msvc.git ${APP_NAME_PREFIX}-msvc
cd ${APP_NAME_PREFIX}-msvc
# remove the previous .git directory
rm -rf .git
# Run script to rename your porject
./rename-project.sh $APP_NAME_PREFIX
rm rename-project.sh
# create new git repo
git init .
git add .
git commit -m "Copy of coroutine-demo-msvc into $APP_NAME_PREFIX"git remote add origin git@github.com:turo/$APP_NAME_PREFIX-msvc.git
git push -u origin master- Goto Teamcity: Microservices
- Select create subproject
- Select
manually - Set the name to be your project
coroutine-demo-msvc
- Add a VCS root by going to the
VCS Rootssection on the right side - Select
Create VCS Root - Set
Type of VCStoGit - Set the
VCS root nametocoroutine-demo-msvc - The
VCS root IDshould automatically beMicroservices_CoroutineDemoMsvc_CoroutineDemoMsvc - Copy the git ssh URL, it should look like
git@github.com:turo/coroutine-demo-msvc.git - Enter the following branch spec
+:refs/heads/*
+:refs/pull/(*/merge)
- Set
Authentication MethodtoUploaded key - Set
Uploaded keytorollsbot TeamCity ssh - Click
Test Connection-- it should be successful - Click
Create
- Select the
Versioned settingssection on the right - Select
Synchronization enabled - Choose the VCS root you just created in the
Project settings VCS rootdrop down - Select
Use settings from VCS - Check
Show settings changes in builds - Check
Store secure values (like passwords or API tokens) outside of VCS - Select
Settings formataskotlin - Select
Apply - You should see a dialog
The settings of the following projects were found in the VCS:-- SelectLoad project settings from VCS
- update the commit status publisher in features
- open the build configuration
- go to the
build featuressection - select the
commit status publisher - copy the teamcity token from the github rollsbot account
- paste it into the github token
At this point, you should see the status messages at the bottom of the page. If there are issues, you can update the config and try reloading it.
Setup pre-commit
-
pre-commit-jvm requires the following to run: pre-commit(2.8+)
brew install pre-commitCoursierbrew install coursier/formulas/coursier -
Install the git hooks using
pre-commit installto set up the git hook scripts -
The following checks will run on git commit: Check Yaml...............................................................Passed Fix End of Files.........................................................Passed Trim Trailing Whitespace.................................................Passed Kotlin static analysis...................................................Passed