Skip to content

Commit

Permalink
Put init scripts into workspace container
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Khismatullina <[email protected]>
  • Loading branch information
akhismat committed Dec 11, 2024
1 parent 88bd552 commit f87b93f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ env:
tools
PublishTempFolder: publish_artifacts
MODEL_VERSION_MODE: ${{ startsWith(github.ref, 'refs/tags/s') && 'tagTime' || 'file' }}
INIT_SCRIPTS_BRANCH: 'unified-init-scripts'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down Expand Up @@ -493,6 +494,14 @@ jobs:
with:
fetch-depth: 0
filter: tree:0

- name: Checkout init repository
run: |
wget https://github.com/hcengineering/init/archive/refs/heads/${{env.INIT_SCRIPTS_BRANCH}}.zip
unzip ${{env.INIT_SCRIPTS_BRANCH}}.zip -d pods/workspace
mv pods/workspace/init-${{env.INIT_SCRIPTS_BRANCH}} pods/workspace/init
rm -rf ${{env.INIT_SCRIPTS_BRANCH}}.zip
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
Expand Down
1 change: 0 additions & 1 deletion dev/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
STORAGE_CONFIG="minio|minio?accessKey=minioadmin&secretKey=minioadmin"
MONGO_URL=mongodb://mongodb:27017?compressors=snappy
DB_URL_PG=postgresql://postgres:example@postgres:5432
WS_INIT_SCRIPTS=../../init
5 changes: 0 additions & 5 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ services:
- stats
volumes:
- ./branding.json:/var/cfg/branding.json
- ${WS_INIT_SCRIPTS}:/init-scripts
environment:
# - WS_OPERATION=create
- SERVER_SECRET=secret
Expand All @@ -139,7 +138,6 @@ services:
- ACCOUNTS_URL=http://host.docker.internal:3000
- BRANDING_PATH=/var/cfg/branding.json
# - PARALLEL=2
- INIT_REPO_DIR=/init-scripts
- INIT_WORKSPACE=test
restart: unless-stopped
workspacepg:
Expand All @@ -152,7 +150,6 @@ services:
- stats
volumes:
- ./branding.json:/var/cfg/branding.json
- ${WS_INIT_SCRIPTS}:/init-scripts
environment:
# - WS_OPERATION=create
- SERVER_SECRET=secret
Expand Down Expand Up @@ -180,7 +177,6 @@ services:
- stats
volumes:
- ./branding.json:/var/cfg/branding.json
- ${WS_INIT_SCRIPTS}:/init-scripts
environment:
# - WS_OPERATION=create
- SERVER_SECRET=secret
Expand All @@ -193,7 +189,6 @@ services:
- MODEL_ENABLED=*
- ACCOUNTS_URL=http://host.docker.internal:3000
- BRANDING_PATH=/var/cfg/branding.json
- INIT_REPO_DIR=/init-scripts
# - PARALLEL=2
# - INIT_WORKSPACE=onboarding
restart: unless-stopped
Expand Down
3 changes: 3 additions & 0 deletions pods/workspace/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ ENV MALLOC_CONF=dirty_decay_ms:1000,narenas:2,background_thread:true
COPY bundle/bundle.js ./
COPY bundle/bundle.js.map ./

COPY ini[t]/ ./init-scripts/

CMD [ "node", "bundle.js" ]

6 changes: 2 additions & 4 deletions server/workspace-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ export function serveWorkspaceAccount (
setMetadata(toolPlugin.metadata.InitWorkspace, initWS)
}

const initRepoDir = process.env.INIT_REPO_DIR
if (initRepoDir !== undefined) {
setMetadata(toolPlugin.metadata.InitRepoDir, initRepoDir)
}
const initRepoDir = process.env.INIT_REPO_DIR ?? './init-scripts'
setMetadata(toolPlugin.metadata.InitRepoDir, initRepoDir)

setMetadata(serverClientPlugin.metadata.UserAgent, 'WorkspaceService')
setMetadata(serverNotification.metadata.InboxOnlyNotifications, true)
Expand Down

0 comments on commit f87b93f

Please sign in to comment.