diff --git a/bin/dc.sh b/bin/dc.sh index a2b832eb5..739c0d2a4 100755 --- a/bin/dc.sh +++ b/bin/dc.sh @@ -12,9 +12,7 @@ sub_help () { echo echo "Commands:" echo " help This help message" - echo " up Start standalone docker-compose version of web without dependent services $info" - echo " up-all Start docker-compose version of web with dependent services $info" - echo " up-deps Start docker-compose version of only dependent services $info" + echo " up Start docker-compose version of web $info" echo " down Stop and clean docker-compose containers" } @@ -23,18 +21,8 @@ sub_up () { docker-compose -f docker-compose.yml up ${1} } -sub_up-all () { - local files='-f docker-compose.yml -f docker-compose-deps.yml' - - docker-compose $files up ${1} -} - -sub_up-deps () { - docker-compose -f docker-compose-deps.yml up ${1} -} - sub_down () { - docker-compose -f docker-compose.yml -f docker-compose-deps.yml down --remove-orphans -v + docker-compose -f docker-compose.yml down --remove-orphans -v } case $command in diff --git a/docker-compose-deps.yml b/docker-compose-deps.yml deleted file mode 100644 index 7d01b2c04..000000000 --- a/docker-compose-deps.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: '3.4' - -services: - tools: - container_name: tools - image: otomi/core:${TOOLS_TAG:-main} - user: ${USER_ID} - command: binzx/otomi server - expose: - - 17771 - ports: - - 17771:17771 - volumes: - - $ENV_DIR:$ENV_DIR - environment: - ENV_DIR: $ENV_DIR - VERBOSITY: 2 - env_file: - - .env diff --git a/docker-compose.yml b/docker-compose.yml index 762b990c9..4ba9258ba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,6 @@ services: - /tmp:/tmp:rw working_dir: /app environment: - TOOLS_HOST: tools HOME: /app env_file: - .env diff --git a/src/api.authz.test.ts b/src/api.authz.test.ts index c199a3e91..5ea85e296 100644 --- a/src/api.authz.test.ts +++ b/src/api.authz.test.ts @@ -184,23 +184,6 @@ describe('API authz tests', () => { await agent.post('/v1/teams').send(data).set('Authorization', `Bearer ${platformAdminToken}`).expect(200) }) - test('platform admin can get all values', async () => { - jest.spyOn(otomiStack, 'getValues').mockResolvedValue({}) - await agent.get('/v1/otomi/values').set('Authorization', `Bearer ${platformAdminToken}`).expect(200) - }) - - test('team member cannot get all values', async () => { - await agent.get('/v1/otomi/values').set('Authorization', `Bearer ${teamMemberToken}`).expect(403) - }) - - test('authenticated user cannot get all values', async () => { - await agent.get('/v1/otomi/values').set('Authorization', `Bearer ${userToken}`).expect(403) - }) - - test('unauthenticated user cannot get all values', async () => { - await agent.get('/v1/otomi/values').expect(401) - }) - test('platform admin can see values from an app', async () => { const values = { shown: true } as App['values'] jest.spyOn(otomiStack, 'getApp').mockImplementation(() => ({ id: 'adminapp', values })) diff --git a/src/api/v1/otomi/values.ts b/src/api/v1/otomi/values.ts deleted file mode 100644 index ba62ef5ad..000000000 --- a/src/api/v1/otomi/values.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Debug from 'debug' -import { Response } from 'express' -import { OpenApiRequestExt } from 'src/otomi-models' - -const debug = Debug('otomi:api:v1:otomiValues') - -/** - * GET /v1/otomi/values - * Get Otomi values - */ -export const getValues = async (req: OpenApiRequestExt, res: Response): Promise => { - debug('getValues', req.query) - const data = await req.otomi.getValues(req.query) - const dateTime = new Date().toISOString() - let fileName = `values-${dateTime}.yaml` - if (req.query?.excludeSecrets === 'true') fileName = `values-redacted-${dateTime}.yaml` - res.setHeader('Content-type', 'application/yaml') - res.setHeader('Content-Disposition', `attachment; filename=${fileName}`) - res.send(data) -} diff --git a/src/constants.ts b/src/constants.ts index 26ae98054..7b78f8a0d 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,11 +1,3 @@ -import { TOOLS_HOST, cleanEnv } from './validators' - -const env = cleanEnv({ - TOOLS_HOST, -}) - -export const BASEURL = `http://${env.TOOLS_HOST}:17771` - export const APL_SECRETS_NAMESPACE = 'apl-secrets' export const APL_USERS_NAMESPACE = 'apl-users' export const PLATFORM_SECRETS_NAME = 'otomi-secrets' diff --git a/src/git.ts b/src/git.ts index d708bcbc8..0f8b0d2ba 100644 --- a/src/git.ts +++ b/src/git.ts @@ -1,4 +1,3 @@ -import axios, { AxiosResponse } from 'axios' import Debug from 'debug' import diff from 'deep-diff' import { rmSync } from 'fs' @@ -16,10 +15,8 @@ import { GIT_PUSH_RETRIES, GIT_REPO_URL, GIT_USER, - TOOLS_HOST, } from 'src/validators' import { parse as parseYaml, stringify as stringifyYaml } from 'yaml' -import { BASEURL } from './constants' import { GitPullError } from './error' import { Core } from './otomi-models' import { getSanitizedErrorMessage, removeBlankAttributes, sanitizeGitPassword } from './utils' @@ -33,12 +30,8 @@ const env = cleanEnv({ GIT_REPO_URL, GIT_USER, GIT_PUSH_RETRIES, - TOOLS_HOST, }) -const baseUrl = BASEURL -const valuesUrl = `${baseUrl}/otomi/values` - const getProtocol = (url): string => (url && url.includes('://') ? url.split('://')[0] : 'http') const getUrl = (url): string => (!url || url.includes('://') ? url : `${getProtocol(url)}://${url}`) @@ -92,12 +85,6 @@ export class Git { return getProtocol(this.url) } - async requestValues(params): Promise { - debug(`Tools: requesting "otomi/values" ${this.path}`) - const res = await axios.get(valuesUrl, { params: { envDir: this.path, ...params } }) - return res - } - async addConfig(): Promise { debug(`Adding git config`) await this.git.addConfig('user.name', this.user) diff --git a/src/openapi/api.yaml b/src/openapi/api.yaml index e0eb43228..0e95d8c1c 100644 --- a/src/openapi/api.yaml +++ b/src/openapi/api.yaml @@ -14,37 +14,6 @@ externalDocs: # -------------------------------------------- Paths paths: - /v1/otomi/values: - get: - operationId: getValues - x-eov-operation-handler: v1/otomi/values - description: Get otomi values - x-aclSchema: OtomiCliValues - parameters: - - name: filesOnly - in: query - description: IDs of settings to return - schema: - type: string - enum: ['true', 'false'] - - name: excludeSecrets - in: query - schema: - type: string - enum: ['true', 'false'] - - name: withWorkloadValues - in: query - schema: - type: string - enum: ['true', 'false'] - responses: - '200': - description: Successfully obtained otomi values - content: - application/yaml: - schema: - $ref: '#/components/schemas/OtomiCliValues' - /v1/teams: get: operationId: getTeams @@ -3562,8 +3531,6 @@ components: $ref: 'error.yaml#/OpenApiValidationError' OtomiStackError: $ref: 'error.yaml#/OtomiStackError' - OtomiCliValues: - $ref: 'otomi/cli.yaml#/OtomiCliValues' Policy: $ref: 'policies.yaml#/Policy' Policies: diff --git a/src/openapi/otomi/cli.yaml b/src/openapi/otomi/cli.yaml deleted file mode 100644 index fa4b6af77..000000000 --- a/src/openapi/otomi/cli.yaml +++ /dev/null @@ -1,6 +0,0 @@ -OtomiCliValues: - x-acl: - platformAdmin: [read-any] - teamAdmin: [] - teamMember: [] - type: object diff --git a/src/otomi-stack.ts b/src/otomi-stack.ts index 4d0870e84..e4e8ac334 100644 --- a/src/otomi-stack.ts +++ b/src/otomi-stack.ts @@ -111,7 +111,6 @@ import { OBJ_STORAGE_APPS, OBJECT_STORAGE_UI_EXCLUSIONS, PREINSTALLED_EXCLUDED_APPS, - TOOLS_HOST, VERSIONS, } from 'src/validators' import { v4 as uuidv4 } from 'uuid' @@ -186,7 +185,6 @@ const env = cleanEnv({ GIT_REPO_URL, GIT_USER, HELM_CHART_CATALOG, - TOOLS_HOST, VERSIONS, PREINSTALLED_EXCLUDED_APPS, HIDDEN_APPS, @@ -274,10 +272,6 @@ export default class OtomiStack { return getAppList() } - async getValues(query): Promise> { - return (await this.git.requestValues(query)).data - } - getRepoPath() { if (env.isTest || this.sessionId === undefined) return env.GIT_LOCAL_PATH return `${rootPath}/${this.sessionId}` diff --git a/src/validators.ts b/src/validators.ts index bfbd1d7ff..76a2f1d34 100644 --- a/src/validators.ts +++ b/src/validators.ts @@ -83,7 +83,6 @@ export const GIT_PROVIDER_URL_PATTERNS = json({ }) export const REGION = str({ desc: 'The cloud region' }) export const ROARR_LOG = bool({ desc: 'To enable Lightship logs', default: false }) -export const TOOLS_HOST = str({ desc: 'The host of the tools server', default: '127.0.0.1' }) export const PREINSTALLED_EXCLUDED_APPS = json({ desc: 'Applications that are managed by Linode, so they should be excluded from the apps page', default: {