Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tasks": {
"test": "npm install && npm test",
"build": "npm install && npm run build",
"launch": "npm start"
}
}
20 changes: 20 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"env": {
"browser": true,
"node": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"rules": {
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "single"],
"semi": ["error", "always"],
"no-unused-vars": ["warn"],
"no-console": "off"
}
}
2 changes: 2 additions & 0 deletions .github/workflows/.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: Attest Build Provenance
uses: actions/[email protected]
2 changes: 2 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: npm install
- run: npm run lint
- run: npm run format
- run: npm test
44 changes: 44 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install dependencies
run: npm install

- name: Build project
run: npm run build

- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/slerf.com:latest .

- name: Push Docker image
run: docker push ${{ secrets.DOCKER_USERNAME }}/slerf.com:latest

- name: Set up kubectl
uses: azure/setup-kubectl@v1
with:
version: 'v1.21.0'

- name: Deploy to Kubernetes
run: |
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"arrowParens": "always"
}
6 changes: 6 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ module.exports = function(grunt) {
}
},

eslint: {
target: ['src/js/*.js', 'tasks/**/*.js']
},

copy: {
assets: {
files: [{
Expand Down Expand Up @@ -214,6 +218,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-puglint');
grunt.loadNpmTasks('grunt-eslint');
}

grunt.registerTask('build', 'Build the site for production', [
Expand All @@ -232,6 +237,7 @@ module.exports = function(grunt) {
grunt.registerTask('test', [
'build',
'jshint',
'eslint',
'puglint',
// Requires Java 8+
'htmllint'
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ use the development mode instead:
```shell
npm run dev
```

4. Run linting:
```shell
npm run lint
```

5. Run formatting:
```shell
npm run format
```
20 changes: 20 additions & 0 deletions branch-protection-rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"required_status_checks": {
"strict": true,
"contexts": [
"ci/circleci: build",
"ci/circleci: test"
]
},
"enforce_admins": true,
"required_pull_request_reviews": {
"dismiss_stale_reviews": true,
"require_code_owner_reviews": true,
"required_approving_review_count": 2
},
"restrictions": {
"users": [],
"teams": [],
"apps": []
}
}
42 changes: 42 additions & 0 deletions monitoring-logging-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: monitoring-logging-config
namespace: monitoring
data:
prometheus.yml: |
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'kubernetes-apiservers'
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep
regex: default;kubernetes;https
grafana.ini: |
[server]
http_port = 3000
[auth]
disable_login_form = false
[auth.anonymous]
enabled = true
logstash.conf: |
input {
file {
path => "/var/log/*.log"
start_position => "beginning"
}
}
filter {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
}
output {
elasticsearch {
hosts => ["http://elasticsearch:9200"]
}
stdout { codec => rubydebug }
}
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"build": "grunt build",
"start": "node server.js",
"test": "grunt test",
"dev": "grunt dev"
"dev": "grunt dev",
"lint": "eslint .",
"format": "prettier --write ."
},
"private": true,
"dependencies": {
Expand Down Expand Up @@ -52,6 +54,9 @@
"grunt-html": "~17.0.1",
"grunt-nodemon": "~0.4.2",
"grunt-open": "^0.2.4",
"grunt-puglint": "~1.0.0"
"grunt-puglint": "~1.0.0",
"eslint": "^8.0.0",
"prettier": "^2.0.0",
"grunt-eslint": "^23.0.0"
}
}
1 change: 1 addition & 0 deletions src/js/plugins.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* jshint browser:true, jquery:true, node:false */
/* global jQuery */

(function ($) {
'use strict';
Expand Down