now getting the correct IPV6 for proxy
This commit is contained in:
parent
7daa2e6cca
commit
a494cd4f0a
5 changed files with 18 additions and 4 deletions
|
|
@ -1,3 +1,4 @@
|
|||
DB_ASSIGNMENT_SERVICE_URL = "http://db-assignment-service.internal:3000"
|
||||
DEPLOY_API_URL="http://localhost:3006"
|
||||
PROXY_URL="https://proxy-service.fly.dev"
|
||||
NODE_PORT = 8080
|
||||
|
|
@ -8,4 +8,6 @@ AWS_REGION='auto'
|
|||
AWS_SECRET_ACCESS_KEY='tsec_6Bz1aMbfYQftuq5WfIVEDZkHwskU4MMjVywdtxSP6uxetEBvkSC2VHI9HfTeDgHr4D6kiz'
|
||||
COMMON_BUCKET='snakeapi-deployment-test-bucket'
|
||||
|
||||
PROXY_URL="https://proxy-service.fly.dev"
|
||||
|
||||
NODE_PORT=8082
|
||||
|
|
@ -2,3 +2,4 @@ NODE_ENV=docker
|
|||
DB_ASSIGNMENT_SERVICE_URL="http://js-assignment-db-service:3200"
|
||||
DEPLOY_API_URL="http://js-deployment-service:3006/deploy"
|
||||
NODE_PORT=8082
|
||||
PROXY_URL="https://proxy-service.fly.dev"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ const DB_ASSIGNMENT_SERVICE_URL =
|
|||
process.env.DB_ASSIGNMENT_SERVICE_URL || "http://localhost:3000";
|
||||
|
||||
const DEPLOY_API_URL = process.env.DEPLOY_API_URL || "http://localhost:3600";
|
||||
const PROXY_URL = process.env.PROXY_URL;
|
||||
|
||||
console.log("DB_ASSIGNMENT_SERVICE_URL:", DB_ASSIGNMENT_SERVICE_URL);
|
||||
console.log("DEPLOY_API_URL:", DEPLOY_API_URL);
|
||||
|
|
@ -63,8 +64,9 @@ intructorRouter.post(
|
|||
|
||||
// Update the assignment with the deployment details
|
||||
const updatedAssignmentData = {
|
||||
assignmenturl: ipv6,
|
||||
assignmenturl: `${PROXY_URL}/${ipv6}`,
|
||||
}
|
||||
|
||||
console.log("Updating assignment with deployment details:", updatedAssignmentData);
|
||||
const updateRespone = await axios.put(
|
||||
`${DB_ASSIGNMENT_SERVICE_URL}/assignments/${assignmentId}`,
|
||||
|
|
|
|||
|
|
@ -163,13 +163,21 @@ app.post("/deploy", async (req, res) => {
|
|||
const ipv6 = v6resp.data.data.allocateIpAddress.ipAddress.address;
|
||||
console.log("Allocated IPv6:", ipv6);
|
||||
|
||||
const machines = await fly.get(`/apps/${appName}/machines`);
|
||||
const firstPrivateIp = machines.data[0]?.private_ip;
|
||||
if (!firstPrivateIp) {
|
||||
console.error("No private IP found for the machine:", machines.data);
|
||||
return machines.status(500).json({ error: "No private IP found" });
|
||||
}
|
||||
console.log("First private IP:", firstPrivateIp);
|
||||
|
||||
return res.json({
|
||||
status: "created",
|
||||
app: appName,
|
||||
ipv4,
|
||||
ipv6,
|
||||
ipv6 : firstPrivateIp,
|
||||
url_v4: `http://${ipv4}`,
|
||||
url_v6: `http://[${ipv6}]`,
|
||||
url_v6: `http://[${firstPrivateIp}]`,
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue