Code Monkey home page Code Monkey logo

teamcity-azure-template's Introduction

TeamCity Azure Resource Manager Template

This deployment template is deprecated and will no longer receive active support. It serves for illustrative purposes and is not a production-ready TeamCity installation

obsolete project

The template allows deploying a TeamCity server and agent in Azure cloud. It creates a MySQL database, a virtual machine with Flatcar Container Linux and starts TeamCity in a docker container.

During deployment will be created TeamCity server deployment with auto-retrieval of SSL certificate for domain name from the Let's Encrypt and nginx reverse proxy.

Deploy to Azure

Note: You need to deploy it into a dedicated resource group. Deployment will take around 10 minutes, use teamcityUrl template output value to access the TeamCity web UI.

Parameters

TeamCity Version

Allows specifying the required version of TeamCity for deployment.

Installation Size

List of pre-configured installation types:

Installation Size Typical Usage VM Size VM Data Disk Database
Small 3 users, 100 builds/day Standard_A2_v2 32 GB HDD Basic / 50 DTU / 50 GB
Medium 5 users, 300 builds/day Standard_F2s 64 GB SSD Basic / 100 DTU / 50 GB
Large 20 users, 1000 builds/day Standard_F4s 128 GB SSD Standard / 100 DTU / 125 GB

Note: Pricing for Azure virtual machines and MySQL database.

VM Admin Username

Allows specifying username to login to a virtual machine where TeamCity is running.

SSH Key Data

Allows specifying a publish ssh key for the user used to connect to virtial machine with TeamCity.

Database Password

Allows specifying password for the MySQL database.

Configuration

After deployment you will be able to connect to the teamcity virtual machine via SSH. In Flatcar Container Linux TeamCity works as the following systemd service:

  • teamcity-server.service - launches TeamCity server.
  • teamcity-agent.service - launches TeamCity agent.
  • teamcity-update.service - check for TeamCity version updates.
  • nginx.service - provides reverse proxy for TeamCity server.
  • letsencrypt.service - executes auto SSL certificate retrieval for domain name.

To diagnose problems you could use the following commands:

  • sudo systemctl (start|stop|status|restart) <serviceName> - to manage service operation state.
  • sudo journalctl -u <serviceName> - to view history of service log.
  • sudo journalctl -f -u <serviceName> - to execute tail view of service log.

Installed Plugins

The template installs the following Azure integrations in TeamCity:

TeamCity Update

During deployment, a teamcity virtual machine will be tagged with the teamcity-version tag. To change the TeamCity version, you need to update the tag value and restart the teamcity-server.service and teamcity-agent.service systemd services or the virtual machine.

Note: in case of TeamCity data upgrade to access server log connect to the vm and execute the following command to view required authentication token: sudo journalctl -f -u teamcity-server

Feedback

Please feel free to send a PR or file an issue in the TeamCity issue tracker.

teamcity-azure-template's People

Contributors

dimyriy avatar dmitry-treskunov avatar dtretyakov avatar ilyafomenko avatar julia-alexandrova avatar ludeknovy avatar mkjetbrains avatar pavelsher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

teamcity-azure-template's Issues

Unable to install Microsoft Monitoring Agent(MMA) on Team city VM

The security center recommendations mandate installing an MMA on each VM.
image

After enabling the agent is inactive with "Agent not responsive or missing ID"
image
Trying to manully install agent via steps at https://docs.microsoft.com/en-us/azure/azure-monitor/learn/quick-collect-azurevm or https://docs.microsoft.com/en-us/azure/azure-monitor/learn/quick-collect-linux-computer doesn't work since there is no rpm manager in CoreOS

image

How to we add monitoring and security on the teamcity VM?

Azure template has bad syntax

In commit 9c8b769, it appears the curl command was partially deleted in azuredeploy.json and the cat command was partially deleted in cloud-config.yaml.

This is causing the TeamCity server to fail to start. The resources can deploy successfully but the TeamCity server is not configured correctly and will fail to start.

Database upgrade fails with Could not connect to MySQL server: SQL error when doing 'Connection.setAutoCommit(false)'

During database converters execution upgrade may fails with the following exception:

