mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
Fix network (#174)
This commit is contained in:
5 files changed
+9
-9
No files matched your search
+1
-1
@@ -3,6 +3,7 @@ PORT=3000
|
|||||||
BASE_URL=https://example.com
|
BASE_URL=https://example.com
|
||||||
SECRET_KEY=YOU_SHOULD_CHANGE_THIS
|
SECRET_KEY=YOU_SHOULD_CHANGE_THIS
|
||||||
BACKEND_URL=http://backend:3000
|
BACKEND_URL=http://backend:3000
|
||||||
|
DOCKER_NETWORK=linux-odyssey-players
|
||||||
|
|
||||||
MONGO_ROOT_PASSWORD=adminpassword
|
MONGO_ROOT_PASSWORD=adminpassword
|
||||||
MONGO_USER=commander
|
MONGO_USER=commander
|
||||||
@@ -29,7 +30,6 @@ ADMIN_PORT=3001
|
|||||||
# GITHUB_CLIENT_SECRET=
|
# GITHUB_CLIENT_SECRET=
|
||||||
# SURVEY_URL=
|
# SURVEY_URL=
|
||||||
# BUG_REPORT_URL=
|
# BUG_REPORT_URL=
|
||||||
# DOCKER_NETWORK=
|
|
||||||
|
|
||||||
# SURVEY_URL=
|
# SURVEY_URL=
|
||||||
# BUG_REPORT_URL=
|
# BUG_REPORT_URL=
|
||||||
|
|||||||
+1
-1
@@ -3,6 +3,7 @@ PORT=3000
|
|||||||
BASE_URL=http://localhost:5173
|
BASE_URL=http://localhost:5173
|
||||||
MONGO_URL=mongodb://localhost:27017/odyssey-test
|
MONGO_URL=mongodb://localhost:27017/odyssey-test
|
||||||
SECRET_KEY=sample-secret
|
SECRET_KEY=sample-secret
|
||||||
|
DOCKER_NETWORK=linux-odyssey-players-dev
|
||||||
|
|
||||||
# Optional
|
# Optional
|
||||||
# BACKEND_URL=http://host.docker.internal:3000
|
# BACKEND_URL=http://host.docker.internal:3000
|
||||||
@@ -17,7 +18,6 @@ SECRET_KEY=sample-secret
|
|||||||
# GITHUB_CLIENT_SECRET=
|
# GITHUB_CLIENT_SECRET=
|
||||||
# SURVEY_URL=
|
# SURVEY_URL=
|
||||||
# BUG_REPORT_URL=
|
# BUG_REPORT_URL=
|
||||||
# DOCKER_NETWORK=
|
|
||||||
|
|
||||||
# SURVEY_URL=
|
# SURVEY_URL=
|
||||||
# BUG_REPORT_URL=
|
# BUG_REPORT_URL=
|
||||||
|
|||||||
+3
-4
@@ -13,7 +13,7 @@ services:
|
|||||||
base:
|
base:
|
||||||
image: linuxodyssey/quest-base
|
image: linuxodyssey/quest-base
|
||||||
networks:
|
networks:
|
||||||
- players
|
- players-dev
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./quests/Dockerfile
|
dockerfile: ./quests/Dockerfile
|
||||||
@@ -22,7 +22,6 @@ services:
|
|||||||
|
|
||||||
networks:
|
networks:
|
||||||
internal:
|
internal:
|
||||||
players:
|
players-dev:
|
||||||
name: linux-odyssey-players
|
name: linux-odyssey-players-dev
|
||||||
internal: false
|
internal: false
|
||||||
external: true
|
|
||||||
@@ -72,7 +72,7 @@ function createConfig() {
|
|||||||
projectRoot,
|
projectRoot,
|
||||||
|
|
||||||
docker: {
|
docker: {
|
||||||
network: get('DOCKER_NETWORK', 'linux-odyssey-players'),
|
network: get('DOCKER_NETWORK', 'linux-odyssey-players-dev'),
|
||||||
defaultImage: get('QUEST_IMAGE', 'linuxodyssey/quest-base'),
|
defaultImage: get('QUEST_IMAGE', 'linuxodyssey/quest-base'),
|
||||||
imagePrefix: get('DOCKER_PREFIX', 'linuxodyssey/quest-'),
|
imagePrefix: get('DOCKER_PREFIX', 'linuxodyssey/quest-'),
|
||||||
mountQuest: process.env.MOUNT_QUEST === 'true',
|
mountQuest: process.env.MOUNT_QUEST === 'true',
|
||||||
|
|||||||
@@ -94,20 +94,21 @@ export async function attachContainer(
|
|||||||
config.docker.network
|
config.docker.network
|
||||||
].IPAddress
|
].IPAddress
|
||||||
|
|
||||||
|
let error: Error | null = null
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
const stream = await connectToSSH(containerIp, { token })
|
const stream = await connectToSSH(containerIp, { token })
|
||||||
return stream
|
return stream
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error('Failed to connect to SSH', err)
|
error = err as Error
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
setTimeout(resolve, 1000)
|
setTimeout(resolve, 1000)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new Error('Failed to connect to SSH')
|
throw new Error('Failed to connect to SSH', { cause: error })
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteContainer(id: string) {
|
export async function deleteContainer(id: string) {
|
||||||
|
|||||||
Reference in new issue
Block a user