diff --git a/assignment-db-service/fly.toml b/assignment-db-service/fly.toml index 18fc89d..4f08c1f 100644 --- a/assignment-db-service/fly.toml +++ b/assignment-db-service/fly.toml @@ -7,26 +7,39 @@ app = 'db-assignment-service' primary_region = 'sea' [build] +# Only needed if you're using a Dockerfile — can be empty if using buildpacks or Node preset -[http_service] - internal_port = 3000 - force_https = true - auto_stop_machines = 'stop' - auto_start_machines = true - min_machines_running = 0 - processes = ['app'] +# Removed the [http_service] section to disable public HTTP/HTTPS access +# [http_service] +# internal_port = 3000 +# force_https = true +# auto_stop_machines = true +# auto_start_machines = true +# min_machines_running = 0 +# processes = ["app"] [[services]] - protocol = 'tcp' + protocol = "tcp" internal_port = 3000 - ports = [] + internal_only = true # Makes this service only accessible internally + auto_start_machines = true + auto_stop_machines = true + + # Removed public port exposure + # [[services.ports]] + # port = 80 + # handlers = ["http"] + + # [[services.ports]] + # port = 443 + # handlers = ["tls", "http"] [services.concurrency] - type = 'requests' + type = "requests" hard_limit = 1000 soft_limit = 500 [[vm]] memory = '1gb' - cpu_kind = 'shared' + cpu_kind = "shared" cpus = 1 diff --git a/assignment-service/.env b/assignment-service/.env index b948690..9cf3674 100644 --- a/assignment-service/.env +++ b/assignment-service/.env @@ -1,2 +1,3 @@ #DB_ASSIGNMENT_SERVICE_URL = "http://localhost:3000" DB_ASSIGNMENT_SERVICE_URL = "http://db-assignment-service.internal:3000" +NODE_PORT = 8080 \ No newline at end of file diff --git a/assignment-service/.env.development b/assignment-service/.env.development index 1bc73e5..b0a3aab 100644 --- a/assignment-service/.env.development +++ b/assignment-service/.env.development @@ -3,4 +3,4 @@ NODE_ENV=development DB_ASSIGNMENT_SERVICE_URL="http://localhost:3200" AUTH_SESSION_KEY="f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42" ACCEPTED_ORIGINS=http://localhost:3000,http://localhost:8081,http://localhost:3001,http://localhost:5173 -PORT=8082 \ No newline at end of file +NODE_PORT=8082 \ No newline at end of file diff --git a/assignment-service/.env.test b/assignment-service/.env.test index d39a82f..8323fe9 100644 --- a/assignment-service/.env.test +++ b/assignment-service/.env.test @@ -3,4 +3,4 @@ NODE_ENV=development DB_ASSIGNMENT_SERVICE_URL="http://js-assignment-db-service:3200" AUTH_SESSION_KEY="f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42" ACCEPTED_ORIGINS=http://localhost:3000,http://localhost:8081,http://localhost:3001,http://localhost:5173 -PORT=8082 \ No newline at end of file +NODE_PORT=8082 \ No newline at end of file diff --git a/assignment-service/package-lock.json b/assignment-service/package-lock.json index 7b89a7a..c14f56e 100644 --- a/assignment-service/package-lock.json +++ b/assignment-service/package-lock.json @@ -16,6 +16,7 @@ "dotenv": "^16.5.0", "express": "^5.1.0", "express-session": "^1.18.1", + "multer": "^1.4.5-lts.2", "nodemon": "^3.1.9", "passport": "^0.7.0" }, @@ -113,6 +114,12 @@ "node": ">= 8" } }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", + "license": "MIT" + }, "node_modules/aproba": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", @@ -133,27 +140,26 @@ "node": ">=10" } }, + "node_modules/are-we-there-yet/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "license": "MIT" }, - "node_modules/available-typed-arrays": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", - "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", - "license": "MIT", - "dependencies": { - "possible-typed-array-names": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/aws-sdk": { "version": "2.1692.0", "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1692.0.tgz", @@ -309,6 +315,23 @@ "isarray": "^1.0.0" } }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -318,24 +341,6 @@ "node": ">= 0.8" } }, - "node_modules/call-bind": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", - "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.0", - "es-define-property": "^1.0.0", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", @@ -425,6 +430,21 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "license": "MIT" }, + "node_modules/concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "engines": [ + "node >= 0.8" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, "node_modules/console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", @@ -470,6 +490,12 @@ "node": ">=6.6.0" } }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" + }, "node_modules/cors": { "version": "2.8.5", "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", @@ -513,23 +539,6 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "license": "MIT" }, - "node_modules/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "license": "MIT", - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -855,21 +864,6 @@ } } }, - "node_modules/for-each": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", - "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", - "license": "MIT", - "dependencies": { - "is-callable": "^1.2.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/form-data": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz", @@ -1075,18 +1069,6 @@ "node": ">=4" } }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "license": "MIT", - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-symbols": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", @@ -1256,18 +1238,6 @@ "node": ">=8" } }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -1392,22 +1362,16 @@ "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", "license": "MIT", "dependencies": { - "semver": "^6.0.0" + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/math-intrinsics": { @@ -1477,7 +1441,6 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1535,6 +1498,79 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, + "node_modules/multer": { + "version": "1.4.5-lts.2", + "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.2.tgz", + "integrity": "sha512-VzGiVigcG9zUAoCNU+xShztrlr1auZOlurXynNvO9GiWD1/mTBbUljOKY+qMeazBqXgRnjzeEgJI/wyjJUHg9A==", + "license": "MIT", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^1.0.0", + "concat-stream": "^1.5.2", + "mkdirp": "^0.5.4", + "object-assign": "^4.1.1", + "type-is": "^1.6.4", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/multer/node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/multer/node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/negotiator": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", @@ -1783,14 +1819,11 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/possible-typed-array-names": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", - "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" }, "node_modules/proxy-addr": { "version": "2.0.7", @@ -1881,17 +1914,33 @@ } }, "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "license": "MIT", "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/readable-stream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" } }, "node_modules/readdirp": { @@ -2076,23 +2125,6 @@ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "license": "ISC" }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "license": "MIT", - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", @@ -2221,6 +2253,14 @@ "node": ">= 0.8" } }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -2335,6 +2375,12 @@ "node": ">= 0.6" } }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "license": "MIT" + }, "node_modules/uid-safe": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", @@ -2456,19 +2502,8 @@ "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", "license": "MIT", "dependencies": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.8", - "call-bound": "^1.0.4", - "for-each": "^0.3.5", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-tostringtag": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" } }, "node_modules/wide-align": { @@ -2508,6 +2543,15 @@ "node": ">=4.0" } }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", diff --git a/assignment-service/package.json b/assignment-service/package.json index 0e903ab..c4df28e 100644 --- a/assignment-service/package.json +++ b/assignment-service/package.json @@ -10,13 +10,14 @@ "license": "ISC", "description": "", "dependencies": { - "bcrypt": "^5.1.1", "aws-sdk": "^2.1692.0", "axios": "^1.9.0", + "bcrypt": "^5.1.1", "cors": "^2.8.5", "dotenv": "^16.5.0", "express": "^5.1.0", "express-session": "^1.18.1", + "multer": "^1.4.5-lts.2", "nodemon": "^3.1.9", "passport": "^0.7.0" }, diff --git a/assignment-service/routes/InstructorRouter.js b/assignment-service/routes/InstructorRouter.js index ffee372..8fa3cff 100644 --- a/assignment-service/routes/InstructorRouter.js +++ b/assignment-service/routes/InstructorRouter.js @@ -1,23 +1,44 @@ const intructorRouter = require("express").Router(); const passport = require("passport"); const axios = require("axios"); +const multer = require('multer'); +const FormData = require('form-data'); + const DB_ASSIGNMENT_SERVICE_URL = process.env.DB_ASSIGNMENT_SERVICE_URL || "http://localhost:3000"; console.log("DB_ASSIGNMENT_SERVICE_URL:", DB_ASSIGNMENT_SERVICE_URL); +// Use memory storage to keep file in RAM +const upload = multer({ storage: multer.memoryStorage() }); + + // This endpoint is for instructors to create a new assignment -intructorRouter.post( - "/create", - // passport.authenticate("jwt", { session: false }), +intructorRouter.post("/create", + upload.single('file'), + // passport.authenticate("jwt", { session: false }), async (req, res) => { try { + + const file = req.file; + const assignmentData = req.body; + + if (!file) { + return res.status(400).send('No file uploaded.'); + } + + await axios.post('https://target-api.com/endpoint', { + filename: file.originalname, + mimetype: file.mimetype, + content: file.buffer.toString('base64') + }, { + headers: { + 'Content-Type': 'application/json' + } + }); console.log("Creating a new assignment with data:", req.body); - const response = await axios.post( - `${DB_ASSIGNMENT_SERVICE_URL}/assignments`, - req.body - ); + const response = await axios.post(`${DB_ASSIGNMENT_SERVICE_URL}/assignments`, req.body); console.log("Response from DB_ASSIGNMENT_SERVICE_URL:", response.data); res.status(response.status).json(response.data); } catch (error) { diff --git a/assignment-service/routes/StudentRouter.js b/assignment-service/routes/StudentRouter.js index 63f07a2..6dcf37b 100644 --- a/assignment-service/routes/StudentRouter.js +++ b/assignment-service/routes/StudentRouter.js @@ -1,13 +1,56 @@ const studentRouter = require("express").Router(); const passport = require("passport"); const axios = require("axios"); +const bcrypt = require("bcrypt"); +require("dotenv").config(); +const DB_ASSIGNMENT_SERVICE_URL = process.env.DB_ASSIGNMENT_SERVICE_URL; -studentRouter.post("/save", (req, res) => { - + +studentRouter.post("/save", (req, res) => {}); + +studentRouter.post("/deploy", (req, res) => {}); + +studentRouter.post("/verify", async (req, res) => { + try { + const assignmentId = req.body.assignmentId; + const password = req.body.password; + console.log("Received request to verify assignment."); + console.log("Request body:", req.body); + console.log( + "Accessing assignment with ID:", + assignmentId, + "and password:", + password + ); + + console.log(`Fetching from URL: ${DB_ASSIGNMENT_SERVICE_URL}/assignments/${assignmentId}`); + const response = await axios.get( + `${DB_ASSIGNMENT_SERVICE_URL}/assignments/${assignmentId}` + ); + + console.log("Response from DB_ASSIGNMENT_SERVICE_URL:", response.data); + console.log("Password provided:", password); + console.log("Password hash from database:", response.data.passwordhash); + + const isPasswordValid = await bcrypt.compare( + password, + response.data.passwordhash + ); + + console.log("Password validation result:", isPasswordValid); + + if (!isPasswordValid || !response.data) { + console.log("Invalid id or password."); + return res.status(401).json({ error: "Invalid id and password" }); + } + + console.log("Verification successful. Sending response."); + res.status(response.status).json(response.data); + } catch (error) { + console.error("Error fetching assignment details:", error.message); + console.error("Error details:", error); + res.status(error.response?.status || 500).json({ error: error.message }); + } }); -studentRouter.post("/deploy", (req, res) => { - -}); - -module.exports = studentRouter; \ No newline at end of file +module.exports = studentRouter; diff --git a/assignment-service/server.js b/assignment-service/server.js index 2731cfc..b7918bd 100644 --- a/assignment-service/server.js +++ b/assignment-service/server.js @@ -70,5 +70,5 @@ app.get("/notebook/:appName", async (req, res) => { } }); -const port = process.env.PORT || 8080; +const port = process.env.NODE_PORT || 8080; app.listen(port, "0.0.0.0", () => console.log(`Listening on 0.0.0.0:${port}...`)); diff --git a/auth-service/.env b/auth-service/.env index 4fe65d0..a5e74f3 100644 --- a/auth-service/.env +++ b/auth-service/.env @@ -6,6 +6,7 @@ ACCEPTED_ORIGINS ="https://bytecamp-web.fly.dev,https://byte-camp-auth-service.f #DB_USER_SERVICE_URL = "http://localhost:3000/" DB_USER_SERVICE_URL = "http://db-user-service.internal:3000/" AUTH_SESSION_KEY = "f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42" +ASSIGNMENT_SERVICE_URL="http://assignment-service.internal:8080" # fly secrets set GOOGLE_CALLBACK_URL=https://byte-camp-auth-service.fly.dev/auth/google/callback #fly secrets set GOOGLE_CLIENT_ID=485880105639-1in8tvb6ondnn198rasuj2d8ank06ntp.apps.googleusercontent.com GOOGLE_CLIENT_SECRET=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 LOGIN_REDIRECT_URL=https://bytecamp-web.fly.dev/ DB_USER_SERVICE_URL=https://db-user-service.fly.dev:3000/ AUTH_SESSION_KEY=f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42 \ No newline at end of file diff --git a/auth-service/.env.development b/auth-service/.env.development index 794749f..e302c2f 100644 --- a/auth-service/.env.development +++ b/auth-service/.env.development @@ -1,8 +1,11 @@ +NODE_ENV=development + GOOGLE_CLIENT_ID="485880105639-1in8tvb6ondnn198rasuj2d8ank06ntp.apps.googleusercontent.com" GOOGLE_CLIENT_SECRET="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" GOOGLE_CALLBACK_URL="http://localhost:8080/auth/google/callback" LOGIN_REDIRECT_URL="http://localhost:5173/" ACCEPTED_ORIGINS=http://localhost:3000,http://localhost:8081,http://localhost:3001,http://localhost:5173 -DB_USER_SERVICE_URL="http://js-user-db-service:3100/" +ASSIGNMENT_SERVICE_URL="http://localhost:8082/" +DB_USER_SERVICE_URL="http://localhost:3100/" AUTH_SESSION_KEY="f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42" PORT=8080 \ No newline at end of file diff --git a/auth-service/package-lock.json b/auth-service/package-lock.json index 495b39d..26d2726 100644 --- a/auth-service/package-lock.json +++ b/auth-service/package-lock.json @@ -16,7 +16,11 @@ "express-session": "^1.18.1", "nodemon": "^3.1.9", "passport": "^0.7.0", + "passport-custom": "^1.1.1", "passport-google-oauth20": "^2.0.0" + }, + "devDependencies": { + "dotenv-cli": "^8.0.0" } }, "node_modules/accepts": { @@ -280,6 +284,21 @@ "node": ">= 0.10" } }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -325,6 +344,32 @@ "url": "https://dotenvx.com" } }, + "node_modules/dotenv-cli": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-8.0.0.tgz", + "integrity": "sha512-aLqYbK7xKOiTMIRf1lDPbI+Y+Ip/wo5k3eyp6ePysVaSqbyxjyK3dK35BTxG+rmd7djf5q2UPs4noPNH+cj0Qw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.6", + "dotenv": "^16.3.0", + "dotenv-expand": "^10.0.0", + "minimist": "^1.2.6" + }, + "bin": { + "dotenv": "cli.js" + } + }, + "node_modules/dotenv-expand": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-10.0.0.tgz", + "integrity": "sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -847,6 +892,13 @@ "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", "license": "MIT" }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -910,6 +962,16 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -1063,6 +1125,18 @@ "url": "https://github.com/sponsors/jaredhanson" } }, + "node_modules/passport-custom": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/passport-custom/-/passport-custom-1.1.1.tgz", + "integrity": "sha512-/2m7jUGxmCYvoqenLB9UrmkCgPt64h8ZtV+UtuQklZ/Tn1NpKBeOorCYkB/8lMRoiZ5hUrCoMmDtxCS/d38mlg==", + "license": "MIT", + "dependencies": { + "passport-strategy": "1.x.x" + }, + "engines": { + "node": ">= 0.10.0" + } + }, "node_modules/passport-google-oauth20": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/passport-google-oauth20/-/passport-google-oauth20-2.0.0.tgz", @@ -1103,6 +1177,16 @@ "node": ">= 0.4.0" } }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/path-to-regexp": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", @@ -1345,6 +1429,29 @@ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "license": "ISC" }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/side-channel": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", @@ -1545,6 +1652,22 @@ "node": ">= 0.8" } }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/auth-service/package.json b/auth-service/package.json index 14d0810..2d95f65 100644 --- a/auth-service/package.json +++ b/auth-service/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "main": "server.js", "scripts": { - "dev": "nodemon server.js" + "dev": "dotenv -e .env.development nodemon server.js" }, "keywords": [], "author": "", @@ -17,6 +17,10 @@ "express-session": "^1.18.1", "nodemon": "^3.1.9", "passport": "^0.7.0", + "passport-custom": "^1.1.1", "passport-google-oauth20": "^2.0.0" + }, + "devDependencies": { + "dotenv-cli": "^8.0.0" } } diff --git a/auth-service/passport.js b/auth-service/passport.js index e65e7c8..8ef091d 100644 --- a/auth-service/passport.js +++ b/auth-service/passport.js @@ -1,36 +1,78 @@ -require('dotenv').config(); +require("dotenv").config(); const GoogleStrategy = require("passport-google-oauth20").Strategy; const passport = require("passport"); +const CustomStrategy = require("passport-custom").Strategy; +const axios = require("axios"); passport.use( - new GoogleStrategy( + new GoogleStrategy( + { + clientID: process.env.GOOGLE_CLIENT_ID, + clientSecret: process.env.GOOGLE_CLIENT_SECRET, + callbackURL: process.env.GOOGLE_CALLBACK_URL, + scope: ["profile", "email"], + }, + function (accessToken, refreshToken, profile, callback) { + callback(null, {...profile, role: "instructor"}); + } + ) +); + +passport.use( + "student-auth", + new CustomStrategy(async (req, done) => { + const { assignmentId, password } = req.body; + + console.log("Custom strategy invoked"); + console.log("Received assignmentId:", assignmentId); + console.log("Received password:", password); + + try { + console.log("Sending request to external auth service..."); + const response = await axios.post( + `${process.env.ASSIGNMENT_SERVICE_URL}/student/verify`, { - clientID: process.env.GOOGLE_CLIENT_ID, - clientSecret: process.env.GOOGLE_CLIENT_SECRET, - callbackURL: process.env.GOOGLE_CALLBACK_URL, - scope: ["profile", "email"], - }, - function (accessToken, refreshToken, profile, callback) { - - // Save the user info to your DB here if still not yet saved - // Example of what profile might contain: - // { - // "id": "112233445566778899", - // "displayName": "John Doe", - // "emails": [{ "value": "john.doe@gmail.com" }], - // "photos": [{ "value": "https://.../photo.jpg" }] - // } - - callback(null, profile); + assignmentId, + password, } - ) + ); + + if (response.status === 200 && response.data) { + user = { + ...response.data, + role: "student", + }; + console.log("Authentication successful, user:", user); + return done(null, user); // success + } else { + console.log("Authentication failed: Invalid credentials"); + return done(null, false, { message: "Invalid credentials" }); + } + } catch (err) { + console.error("Error during authentication:", err); + return done(err); + } + }) ); passport.serializeUser((user, done) => { - done(null, user); + // done(null, user); + console.log("Serializing user:", user); + done(null, { + id: user.assignmentid || user.id, + displayName: user.studentname || user.displayName, + role: user.role, + emails: user.emails || "none", + }); }); -passport.deserializeUser((user, done) => { - done(null,user); -}); \ No newline at end of file +passport.deserializeUser(async (user, done) => { + try { + console.log("Deserializing user:", user); + done(null, user); + } catch (err) { + console.error("Error during deserialization:", err); + done(err); + } +}); diff --git a/auth-service/routes/auth.js b/auth-service/routes/auth.js index 782d09c..05d5f63 100644 --- a/auth-service/routes/auth.js +++ b/auth-service/routes/auth.js @@ -11,6 +11,8 @@ router.get( ); router.get("/current_user", (req, res) => { + console.log("Current user endpoint hit"); + console.log("Request user:", req.user); if (req.isAuthenticated()) { console.log("Authenticated user:", req.user); res.json(req.user); @@ -52,9 +54,47 @@ router.get("/login/failed", (req, res) => { router.get("/google", passport.authenticate("google", ["profile", "email"])); +router.post( + "/student/login", + passport.authenticate("student-auth"), + (req, res) => { + console.log("Student login endpoint hit"); + + if (req.user) { + console.log("Authenticated user:", req.user); + console.log("Processing student login..."); + + // Optional: augment user object (doesn't affect session unless you reserialize) + req.user.userId = req.user.assignmentid; + req.user.role = "student"; + + req.logIn(req.user, function(err) { + if (err) return next(err); + + console.log('is authenticated?: ' + req.isAuthenticated()); + + return res.status(200).json({ + success: true, + message: 'Successful Login', + user: req.user + }); + }); + + } else { + console.log("Authentication failed"); + res.status(401).json({ error: true, message: "Authentication failed" }); + } + } +); + router.get("/logout", (req, res) => { - req.logOut(); - res.redirect(process.env.LOGIN_REDIRECT_URL); + + req.logout((err) => { + if (err) { + return next(err); + } + res.redirect(process.env.LOGIN_REDIRECT_URL); + }); }); module.exports = router; diff --git a/auth-service/server.js b/auth-service/server.js index 8e92dce..924dfac 100644 --- a/auth-service/server.js +++ b/auth-service/server.js @@ -6,10 +6,14 @@ const passport = require("passport"); const passportSetup = require("./passport"); const authRoute = require("./routes/auth"); const session = require("express-session"); +const bodyParser = require("body-parser"); const app = express(); +app.use(bodyParser.json()); // or express.json() +app.use(bodyParser.urlencoded({ extended: true })); app.use( + session({ secret: process.env.AUTH_SESSION_KEY, resave: false, @@ -31,6 +35,8 @@ app.use( }) ) +app.use(express.json()); + app.use("/auth", authRoute); const port = process.env.PORT || 8080; diff --git a/uploader-service/app.js b/uploader-service/app.js index 6d71209..453324c 100644 --- a/uploader-service/app.js +++ b/uploader-service/app.js @@ -102,7 +102,7 @@ app.post('/machines/get', async (req, res) => { // Endpoint to upload files to Google Drive app.post('/drive/upload', upload.fields([{ name: 'pythonFile' }, { name: 'jsonFile', maxCount: 1 }]), async (req, res) => { const { folderLink } = req.body; - const { pythonFile, jsonFile } = req.files; + const { pythonFile, jsonFile } = req.files; if (!folderLink || !pythonFile) { return res.status(400).json({ error: 'Folder link and Python file are required' }); diff --git a/user-db-service/.env b/user-db-service/.env index 3aaa685..52a3ca1 100644 --- a/user-db-service/.env +++ b/user-db-service/.env @@ -5,8 +5,8 @@ # See the documentation for all the connection string options: https://pris.ly/d/connection-strings #use this when testing local, remmber to run the proxy command -# DATABASE_URL="postgresql://postgres:wly9H8gjjmxYfg1@localhost:15432/postgres?schema=public" +DATABASE_URL="postgresql://postgres:wly9H8gjjmxYfg1@localhost:15432/postgres?schema=public" -DATABASE_URL="postgres://postgres:wly9H8gjjmxYfg1@bytecamp-db.flycast:5432?sslmode=disable" +# DATABASE_URL="postgres://postgres:wly9H8gjjmxYfg1@bytecamp-db.flycast:5432?sslmode=disable" # DATABASE_URL=postgres://snakebyte:zVB7lgOiKr89dq6@localhost:5432/snakebyte?sslmode=disable -NODE_PORT=3000 +NODE_PORT=3100 diff --git a/user-db-service/fly.toml b/user-db-service/fly.toml index 07d92c2..30dbd0d 100644 --- a/user-db-service/fly.toml +++ b/user-db-service/fly.toml @@ -6,11 +6,6 @@ primary_region = "sea" [build] # Only needed if you're using a Dockerfile — can be empty if using buildpacks or Node preset -#[env] - #NODE_ENV = "production" - #DATABASE_URL = "postgresql://user:password@hostname:port/dbname" - # you can also leave DATABASE_URL unset here and use secrets instead - # Removed the [http_service] section to disable public HTTP/HTTPS access # [http_service] # internal_port = 3000 @@ -24,6 +19,8 @@ primary_region = "sea" protocol = "tcp" internal_port = 3000 internal_only = true # Makes this service only accessible internally + auto_start_machines = true + auto_stop_machines = true # Removed public port exposure # [[services.ports]]