Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
4rthem committed Dec 8, 2023
1 parent 36e7cb3 commit 601acf7
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 122 deletions.
10 changes: 8 additions & 2 deletions bin/ops/configurator-migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@ if [ -z "$2" ]; then
exit 1
fi

if [ -z "$3" ]; then
echo "Missing HELM release."
echo_usage
exit 1
fi

NS="${1}"
MIGRATION_NAME="${2}"
RELEASE_NAME=phrasea
RELEASE_VERSION=1.0.0-rc1
RELEASE_VERSION="${3}"

echo "Migrating..."

Expand All @@ -31,6 +37,6 @@ helm -n ${NS} get values ${RELEASE_NAME} -o yaml > /tmp/.current-values.yaml
helm pull https://github.com/alchemy-fr/alchemy-helm-charts-repo/releases/download/phrasea-${RELEASE_VERSION}/phrasea-${RELEASE_VERSION}.tgz

echo "Executing migrations..."
helm -n ${NS} upgrade ${RELEASE_NAME} ./phrasea-1.0.0-rc1.tgz \
helm -n ${NS} upgrade ${RELEASE_NAME} ./phrasea-${RELEASE_VERSION}.tgz \
-f /tmp/.current-values.yaml \
--set "configurator.executeMigration=${MIGRATION_NAME}"
5 changes: 0 additions & 5 deletions databox/indexer/loader.js

This file was deleted.

2 changes: 1 addition & 1 deletion databox/indexer/nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"watch": ["src"],
"ext": ".ts,.js",
"ignore": [],
"exec": "ts-node --files ./src/index.ts",
"exec": "vite build && node ./dist/index.mjs",
"env": {
"NODE_ENV": "development"
}
Expand Down
20 changes: 9 additions & 11 deletions databox/indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
"name": "@phrasea/databox-indexer",
"version": "1.0.0",
"description": "Consumes S3 events from AMQP and synchronize Databox",
"type": "module",
"main": "dist/index.js",
"main": "dist/index.mjs",
"license": "MIT",
"scripts": {
"start": "node --enable-source-maps dist/index.js",
"console": "node dist/console.js",
"console:dev": "ts-node --files ./src/console.ts",
"build": "rimraf ./dist && tsc",
"start:dev": "nodemon",
"console": "node dist/index.mjs",
"dev": "nodemon",
"build": "rimraf ./dist && vite build",
"test": "jest",
"sync-databox-types": "generate-api-platform-client --generator typescript http://databox-api src/",
"format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json|cjs|tsx|jsx)\"",
Expand All @@ -31,17 +28,18 @@
"winston": "^3.11.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@api-platform/create-client": "^0.10.0",
"@types/amqplib": "^0.10.4",
"@types/express": "^4.17.13",
"@types/minio": "^7.1.1",
"@types/node": "^18.8.5",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"nodemon": "^3.0.2",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.3.2"
"typescript": "^5.3.2",
"vite": "^5.0.7",
"vite-plugin-node": "^3.1.0"
}
}
6 changes: 3 additions & 3 deletions databox/indexer/src/configLoader.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {Config} from "./types/config";
import {getEnv} from "./env";

const fs = require('fs');
import * as process from "process";
import * as fs from "fs";

function loadConfig(): object {
return JSON.parse(fs.readFileSync(__dirname + '/../config/config.json').toString());
return JSON.parse(fs.readFileSync(process.cwd()+ '/config/config.json').toString());
}

function replaceEnv(str: string): string | boolean | number | undefined {
Expand Down
29 changes: 0 additions & 29 deletions databox/indexer/tsconfig.json

This file was deleted.

55 changes: 55 additions & 0 deletions databox/indexer/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { defineConfig } from 'vite';
import { VitePluginNode } from 'vite-plugin-node';

export default defineConfig({
plugins: [
...VitePluginNode({
appPath: './src/index.ts',

// Optional, default: 'viteNodeApp'
// the name of named export of you app from the appPath file
exportName: 'databoxIndexer',

// Optional, default: false
// if you want to init your app on boot, set this to true
initAppOnBoot: false,

// Optional, default: 'esbuild'
// The TypeScript compiler you want to use
// by default this plugin is using vite default ts compiler which is esbuild
// 'swc' compiler is supported to use as well for frameworks
// like Nestjs (esbuild dont support 'emitDecoratorMetadata' yet)
// you need to INSTALL `@swc/core` as dev dependency if you want to use swc
tsCompiler: 'esbuild',

// Optional, default: {
// jsc: {
// target: 'es2019',
// parser: {
// syntax: 'typescript',
// decorators: true
// },
// transform: {
// legacyDecorator: true,
// decoratorMetadata: true
// }
// }
// }
// swc configs, see [swc doc](https://swc.rs/docs/configuration/swcrc)
swcOptions: {}
}),
],
optimizeDeps: {
// Vite does not work well with optionnal dependencies,
// you can mark them as ignored for now
// eg: for nestjs, exlude these optional dependencies:
// exclude: [
// '@nestjs/microservices',
// '@nestjs/websockets',
// 'cache-manager',
// 'class-transformer',
// 'class-validator',
// 'fastify-swagger',
// ],
},
});
Loading

0 comments on commit 601acf7

Please sign in to comment.