Skip to content

Commit

Permalink
Added TeamCity
Browse files Browse the repository at this point in the history
  • Loading branch information
btr1975 committed Sep 7, 2021
1 parent 5557e1b commit 56ad56b
Show file tree
Hide file tree
Showing 13 changed files with 262 additions and 2 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ http://<ip or domain name>:5000/v2/<repo-name>/tags/list

![Automation Framework Swarm](diagrams/automation_framework_swarm.png)

### What is Available in Compose and Kubernetes
### What is Available in Compose

| ARCHITECTURE | USED FOR |
|---|---|
Expand All @@ -139,5 +139,20 @@ http://<ip or domain name>:5000/v2/<repo-name>/tags/list
| Grafana | Pretty Graphs |
| Docker Registry | To hold docker images |
| Docker Registry Browser | To Browse the Registry |
| JetBrains TeamCity | CI/CD |

![Automation Framework Compose](diagrams/automation_framework_compose.png)

### What is Available in Kubernetes

| ARCHITECTURE | USED FOR |
|---|---|
| ELK Elastic Search | Logging search, various other stuff |
| Hashicorp Vault | Secrets Storage |
| MongoDB | Document dB |
| Batfish | Modeling |
| Influxdb | Series dB |
| Grafana | Pretty Graphs |
| JetBrains TeamCity | CI/CD |

![Automation Framework Compose](diagrams/automation_framework_kubernetes.png)
Binary file modified diagrams/automation_framework_compose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions diagrams/automation_framework_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from diagrams.onprem.database import Mongodb
from diagrams.onprem.database import Influxdb
from diagrams.onprem.monitoring import Grafana
from diagrams.onprem.ci import TC


def main():
Expand Down Expand Up @@ -95,6 +96,9 @@ def main():
mongodb_express
]

with Cluster('CI/CD'):
team_city = TC('TeamCity')

kafka_brokers - python_container

python_container - vault
Expand Down
88 changes: 88 additions & 0 deletions diagrams/automation_framework_k8s.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
from diagrams import Diagram, Cluster, Edge
from diagrams.custom import Custom
from diagrams.onprem.security import Vault
from diagrams.onprem.network import Zookeeper
from diagrams.onprem.queue import Kafka
from diagrams.elastic.elasticsearch import Elasticsearch
from diagrams.elastic.elasticsearch import Kibana
from diagrams.elastic.elasticsearch import Logstash
from diagrams.onprem.container import Docker
from diagrams.programming.language import Python
from diagrams.generic.storage import Storage
from diagrams.onprem.database import Mongodb
from diagrams.onprem.database import Influxdb
from diagrams.onprem.monitoring import Grafana
from diagrams.onprem.ci import TC


def main():
graph_attr = {
"fontsize": "45",
'overlap_scaling': '100',
'size': '24!',
'ratio': 'expand'
}

with Diagram(name='Automation Framework Kubernetes', direction='LR', graph_attr=graph_attr):
with Cluster('Docker Cluster'):
docker = Docker('Docker')

with Cluster('container1'):
python_container = Python('APIs\nOther Microservices')

with Cluster('Docker Registry'):
docker_registry_container = Docker('Docker Registry\ntcp:5000')

with Cluster('Docker Registry Browser'):
docker_registry_browser_container = Python('Docker Registry Browser\ntcp:8088')

with Cluster('BatFish'):
batfish_container = Custom('BatFish\ntcp:8888\ntcp:9997\ntcp:9996', 'custom_icons/BatFish.png')

with Cluster('Secrets Managers'):
vault = Vault('HashiCorp Vault\ntcp:8200')
secrets_managers = [
vault,
]

with Cluster('Logging and Search'):
with Cluster('ELK Stack'):
elastic_search = Elasticsearch('Elastic Search\ntcp:9200')
kibana = Kibana('Kibana\ntcp:5601')
logstash = Logstash('Logstash\ntcp:5044')
search_log = [
elastic_search,
kibana,
logstash
]

with Cluster('Influxdb'):
infulxdb = Influxdb('Influxdb\ntcp:8086')

with Cluster('Grafana'):
grafana = Grafana('Grafana\ntcp:3000')

with Cluster('Database'):
with Cluster('Mongo dB'):
mongodb = Mongodb('MongoDb\ntcp:27017')
mongodb_express = Mongodb('MongoDb Express\ntcp:8181')
mongo_group = [
mongodb,
mongodb_express
]

with Cluster('CI/CD'):
team_city = TC('TeamCity')


python_container - vault

python_container - logstash

python_container - infulxdb

python_container - mongodb


if __name__ == '__main__':
main()
Binary file added diagrams/automation_framework_kubernetes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions docker/compose/docker-compose-teamcity-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
version: '3.4'
services:
teamcity-server-instance:
image: jetbrains/teamcity-server:latest
container_name: teamcity-server-instance
ports:
- 8111:8111
volumes:
- "teamcity-server-datadir-compose:/data/teamcity_server/datadir"
- "teamcity-server-logs-compose:/opt/teamcity/logs"
restart: on-failure
teamcity-agent-1:
build:
context: ../dockerfile
dockerfile: Dockerfile-Python-Agent
image: localhost:32000/teamcity-agent-python:latest
container_name: teamcity-agent-1
environment:
SERVER_URL: http://10.0.0.102:8111
volumes:
- "teamcity-agent-1-conf-compose:/data/teamcity_agent/conf"
restart: on-failure

volumes:
teamcity-server-datadir-compose:
teamcity-server-logs-compose:
teamcity-agent-1-conf-compose:
13 changes: 13 additions & 0 deletions docker/dockerfile/Dockerfile-Python-Agent
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM jetbrains/teamcity-agent:EAP-linux-sudo

LABEL version="2021.9.6.001"
LABEL description="TeamCity Python3 agent"
LABEL maintainer="Ben Trachtenberg"

SHELL ["/bin/bash", "-c"]

RUN sudo apt-get update \
&& sudo apt-get install -qy \
python3-pip \
python3-venv

32 changes: 32 additions & 0 deletions k8s/teamcity-latest-lb/teamcity-agent-python-latest-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--- # Version 2021.9.6.001
apiVersion: apps/v1
kind: Deployment
metadata:
name: teamcity-agent-python
labels:
app: teamcity-agent-python
spec:
replicas: 1
selector:
matchLabels:
app: teamcity-agent-python
template:
metadata:
labels:
app: teamcity-agent-python
spec:
terminationGracePeriodSeconds: 1
containers:
- name: teamcity-agent-python
image: localhost:32000/teamcity-agent-python:latest
imagePullPolicy: Always
env:
- name: SERVER_URL
value: "http://teamcity-server:8111"
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "500Mi"
cpu: "500m"
43 changes: 43 additions & 0 deletions k8s/teamcity-latest-lb/teamcity-server-latest-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--- # Version 2021.9.6.001
apiVersion: apps/v1
kind: Deployment
metadata:
name: teamcity-server
labels:
app: teamcity-server
spec:
replicas: 1
selector:
matchLabels:
app: teamcity-server
template:
metadata:
labels:
app: teamcity-server
spec:
terminationGracePeriodSeconds: 1
containers:
- name: teamcity-server
image: jetbrains/teamcity-server:latest
imagePullPolicy: Always
ports:
- containerPort: 8111
resources:
requests:
memory: "2Gi"
cpu: "500m"
limits:
memory: "4Gi"
cpu: "1"
volumeMounts:
- name: teamcity-server-datadir
mountPath: /data/teamcity_server/datadir
- name: teamcity-server-logs
mountPath: /opt/teamcity/logs
volumes:
- name: teamcity-server-datadir
persistentVolumeClaim:
claimName: teamcity-server-datadir-claim
- name: teamcity-server-logs
persistentVolumeClaim:
claimName: teamcity-server-logs-claim
13 changes: 13 additions & 0 deletions k8s/teamcity-latest-lb/teamcity-server-latest-service-lb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: Service
metadata:
name: teamcity-server
spec:
type: LoadBalancer
ports:
- port: 8111
targetPort: 8111
name: teamcity-server-gui
selector:
app: teamcity-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- # Version 2021.9.6.001
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: teamcity-server-datadir-claim
spec:
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: 20Gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- # Version 2021.9.6.001
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: teamcity-server-logs-claim
spec:
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: 20Gi
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ pytest-html~=3.1.1
coverage~=5.5.0
pylint~=2.8.2
sphinx~=4.0.0
diagrams~=0.19.0
diagrams~=0.20.0

0 comments on commit 56ad56b

Please sign in to comment.