Skip to content

Commit

Permalink
Merge pull request #1427 from Oneirocom/jakobs/agent-deploy-ui
Browse files Browse the repository at this point in the history
Jakobs/agent deploy UI
  • Loading branch information
benbot authored Dec 14, 2023
2 parents faf02f4 + f3f5788 commit 2490ce0
Show file tree
Hide file tree
Showing 62 changed files with 1,994 additions and 826 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ AWS_REGION=region
AWS_BUCKET_NAME=bucket_name
AWS_BUCKET_ENDPOINT=endpoint

CLOUD_AGENT_KEY=key
CLOUD_AGENT_KEY=key
APT_ROOT_URL=http://0.0.0.0
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"ignorePatterns": ["!**/*", "**/node_modules/**", "**/*.d.ts"],
"ignorePatterns": ["**/node_modules/**", "**/*.d.ts"],
"plugins": ["@nx/eslint-plugin"],
"rules": {
"@typescript-eslint/no-explicit-any": "off"
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
18 changes: 11 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnType": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"source.fixAll.eslint": "explicit"
},
"editor.formatOnType": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"search.exclude": {
"**/node_modules": true,
"**/build": true
}
}
51 changes: 51 additions & 0 deletions apps/server/migrations/20231130232851_add-spellReleases-table.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Knex } from 'knex'

export async function up(knex: Knex): Promise<void> {
// Create 'spellReleases' table
await knex.schema.createTable('spellReleases', function (table) {
table.uuid('id').primary()
table.string('description').nullable()
table.uuid('agentId').notNullable()
table.uuid('spellId').nullable()
table.text('projectId').nullable()
table.timestamp('createdAt').defaultTo(knex.fn.now())
table.foreign('agentId').references('id').inTable('agents')
})

// Alter 'agents' table to include 'createdAt', 'updatedAt', and 'currentSpellReleaseId' fields
await knex.schema.alterTable('agents', (table) => {
table.timestamp('createdAt').defaultTo(knex.fn.now())
table.timestamp('updatedAt').defaultTo(knex.fn.now())
table.uuid('currentSpellReleaseId')
table.foreign('currentSpellReleaseId').references('id').inTable('spellReleases')
})

// Alter 'spells' table to include 'spellReleaseId' field
await knex.schema.alterTable('spells', (table) => {
table.uuid('spellReleaseId').nullable()
table.foreign('spellReleaseId').references('id').inTable('spellReleases')
})
}

