├── .gitignore ├── .dockerignore ├── simulation ├── .gitignore ├── .prettierignore ├── .eslintrc.json ├── dist │ ├── types.js │ ├── getDest.js │ ├── types.js.map │ ├── getDest.js.map │ ├── routePlanner.js │ ├── getDestination.js │ ├── routePlanner.js.map │ ├── getDestination.js.map │ ├── index.js │ ├── index.js.map │ ├── dbInit.js.map │ ├── dbInit.js │ ├── dispatcher.js.map │ ├── dispatcher.js │ ├── global.js │ ├── global.js.map │ ├── data.js.map │ ├── Customer.js.map │ ├── data.js │ ├── methods.test.js │ ├── Customer.js │ ├── Driver.js.map │ ├── methods.js │ ├── methods.test.js.map │ ├── methods.js.map │ ├── paths.js │ ├── paths.js.map │ └── Driver.js ├── .DS_Store ├── .prettierrc.json ├── src │ ├── .DS_Store │ ├── types.ts │ ├── getDestination.ts │ ├── routePlanner.ts │ ├── dbInit.ts │ ├── index.ts │ ├── dispatcher.ts │ ├── global.ts │ ├── data.ts │ ├── methods.test.ts │ ├── Customer.ts │ ├── methods.ts │ └── Driver.ts ├── babel.config.json ├── tsconfig.eslint.json ├── Dockerfile ├── tsconfig.json └── package.json ├── .gitattributes ├── frontend ├── .prettierignore ├── .prettierrc.json ├── .eslintrc.json ├── build │ ├── favicon.ico │ ├── robots.txt │ ├── static │ │ ├── media │ │ │ ├── bio.eca26d5962009ce3d30f.jpg │ │ │ ├── diagram-6.b47a66677a3499543226.png │ │ │ ├── fa-brands-400.150de8eaa454d669c405.ttf │ │ │ ├── fa-regular-400.d87474231f4192884802.ttf │ │ │ ├── fa-solid-900.4a2cd718d7031b732e76.ttf │ │ │ ├── fa-solid-900.bb975c966c37455a1bc3.woff2 │ │ │ ├── fa-brands-400.e033a13ee751afc1860c.woff2 │ │ │ ├── fa-regular-400.3223dc79c1adee56370b.woff2 │ │ │ ├── fa-v4compatibility.0e3a648be390bd8cb094.ttf │ │ │ └── fa-v4compatibility.68577e40f3e70067b5da.woff2 │ │ └── js │ │ │ └── main.84f9deb3.js.LICENSE.txt │ ├── asset-manifest.json │ └── index.html ├── public │ ├── favicon.ico │ ├── robots.txt │ └── index.html ├── assets │ ├── images │ │ ├── bio.jpg │ │ └── diagram-6.png │ ├── webfonts │ │ ├── fa-brands-400.ttf │ │ ├── fa-solid-900.ttf │ │ ├── fa-brands-400.woff2 │ │ ├── fa-regular-400.ttf │ │ ├── fa-solid-900.woff2 │ │ ├── fa-regular-400.woff2 │ │ ├── fa-v4compatibility.ttf │ │ └── fa-v4compatibility.woff2 │ └── css │ │ ├── solid.min.css │ │ ├── regular.min.css │ │ ├── solid.css │ │ ├── regular.css │ │ ├── v5-font-face.min.css │ │ ├── v5-font-face.css │ │ ├── v4-font-face.min.css │ │ └── v4-font-face.css ├── tsconfig.json ├── src │ ├── Link.tsx │ ├── MonitorView.tsx │ ├── error-page.jsx │ ├── api.tsx │ ├── index.tsx │ ├── disableReactDevTools.js │ ├── Description.tsx │ ├── Bio.tsx │ ├── ListItem.tsx │ ├── App.tsx │ ├── movement.tsx │ ├── index.css │ ├── Mobile.tsx │ ├── Nav.tsx │ ├── DocsView.tsx │ ├── movement.test.ts │ ├── Car.tsx │ ├── Tour.tsx │ └── GeoMap.tsx ├── config-overrides.js ├── .gitignore ├── tailwind.config.js └── package.json ├── shared ├── package.json ├── utils.js ├── methods.js ├── config.js ├── firstNames.js └── lastNames.js ├── .DS_Store ├── go.mod ├── deploy.sh ├── monitor ├── postgres_exporter-queries.yml ├── prometheus-local.yml ├── prometheus-prod.yml ├── loki-local-config.yaml ├── promtail-config.yaml ├── docker-compose-macos.yml └── docker-compose-linux.yml ├── server ├── Dockerfile └── main.go ├── go.sum ├── db ├── db.go └── queries ├── prod_deploy.sh ├── docker-compose.yml └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | **/.env -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/node_modules -------------------------------------------------------------------------------- /simulation/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.css linguist-vendored -------------------------------------------------------------------------------- /frontend/.prettierignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | **/*.html 3 | -------------------------------------------------------------------------------- /shared/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /simulation/.prettierignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | src/*.json -------------------------------------------------------------------------------- /frontend/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /simulation/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["prettier"] 3 | } 4 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/.DS_Store -------------------------------------------------------------------------------- /simulation/dist/types.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=types.js.map -------------------------------------------------------------------------------- /simulation/dist/getDest.js: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=getDest.js.map -------------------------------------------------------------------------------- /frontend/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["react-app", "react-app/jest", "prettier"] 3 | } 4 | -------------------------------------------------------------------------------- /simulation/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/simulation/.DS_Store -------------------------------------------------------------------------------- /simulation/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "operator-linebreak": "before" 4 | } 5 | -------------------------------------------------------------------------------- /simulation/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/simulation/src/.DS_Store -------------------------------------------------------------------------------- /frontend/build/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/build/favicon.ico -------------------------------------------------------------------------------- /frontend/build/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/public/favicon.ico -------------------------------------------------------------------------------- /frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /frontend/assets/images/bio.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/assets/images/bio.jpg -------------------------------------------------------------------------------- /frontend/assets/images/diagram-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/assets/images/diagram-6.png -------------------------------------------------------------------------------- /simulation/dist/types.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /frontend/assets/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/assets/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /frontend/assets/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/assets/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /simulation/dist/getDest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"getDest.js","sourceRoot":"","sources":["../src/getDest.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /frontend/assets/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/assets/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /frontend/assets/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/assets/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /frontend/assets/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/assets/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /frontend/assets/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/assets/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /frontend/assets/webfonts/fa-v4compatibility.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/assets/webfonts/fa-v4compatibility.ttf -------------------------------------------------------------------------------- /frontend/assets/webfonts/fa-v4compatibility.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/assets/webfonts/fa-v4compatibility.woff2 -------------------------------------------------------------------------------- /frontend/build/static/media/bio.eca26d5962009ce3d30f.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/build/static/media/bio.eca26d5962009ce3d30f.jpg -------------------------------------------------------------------------------- /simulation/babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["@babel/preset-env", { "targets": { "node": "current" } }], 4 | "@babel/preset-typescript" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /frontend/build/static/media/diagram-6.b47a66677a3499543226.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/build/static/media/diagram-6.b47a66677a3499543226.png -------------------------------------------------------------------------------- /frontend/build/static/media/fa-brands-400.150de8eaa454d669c405.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/build/static/media/fa-brands-400.150de8eaa454d669c405.ttf -------------------------------------------------------------------------------- /frontend/build/static/media/fa-regular-400.d87474231f4192884802.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/build/static/media/fa-regular-400.d87474231f4192884802.ttf -------------------------------------------------------------------------------- /frontend/build/static/media/fa-solid-900.4a2cd718d7031b732e76.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/build/static/media/fa-solid-900.4a2cd718d7031b732e76.ttf -------------------------------------------------------------------------------- /frontend/build/static/media/fa-solid-900.bb975c966c37455a1bc3.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/build/static/media/fa-solid-900.bb975c966c37455a1bc3.woff2 -------------------------------------------------------------------------------- /frontend/build/static/media/fa-brands-400.e033a13ee751afc1860c.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/build/static/media/fa-brands-400.e033a13ee751afc1860c.woff2 -------------------------------------------------------------------------------- /frontend/build/static/media/fa-regular-400.3223dc79c1adee56370b.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/build/static/media/fa-regular-400.3223dc79c1adee56370b.woff2 -------------------------------------------------------------------------------- /frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "esModuleInterop": true, 4 | "jsx": "react-jsx", 5 | "target": "ESNext", 6 | "moduleResolution": "node" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /simulation/tsconfig.eslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "allowJs": true 5 | }, 6 | "include": ["./src", "./test", ".eslintrc.js"] 7 | } 8 | -------------------------------------------------------------------------------- /frontend/build/static/media/fa-v4compatibility.0e3a648be390bd8cb094.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/build/static/media/fa-v4compatibility.0e3a648be390bd8cb094.ttf -------------------------------------------------------------------------------- /frontend/build/static/media/fa-v4compatibility.68577e40f3e70067b5da.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jurajmajerik/rides/HEAD/frontend/build/static/media/fa-v4compatibility.68577e40f3e70067b5da.woff2 -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module app 2 | 3 | go 1.18 4 | 5 | require github.com/lib/pq v1.10.7 6 | 7 | require ( 8 | github.com/gorilla/mux v1.8.0 // indirect 9 | github.com/joho/godotenv v1.5.1 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd frontend 3 | npm run build 4 | cd .. 5 | git add . 6 | git commit -m "build" 7 | git push 8 | sshcmd="ssh -t juraj@rides.jurajmajerik.com" 9 | $sshcmd screen -S "deployment" /home/juraj/rides/prod_deploy.sh 10 | -------------------------------------------------------------------------------- /simulation/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:19-alpine 2 | 3 | WORKDIR /app 4 | 5 | COPY shared ./shared 6 | COPY simulation ./simulation 7 | RUN cd simulation && npm install && npm run build 8 | 9 | CMD cd simulation && cd dist && node index.js 10 | -------------------------------------------------------------------------------- /simulation/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "moduleResolution": "NodeNext", 5 | "target": "ES2020", 6 | "sourceMap": true, 7 | "outDir": "./dist" 8 | }, 9 | "include": ["src/**/*"] 10 | } 11 | -------------------------------------------------------------------------------- /simulation/src/types.ts: -------------------------------------------------------------------------------- 1 | export type Obstacle = [number, number, number, number, string?]; 2 | export type Obstacles = Obstacle[]; 3 | 4 | export type Graph = (0 | 1)[][]; 5 | export type Coord = number; 6 | export type CoordPair = [number, number]; 7 | export type Path = CoordPair[]; 8 | -------------------------------------------------------------------------------- /frontend/src/Link.tsx: -------------------------------------------------------------------------------- 1 | const Link = ({ url, text }) => ( 2 | 8 | {text} 9 | 10 | ); 11 | export default Link; 12 | -------------------------------------------------------------------------------- /monitor/postgres_exporter-queries.yml: -------------------------------------------------------------------------------- 1 | pg_stat_activity: 2 | query: "SELECT COUNT(*) AS active_connections, now() as timestamp FROM pg_stat_activity WHERE state = 'active'" 3 | metrics: 4 | - active_connections: 5 | usage: "COUNTER" 6 | description: "Number of active connections" -------------------------------------------------------------------------------- /server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.18-alpine 2 | 3 | WORKDIR /app 4 | 5 | COPY go.mod ./ 6 | COPY go.sum ./ 7 | 8 | COPY server ./server 9 | COPY db ./db 10 | COPY frontend ./frontend 11 | 12 | RUN cd server && go build -o main 13 | 14 | EXPOSE 8080 15 | 16 | CMD cd server && ./main 17 | -------------------------------------------------------------------------------- /shared/utils.js: -------------------------------------------------------------------------------- 1 | export const getRandomInt = (min, max) => Math.floor(Math.random() * (max - min) + min); 2 | 3 | export const decide = probability => getRandomInt(1, 100) < probability; 4 | 5 | export const wait = (t) => new Promise((res) => { 6 | setTimeout(() => { 7 | res(); 8 | }, t); 9 | }); 10 | -------------------------------------------------------------------------------- /frontend/config-overrides.js: -------------------------------------------------------------------------------- 1 | const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); 2 | 3 | module.exports = function override(config, env) { 4 | config.resolve.plugins = config.resolve.plugins.filter( 5 | (plugin) => !(plugin instanceof ModuleScopePlugin) 6 | ); 7 | 8 | return config; 9 | }; 10 | -------------------------------------------------------------------------------- /frontend/src/MonitorView.tsx: -------------------------------------------------------------------------------- 1 | const MonitorView = () => ( 2 |
3 |