bug fix for fly server

This commit is contained in:
JBB0807 2025-05-02 18:33:50 -07:00
parent b3dcec17c0
commit 0defbfea5a
10 changed files with 33 additions and 21 deletions

View file

@ -7,26 +7,39 @@ app = 'db-assignment-service'
primary_region = 'sea' primary_region = 'sea'
[build] [build]
# Only needed if you're using a Dockerfile — can be empty if using buildpacks or Node preset
[http_service] # Removed the [http_service] section to disable public HTTP/HTTPS access
internal_port = 3000 # [http_service]
force_https = true # internal_port = 3000
auto_stop_machines = 'stop' # force_https = true
auto_start_machines = true # auto_stop_machines = true
min_machines_running = 0 # auto_start_machines = true
processes = ['app'] # min_machines_running = 0
# processes = ["app"]
[[services]] [[services]]
protocol = 'tcp' protocol = "tcp"
internal_port = 3000 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] [services.concurrency]
type = 'requests' type = "requests"
hard_limit = 1000 hard_limit = 1000
soft_limit = 500 soft_limit = 500
[[vm]] [[vm]]
memory = '1gb' memory = '1gb'
cpu_kind = 'shared' cpu_kind = "shared"
cpus = 1 cpus = 1

View file

@ -1,2 +1,3 @@
#DB_ASSIGNMENT_SERVICE_URL = "http://localhost:3000" #DB_ASSIGNMENT_SERVICE_URL = "http://localhost:3000"
DB_ASSIGNMENT_SERVICE_URL = "http://db-assignment-service.internal:3000" DB_ASSIGNMENT_SERVICE_URL = "http://db-assignment-service.internal:3000"
NODE_PORT = 8080

View file

@ -3,4 +3,4 @@ NODE_ENV=development
DB_ASSIGNMENT_SERVICE_URL="http://localhost:3200" DB_ASSIGNMENT_SERVICE_URL="http://localhost:3200"
AUTH_SESSION_KEY="f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42" AUTH_SESSION_KEY="f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42"
ACCEPTED_ORIGINS=http://localhost:3000,http://localhost:8081,http://localhost:3001,http://localhost:5173 ACCEPTED_ORIGINS=http://localhost:3000,http://localhost:8081,http://localhost:3001,http://localhost:5173
PORT=8082 NODE_PORT=8082

View file

@ -3,4 +3,4 @@ NODE_ENV=development
DB_ASSIGNMENT_SERVICE_URL="http://js-assignment-db-service:3200" DB_ASSIGNMENT_SERVICE_URL="http://js-assignment-db-service:3200"
AUTH_SESSION_KEY="f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42" AUTH_SESSION_KEY="f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42"
ACCEPTED_ORIGINS=http://localhost:3000,http://localhost:8081,http://localhost:3001,http://localhost:5173 ACCEPTED_ORIGINS=http://localhost:3000,http://localhost:8081,http://localhost:3001,http://localhost:5173
PORT=8082 NODE_PORT=8082

View file

@ -39,5 +39,5 @@ app.use(cors());
app.use("/instructor", instructorRouter); app.use("/instructor", instructorRouter);
app.use("/student", studentRouter); app.use("/student", studentRouter);
const port = process.env.PORT || 8080; const port = process.env.NODE_PORT || 8080;
app.listen(port, () => console.log(`Listening on port ${port}...`)); app.listen(port, () => console.log(`Listening on port ${port}...`));

View file

@ -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://localhost:3000/"
DB_USER_SERVICE_URL = "http://db-user-service.internal:3000/" DB_USER_SERVICE_URL = "http://db-user-service.internal:3000/"
AUTH_SESSION_KEY = "f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42" 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_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 #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

View file

@ -5,6 +5,7 @@ GOOGLE_CLIENT_SECRET="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"
GOOGLE_CALLBACK_URL="http://localhost:8080/auth/google/callback" GOOGLE_CALLBACK_URL="http://localhost:8080/auth/google/callback"
LOGIN_REDIRECT_URL="http://localhost:5173/" LOGIN_REDIRECT_URL="http://localhost:5173/"
ACCEPTED_ORIGINS=http://localhost:3000,http://localhost:8081,http://localhost:3001,http://localhost:5173 ACCEPTED_ORIGINS=http://localhost:3000,http://localhost:8081,http://localhost:3001,http://localhost:5173
ASSIGNMENT_SERVICE_URL="http://localhost:8082/"
DB_USER_SERVICE_URL="http://localhost:3100/" DB_USER_SERVICE_URL="http://localhost:3100/"
AUTH_SESSION_KEY="f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42" AUTH_SESSION_KEY="f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42"
PORT=8080 PORT=8080

View file

@ -31,7 +31,7 @@ passport.use(
try { try {
console.log("Sending request to external auth service..."); console.log("Sending request to external auth service...");
const response = await axios.post( const response = await axios.post(
"http://localhost:8082/student/verify", `${process.env.ASSIGNMENT_SERVICE_URL}/student/verify`,
{ {
assignmentId, assignmentId,
password, password,

View file

@ -35,7 +35,6 @@ app.use(
}) })
) )
app.use(express.json()); app.use(express.json());
app.use("/auth", authRoute); app.use("/auth", authRoute);

View file

@ -6,11 +6,6 @@ primary_region = "sea"
[build] [build]
# Only needed if you're using a Dockerfile — can be empty if using buildpacks or Node preset # 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 # Removed the [http_service] section to disable public HTTP/HTTPS access
# [http_service] # [http_service]
# internal_port = 3000 # internal_port = 3000
@ -24,6 +19,8 @@ primary_region = "sea"
protocol = "tcp" protocol = "tcp"
internal_port = 3000 internal_port = 3000
internal_only = true # Makes this service only accessible internally internal_only = true # Makes this service only accessible internally
auto_start_machines = true
auto_stop_machines = true
# Removed public port exposure # Removed public port exposure
# [[services.ports]] # [[services.ports]]