export async function down(knex: Knex): Promise<void> {
// Remove foreign key constraints and columns from 'agents' table
await knex.schema.table('agents', (table) => {
table.dropForeign(['currentSpellReleaseId'])
table.dropColumn('currentSpellReleaseId')
if (knex.schema.hasColumn('agents', 'createdAt')) {
table.dropColumn('createdAt')
}
if (knex.schema.hasColumn('agents', 'updatedAt')) {
table.dropColumn('updatedAt')
}
})

// Remove foreign key constraints and column from 'spells' table
await knex.schema.table('spells', (table) => {
table.dropForeign(['spellReleaseId'])
table.dropColumn('spellReleaseId')
})

// Drop the 'spellReleases' table
await knex.schema.dropTableIfExists('spellReleases')
}
3 changes: 2 additions & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"bundle:client": "npm run compile && npm pack --pack-destination ./public",
"migrate": "knex migrate:latest",
"migrate:make": "knex migrate:make",
"migrate:rollback": "knex migrate:rollback"
"migrate:rollback": "knex migrate:rollback",
"migrate:list": "knex migrate:list"
},
"dependencies": {
"knex": "^2.4.2"
Expand Down
39 changes: 39 additions & 0 deletions bruno-requests/Create Release.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
meta {
name: Create Release
type: http
seq: 3
}

post {
url: {{baseUrl}}/agents/createRelease/d9289fe5-71ad-4472-bcbe-f692ecd7d733?projectId=clp77m6sc0003ffjuezrwphn7
body: json
auth: none
}

query {
projectId: clp77m6sc0003ffjuezrwphn7
}

headers {
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: http://localhost:4200/
authorization: Bearer {{authToken}}
Origin: http://localhost:4200
Connection: keep-alive
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site
DNT: 1
Sec-GPC: 1
}

body:json {
{
"agentId": "d9289fe5-71ad-4472-bcbe-f692ecd7d733",
"versionTag": "Test",
"projectId": "clp77m6sc0003ffjuezrwphn7"
}
}
31 changes: 31 additions & 0 deletions bruno-requests/Get Agents.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
meta {
name: Get Agents
type: http
seq: 3
}

get {
url: {{baseUrl}}/agents?projectId=clp77m6sc0003ffjuezrwphn7
body: none
auth: none
}

query {
projectId: clp77m6sc0003ffjuezrwphn7
}

headers {
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: http://localhost:4200/
authorization: Bearer {{authToken}}
Origin: http://localhost:4200
Connection: keep-alive
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site
DNT: 1
Sec-GPC: 1
}
31 changes: 31 additions & 0 deletions bruno-requests/Get One Agent.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
meta {
name: Get One Agent
type: http
seq: 2
}

get {
url: {{baseUrl}}/agents/d9289fe5-71ad-4472-bcbe-f692ecd7d733?projectId=clp77m6sc0003ffjuezrwphn7
body: none
auth: none
}

query {
projectId: clp77m6sc0003ffjuezrwphn7
}

headers {
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: http://localhost:4200/
authorization: Bearer eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..69iUxpF7UvHXdMGi.qd9RrgVcsmGGc8jBVVdiKe-aPRuH6S8yv2ng5O8oB2LLMTj9nlXlwAsmHDk86IeSKMp2u5JvYHuHixjRgx8D5NgUn3SgZFrxS8ovcWY0eAwxMauvp17g80i0IgyOEX5EfiCBXDrYkC11twOvhEn3nL0-cRN_c2mrZ_C_2s9bFxtwrw0_zyAImenE7mF9B541-QHGNhAg_1sLcD3O4xMOx7GkMOQa29YRlENjlsN-efRAUuSLcFOIikvv82V-DgtFGcxNjR9Td3nGWPdgJ_zzMQU42AbosEE3DlopyKGyS6y6q742A7nnPWf_EpxgGz5WIoi9zmTsMrX8a_-ERIypXS0rEovl6P8hkKgHI3ytaGng7bwVKVWdCub8N2IUZgfKfIZlG3N7h2opPUI2BwvfV-yluuFqEnLKSIomdpcR6mKuIWVgnAkc_zpPDEVMll5nl44ZiMi2roDhLjgEdUVqOoGQ7agY3RIrOvXulKeWnX3nswum883DNeQPN09Y547bVoV7Qn6zlUS2BqrwW6XhOM9BMIj08Ew52N53EdcVzHetKMGfOp5xK5BWEXZajrASosPoAo2UyopG1aQIHMygy2DNxvcmPghmlD2rZfqcQZWnt-3JRP6ecKeXmStxEiMgbpM_sSR332HzenbPMtMBgeQjio6mUrebg6OR3IjUCzTFb7Ob4AryyF-vUb6WAs92DpJckfnL8ZyUSFyvAH84Jhz3RbDluDeR6hKQd7d0Ie546n6TViI8nSYpFcBjnnymYVYLfORw_9_A_St1c6t8.wdgZei2lnX_enT4ibTJHOg
Origin: http://localhost:4200
Connection: keep-alive
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site
DNT: 1
Sec-GPC: 1
}
5 changes: 5 additions & 0 deletions bruno-requests/bruno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version": "1",
"name": "Magick",
"type": "collection"
}
3 changes: 3 additions & 0 deletions bruno-requests/environments/Local - Standalone.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vars {
baseUrl: http://localhost:3030
}
6 changes: 6 additions & 0 deletions bruno-requests/environments/Local - With Cloud.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
vars {
baseUrl: http://localhost:3030
}
vars:secret [
authToken
]
Loading

0 comments on commit 2490ce0

Please sign in to comment.