Feb 12 11:26:05 teamcity docker[2043]: [2019-02-12 11:26:05,092]  ERROR -  jetbrains.buildServer.STARTUP - Exception UnknownUpgradeError in stage UPGRADE: Upgrading error: Could not connect to MySQL server: SQL error when doing 'Connection.setAutoCommit(false)': com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 936,932 milliseconds ago.  The last packet sent successfully to the server was 936,935 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. Caused by: java.net.SocketException: Connection reset
Feb 12 11:26:05 teamcity docker[2043]: jetbrains.buildServer.maintenance.exceptions.UnknownUpgradeError: Upgrading error: Could not connect to MySQL server: SQL error when doing 'Connection.setAutoCommit(false)': com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 936,932 milliseconds ago.  The last packet sent successfully to the server was 936,935 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. Caused by: java.net.SocketException: Connection reset
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.maintenance.StartupProcessor.doUpgrade(StartupProcessor.java:1000)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.maintenance.StartupProcessor.access$1400(StartupProcessor.java:1039)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.maintenance.StartupProcessor$3.call(StartupProcessor.java:13)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:91)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.maintenance.StartupProcessor.processConcreteStage(StartupProcessor.java:568)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.maintenance.StartupProcessor.processConcreteStageSafe(StartupProcessor.java:569)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.maintenance.StartupProcessor.processTeamCityLifecycle(StartupProcessor.java:769)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.maintenance.StartupProcessor.access$000(StartupProcessor.java:869)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.maintenance.StartupProcessor$1.run(StartupProcessor.java:3)
Feb 12 11:26:05 teamcity docker[2043]:         at java.lang.Thread.run(Thread.java:748)
Feb 12 11:26:05 teamcity docker[2043]: Caused by: jetbrains.buildServer.serverSide.db.DatabaseIsNotReachableException: Could not connect to MySQL server: SQL error when doing 'Connection.setAutoCommit(false)': com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 936,932 milliseconds ago.  The last packet sent successfully to the server was 936,935 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. Caused by: java.net.SocketException: Connection reset
Feb 12 11:26:05 teamcity docker[2043]:         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Feb 12 11:26:05 teamcity docker[2043]:         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
Feb 12 11:26:05 teamcity docker[2043]:         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
Feb 12 11:26:05 teamcity docker[2043]:         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
Feb 12 11:26:05 teamcity docker[2043]:         at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
Feb 12 11:26:05 teamcity docker[2043]:         at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)
Feb 12 11:26:05 teamcity docker[2043]:         at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3746)
Feb 12 11:26:05 teamcity docker[2043]:         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2509)
Feb 12 11:26:05 teamcity docker[2043]:         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
Feb 12 11:26:05 teamcity docker[2043]:         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2480)
Feb 12 11:26:05 teamcity docker[2043]:         at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4811)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.serverSide.db.DBFunctions.setAutoCommit(DBFunctions.java:1088)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverter(ConvertPerformer.java:108)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverters(ConvertPerformer.java:87)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.serverSide.versioning.VersionManager.upgradeIt(VersionManager.java:381)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.maintenance.StartupProcessor$UpgradePerformer.doUpgrade(StartupProcessor.java:3)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.maintenance.StartupProcessor.lambda$doUpgrade$7(StartupProcessor.java:882)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager$3.run(TeamCityDatabaseManager.java:942)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager$3.run(TeamCityDatabaseManager.java:937)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager.withMaintenanceDBF(TeamCityDatabaseManager.java:921)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager.withMaintenanceDBF(TeamCityDatabaseManager.java:937)
Feb 12 11:26:05 teamcity docker[2043]:         at jetbrains.buildServer.maintenance.StartupProcessor.doUpgrade(StartupProcessor.java:554)
Feb 12 11:26:05 teamcity docker[2043]:         ... 9 more
Feb 12 11:26:05 teamcity docker[2043]: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 936,932 milliseconds ago.  The last packet sent successfully to the server was 936,935 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
Feb 12 11:26:05 teamcity docker[2043]:         ... 31 more
Feb 12 11:26:05 teamcity docker[2043]: Caused by: java.net.SocketException: Connection reset
Feb 12 11:26:05 teamcity docker[2043]:         at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:115)
Feb 12 11:26:05 teamcity docker[2043]:         at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
Feb 12 11:26:05 teamcity docker[2043]:         at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
Feb 12 11:26:05 teamcity docker[2043]:         at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
Feb 12 11:26:05 teamcity docker[2043]:         at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3728)
Feb 12 11:26:05 teamcity docker[2043]:         ... 24 more

Override default sql parameters

According to the docs:

Use it like this in your template.. Replace wait_timeout with max_allowed_packet. It should work. Change 123 to your value you want wait_timeout to be. Update the dependsOn to match your servers/servername value.

{
                "name": "wait_timeout",

                  "type": "configurations",

                  "apiVersion": "2017-04-30-preview",

                  "dependsOn": [

                        "[concat('Microsoft.DBforMySQL/servers/', parameters('serverName'))]"

                    ],

                  "properties": {

                    "value": "123",

                    "source": "user-override"

                  }

                }

To get data could be used following method:
https://docs.microsoft.com/en-us/rest/api/mysql/configurations/listbyserver

SSL guidance

Is there any guidance for enabling SSL using this setup? There seems to be much more involved than just opening the firewall rule for HTTPS for the VM.

Deploy template button deployment fails

I have tried deploying the template a couple of times. It fails with this error:

{ "code": "DeploymentFailed", "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.", "details": [ { "code": "BadRequest", "message": "{\r\n \"error\": {\r\n \"code\": \"RoleAssignmentUpdateNotPermitted\",\r\n \"message\": \"Tenant ID, application ID, principal ID, and scope are not allowed to be updated.\"\r\n }\r\n}" } ] }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.