Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
roncli committed Jan 18, 2024
1 parent 8b1b585 commit 1cbb627
Show file tree
Hide file tree
Showing 27 changed files with 1,385 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.whitesource
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
32 changes: 32 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,32 @@
version: 2
updates:
- package-ecosystem: "docker"
directory: /logging/
schedule:
interval: "daily"
time: "05:00"
timezone: "America/Los_Angeles"
ignore:
- dependency-name: "node"
versions: [">= 21.0"]
- package-ecosystem: "docker"
directory: /node/
schedule:
interval: "daily"
time: "05:00"
timezone: "America/Los_Angeles"
ignore:
- dependency-name: "node"
versions: [">= 21.0"]
- package-ecosystem: "npm"
directory: /logging/
schedule:
interval: "daily"
time: "05:00"
timezone: "America/Los_Angeles"
- package-ecosystem: "npm"
directory: /node/
schedule:
interval: "daily"
time: "05:00"
timezone: "America/Los_Angeles"
23 changes: 23 additions & 0 deletions .github/workflows/automerge.yml
@@ -0,0 +1,23 @@
name: Dependabot automerge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{github.actor == 'dependabot[bot]'}}
steps:
- name: Metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{secrets.GITHUB_TOKEN}}"
- name: Automerge
if: ${{contains(steps.metadata.outputs.dependency-names, '@babel/') || contains(steps.metadata.outputs.dependency-names, '@types/') || steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
73 changes: 73 additions & 0 deletions .gitignore
@@ -0,0 +1,73 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# Industry Medium font
IndustryMedium.*

# secrets
secrets/**

# vscode
.vscode/**

# Madge graph.svg
graph.svg
6 changes: 6 additions & 0 deletions README.md
@@ -1,2 +1,8 @@
# sprint-racebot

A race bot for the SPRINT racing league.

# Version History

# v0.0.1
* Initial version.
60 changes: 60 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,60 @@
version: "3.7"

services:

logging:
container_name: sprint-racebot-logging
build: ./logging
ports:
- "12201:12201/udp"
environment:
PORT: 12201
APPINSIGHTS_PERFORMANCE_METRICS: 0
APPINSIGHTS_INSTRUMENTATIONKEY: /run/secrets/APPINSIGHTS_INSTRUMENTATIONKEY
APPLICATION: sprint-racebot
secrets:
- APPINSIGHTS_INSTRUMENTATIONKEY
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
entrypoint: /var/logging/start.sh

node:
container_name: sprint-racebot-node
build: ./node
depends_on:
- logging
- db
- redis
networks:
- sprint-racebot-network
logging:
driver: "gelf"
options:
gelf-address: "udp://localhost:12201"
environment:
APPINSIGHTS_INSTRUMENTATIONKEY: /run/secrets/APPINSIGHTS_INSTRUMENTATIONKEY
DISCORD_CLIENTID_FILE: /run/secrets/DISCORD_CLIENTID_FILE
DISCORD_GUILD_ID: "814373385349890068"
DISCORD_TOKEN_FILE: /run/secrets/DISCORD_TOKEN_FILE
NODE_ENV: production
PORT: 3030
secrets:
- APPINSIGHTS_INSTRUMENTATIONKEY
- DISCORD_CLIENTID_FILE
- DISCORD_TOKEN_FILE
restart: always
entrypoint: /var/www/start.sh
privileged: true

networks:
sprint-racebot-network:
driver: bridge

secrets:
APPINSIGHTS_INSTRUMENTATIONKEY:
file: ./secrets/APPINSIGHTS_INSTRUMENTATIONKEY
DISCORD_CLIENTID_FILE:
file: ./secrets/DISCORD_CLIENTID_FILE
DISCORD_TOKEN_FILE:
file: ./secrets/DISCORD_TOKEN_FILE
3 changes: 3 additions & 0 deletions logging/.dockerignore
@@ -0,0 +1,3 @@
node_modules
.dockerignore
Dockerfile
113 changes: 113 additions & 0 deletions logging/.eslintrc
@@ -0,0 +1,113 @@
{
"env": {
"es6": true,
"node": true
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 7,
"requireConfigFile": false
},
"parser": "@babel\\eslint-parser",
"extends": "eslint:all",
"rules": {
"array-element-newline": "off",
"capitalized-comments": "off",
"class-methods-use-this": "off",
"complexity": "off",
"consistent-this": "off",
"default-case": "off",
"dot-location": "off",
"func-names": "off",
"function-call-argument-newline": "off",
"global-require": "off",
"id-length": "off",
"indent": [
"error", 4, {
"SwitchCase": 1
}
],
"init-declarations": "off",
"line-comment-position": "off",
"linebreak-style": "off",
"lines-around-comment": "off",
"max-depth": "off",
"max-len": "off",
"max-lines": "off",
"max-lines-per-function": "off",
"max-params": "off",
"max-statements": "off",
"multiline-comment-style": "off",
"multiline-ternary": "off",
"new-cap": [
"error",
{"properties": false}
],
"newline-per-chained-call": "off",
"no-await-in-loop": "off",
"no-confusing-arrow": "off",
"no-console": "off",
"no-continue": "off",
"no-empty": "off",
"no-empty-function": "off",
"no-implicit-coercion": "off",
"no-inline-comments": "off",
"no-invalid-this": "off",
"no-loop-func": "off",
"no-magic-numbers": "off",
"no-mixed-operators": "off",
"no-mixed-requires": "off",
"no-nested-ternary": "off",
"no-param-reassign": "off",
"no-plusplus": "off",
"no-process-env": "off",
"no-return-assign": "off",
"no-ternary": "off",
"no-trailing-spaces": [
"error",
{"ignoreComments": false}
],
"no-underscore-dangle": "off",
"no-useless-constructor": "off",
"no-void": "off",
"object-property-newline": "off",
"one-var": [
"off", {
"const": "always"
}
],
"padded-blocks": "off",
"prefer-destructuring": [
"error", {
"array": false
}, {
"enforceForRenamedProperties": true
}
],
"prefer-promise-reject-errors": [
"error", {"allowEmptyReject": true}
],
"require-atomic-updates": "off",
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": true,
"FunctionExpression": true
}
}],
"require-unicode-regexp": "off",
"sort-keys": "off",
"sort-vars": "off",
"space-before-function-paren": "off",
"quote-props": "off",
"valid-jsdoc": [
"error", {
"prefer": {
"return": "return"
}
}
]
}
}
21 changes: 21 additions & 0 deletions logging/Dockerfile
@@ -0,0 +1,21 @@
# Get Node LTS Alpine.
FROM node:18.17.0-alpine

# Create /var/www directory.
RUN mkdir -p /var/logging

# Copy package.json into /var/logging directory.
WORKDIR /var/logging
COPY ./package.json .

# Run NPM install.
RUN npm install --production --silent

# Copy remaining files.
COPY . .

# Allow start script to run.
RUN chmod +x /var/logging/*.sh

# Expose port 12201.
EXPOSE 12201/udp

0 comments on commit 1cbb627

Please sign in to comment.