Skip to content

Commit d76669d

Browse files
authored
Merge pull request #80 from HSLdevcom/DT-6700
DT-6700 Replace standard with prettier and eslint
2 parents 84a5009 + 24e92f7 commit d76669d

19 files changed

Lines changed: 1348 additions & 3545 deletions

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Prettier and eslint automatic formatting/linting
2+
b79fcf2c596c359151b2955733e0e772feaa2b51
3+

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"arrowParens": "avoid",
3+
"endOfLine": "auto",
4+
"singleQuote": true,
5+
"trailingComma": "all"
6+
}

README.md

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[![Build](https://github.com/hsldevcom/digitransit-deployer/workflows/Process%20master%20push/badge.svg)](https://github.com/HSLdevcom/digitransit-deployer/actions)
22

3-
43
## Autodeployer, autorestarter and monitoring for Digitransit deployments
54

65
We deploy digitransit docker images automatically from Docker Hub. When a Docker image of a kubernetes deployment that we have deployed in our environment is updated at Docker Hub the new image is deployed automatically.
@@ -12,16 +11,18 @@ Additionally, some deployments are restarted periodically.
1211
## Env variable configuration
1312

1413
These following environmental variables should be added:
15-
* "SLACK_ACCESS_TOKEN" access token used for sending slack messages through a Slack app
16-
* "MONITORING_SLACK_CHANNEL_ID" slack channel id (not the name) for most of the Slack messages
17-
* "ALERT_SLACK_CHANNEL_ID" slack channel id (not the name) for sending messages about image freshness checks
18-
* "DOCKER_USER" docker user that is used for interacting with the Docker API
19-
* "DOCKER_AUTH" docker password that is used for interacting with the Docker API
20-
* "TZ" optional timezone (defaults to "Europe/Helsinki")
14+
15+
- "SLACK_ACCESS_TOKEN" access token used for sending slack messages through a Slack app
16+
- "MONITORING_SLACK_CHANNEL_ID" slack channel id (not the name) for most of the Slack messages
17+
- "ALERT_SLACK_CHANNEL_ID" slack channel id (not the name) for sending messages about image freshness checks
18+
- "DOCKER_USER" docker user that is used for interacting with the Docker API
19+
- "DOCKER_AUTH" docker password that is used for interacting with the Docker API
20+
- "TZ" optional timezone (defaults to "Europe/Helsinki")
2121

2222
## Prerequisites
2323

2424
Deployments should have the following labels defined as deployer uses `app` as an identifier for finding deployments/pods.
25+
2526
```yaml
2627
metadata:
2728
name: <deployment name>
@@ -39,41 +40,46 @@ spec:
3940
Deployer configuration is stored in labels. For example take a look at https://github.com/HSLdevcom/digitransit-kubernetes-deploy/blob/master/roles/aks-apply/files/prod/opentripplanner-hsl-prod.yml where we have labels set as follows:
4041
4142
```yaml
42-
metadata:
43-
labels:
44-
update: "auto"
45-
restartAfterDeployments: "digitransit-ui-hsl-v3"
46-
restartDelay: "5"
43+
metadata:
44+
labels:
45+
update: 'auto'
46+
restartAfterDeployments: 'digitransit-ui-hsl-v3'
47+
restartDelay: '5'
4748
```
4849
4950
### update: "auto"
51+
5052
Automatic image updates are enabled for deployment.
5153
5254
### restartAfterDeployments: "opentripplanner-data-con-hsl"
55+
5356
Restart this deployment when deployment opentripplanner-data-con-hsl is restarted.
5457
It is possible to add multiple dependencies by separating them with underscore
5558
5659
### restartDelay: "1"
60+
5761
Wait at minimum 1 minute before restarting this deployment (because of dependant deployment has restarted)
5862
5963
## Cron style autorestarter configuration
6064
6165
Labels are also used for the periodic (cron style) restarts. These labels can coexist with the labels required for the auto deployments. Example label use below:
6266
6367
```yaml
64-
metadata:
65-
labels:
66-
update: "auto"
67-
restartAfterDeployments: "digitransit-ui-hsl-v3"
68-
restartDelay: "1"
69-
restartAt: "04.30"
70-
restartLimitInterval: "240"
68+
metadata:
69+
labels:
70+
update: 'auto'
71+
restartAfterDeployments: 'digitransit-ui-hsl-v3'
72+
restartDelay: '1'
73+
restartAt: '04.30'
74+
restartLimitInterval: '240'
7175
```
7276
7377
### restartAt: "04.30"
78+
7479
Restarts deployment at 04:30. Attempts to restart deployment stop after deployment has been successfully restarted or an hour has passed. It is possible to define multiple restart points by separating them with underscores, for example "restartAt": "13.00_18.50".
7580
7681
### restartLimitInterval: "240"
82+
7783
Optional label that defines in minutes how long time has to be since the last restart for a restart to trigger at the time defined in "restartAt" label. If "restartLimitInterval" is not defined, the default value will be 1080 minutes (18 hours).
7884
7985
## Deployment image freshness monitoring
@@ -83,15 +89,17 @@ Optionally, it can be checked that an image has been updated within the last 12
8389
Example config:
8490
8591
```yaml
86-
metadata:
87-
labels:
88-
update: "auto"
89-
checkImageFreshnessAt: "09.00"
90-
imageFreshnessTitle: "Service_X"
92+
metadata:
93+
labels:
94+
update: 'auto'
95+
checkImageFreshnessAt: '09.00'
96+
imageFreshnessTitle: 'Service_X'
9197
```
9298
9399
### checkImageFreshnessAt: "04.30"
100+
94101
Label that defines when the check is done in `hh.mm`. If multiple deployments have identical check times, the checks and messaging are grouped together.
95102

96103
### imageFreshnessTitle: "240"
104+
97105
The title which is used for the deployment when messaging about image freshness over slack.

eslint.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import globals from 'globals';
2+
import pluginJs from '@eslint/js';
3+
4+
/** @type {import('eslint').Linter.Config[]} */
5+
export default [
6+
{ languageOptions: { globals: globals.node } },
7+
pluginJs.configs.recommended,
8+
];

0 commit comments

Comments
 (0)