diff --git a/.env.sandbox.docker-compose-dev b/.env.sandbox.docker-compose-dev new file mode 100644 index 000000000..2a6c25cf1 --- /dev/null +++ b/.env.sandbox.docker-compose-dev @@ -0,0 +1,20 @@ +# Common +AkashSandboxDatabaseCS=postgres://postgres:password@db:5432/cloudmos-akash-sandbox +UserDatabaseCS=postgres://postgres:password@db:5432/cloudmos-users +Network=sandbox +ActiveChain=akashSandbox + +# Deploy Web +API_BASE_URL: http://api:3080 +PROVIDER_PROXY_URL: http://provider-proxy:3040 + +# Stats Web +API_MAINNET_BASE_URL: http://api:3080 +API_TESTNET_BASE_URL: http://api:3080 +API_SANDBOX_BASE_URL: http://api:3080 + +# DB +POSTGRES_USER: postgres +POSTGRES_PASSWORD: password +POSTGRES_DBS_FOR_IMPORT: cloudmos-akash-sandbox +POSTGRES_USERS_DB: cloudmos-users \ No newline at end of file diff --git a/.github/workflows/docker-build-deploy-web.yml b/.github/workflows/docker-build-deploy-web.yml index cd591d234..d905810b2 100644 --- a/.github/workflows/docker-build-deploy-web.yml +++ b/.github/workflows/docker-build-deploy-web.yml @@ -24,4 +24,4 @@ jobs: - name: Build the Docker image if: steps.filter.outputs.deploy-web == 'true' - run: docker build -f docker/Dockerfile.deploy-web -t console-deploy-web . + run: npm run dc:build -- deploy-web diff --git a/.github/workflows/docker-build-indexer.yml b/.github/workflows/docker-build-indexer.yml index 9d4faf05f..2d9c6950e 100644 --- a/.github/workflows/docker-build-indexer.yml +++ b/.github/workflows/docker-build-indexer.yml @@ -25,4 +25,4 @@ jobs: - name: Build the Docker image if: steps.filter.outputs.indexer == 'true' - run: docker build -f docker/Dockerfile.indexer -t console-indexer . + run: npm run dc:build -- indexer diff --git a/.github/workflows/docker-build-landing.yml b/.github/workflows/docker-build-landing.yml index 8c3e7c5db..cc28ce935 100644 --- a/.github/workflows/docker-build-landing.yml +++ b/.github/workflows/docker-build-landing.yml @@ -24,4 +24,4 @@ jobs: - name: Build the Docker image for LANDING if: steps.filter.outputs.landing == 'true' - run: docker build -f docker/Dockerfile.landing -t console-landing . + run: npm run dc:build -- landing diff --git a/.github/workflows/docker-build-provider-proxy.yml b/.github/workflows/docker-build-provider-proxy.yml index ec667f83b..91c0b04da 100644 --- a/.github/workflows/docker-build-provider-proxy.yml +++ b/.github/workflows/docker-build-provider-proxy.yml @@ -24,4 +24,4 @@ jobs: - name: Build the Docker image if: steps.filter.outputs.provider-proxy == 'true' - run: docker build -f docker/Dockerfile.provider-proxy -t console-provider-proxy . + run: npm run dc:build -- provider-proxy diff --git a/.github/workflows/docker-build-stats-web.yml b/.github/workflows/docker-build-stats-web.yml index 915c2e196..9d822b542 100644 --- a/.github/workflows/docker-build-stats-web.yml +++ b/.github/workflows/docker-build-stats-web.yml @@ -24,4 +24,4 @@ jobs: - name: Build the Docker image if: steps.filter.outputs.stats-web == 'true' - run: docker build -f docker/Dockerfile.stats-web -t console-stats-web . + run: npm run dc:build -- stats-web diff --git a/.github/workflows/validate-n-build-api.yml b/.github/workflows/validate-n-build-api.yml index 63d5bbfb4..38b9ffb69 100644 --- a/.github/workflows/validate-n-build-api.yml +++ b/.github/workflows/validate-n-build-api.yml @@ -55,4 +55,4 @@ jobs: - name: Build the Docker image for API if: steps.filter.outputs.api == 'true' - run: docker build -f docker/Dockerfile.api -t console-api . + run: npm run dc:build -- api diff --git a/.gitignore b/.gitignore index 1f5362c04..e4fff45aa 100644 --- a/.gitignore +++ b/.gitignore @@ -16,52 +16,42 @@ pids *.seed *.pid.lock -# Directory for instrumented libs generated by jscoverage/JSCover +# Coverage directories and reports lib-cov - -# Coverage directory used by tools like istanbul coverage *.lcov - -# nyc test coverage .nyc_output -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - # Dependency directories node_modules/ jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) web_modules/ +bower_components -# TypeScript cache -*.tsbuildinfo +# Build directories and tools +build/Release +.grunt +.lock-wscript +.next +out +dist +build.ps1 -# Optional npm cache directory +# Caches .npm - -# Optional eslint cache .eslintcache - -# Optional stylelint cache .stylelintcache - -# Microbundle cache .rpt2_cache/ .rts2_cache_cjs/ .rts2_cache_es/ .rts2_cache_umd/ +.turbo +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* +*.tsbuildinfo # Optional REPL history .node_repl_history @@ -79,27 +69,10 @@ web_modules/ .env.production.local .env.local -# Next.js build output -.next -out -dist - -# Stores VSCode versions used for testing VSCode extensions -.vscode-test - # IDE files .idea .vscode - -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* - -# Scripts -build.ps1 +.vscode-test # Data Folder data \ No newline at end of file diff --git a/README.md b/README.md index 56c5dbed3..5461d6f5d 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,28 @@ See [Example_Queries.md](./doc/Example_Queries.md) This document provides instructions on how to set up and run the application, including steps for manual database restoration and using Docker Compose for ease of setup. +### Using Docker and Docker Compose +This project's service are deployed using Docker and Docker Compose. The following sections provide instructions for setting up and running the application using Docker Compose. +All the Dockerfiles are using multi-stage builds to optimize the image build processes. Same files are used to build both development and production images. There are 3 docker-compose files: +- **docker-compose.build.yml:** Base file solely building production images for the services. It can be used to verify the same build process as in CICD. +- **docker-compose.prod.yml:** This file is used to run the services in production mode. It also includes the database service which would fetch a remote backup and import it on init. +- **docker-compose.yml:** The default file to run all the services in development mode with features like hot-reload. + +Some commands are added to package.json for convenience. + +```shell +npm run dc:build # Build the production images +npm run dc:up:prod # Run the services in production mode +npm run dc:up:dev # Run the services in development mode +npm run dc:down # Stop the services referencing any possible service +``` + +Note: you may pass any `docker compose` related arguments to the above commands. E.g. to only start `deploy-web` service in development mode: +```shell +npm run dc:up:dev -- deploy-web +``` +This would also properly spin up all the dependencies like the `api`. + ## Manual Database Restoration Due to the extensive time required to index Akash from block #1, it's recommended to initialize your database using an existing backup for efficiency. This approach is particularly beneficial for development purposes. @@ -108,19 +130,6 @@ gunzip -c /path/to/cloudmos-akash-sandbox.sql.gz | psql --host "localhost" --por ``` After restoring the database, you can proceed with the specific project's README instructions for further setup and running the application. -### Using Docker Compose -For convenience, a Docker Compose configuration is provided to automate the database setup, download, and data import process. - -#### Configuration -1. Ensure environment variables are set in .postgres.local.env. This file configures PostgreSQL and import settings. -2. The `POSTGRES_DBS_FOR_IMPORT` variable should be updated with the databases you wish to import. This is a comma-separated list with potential values including `cloudmos-akash-sandbox` (default) and `cloudmos-akash-2` (mainnet). Leave this variable empty if no import is desired. - -#### Running Docker Compose -```sh -docker-compose up db -``` -This command spins up the database service and automatically handles the downloading and importing of the specified data. - # Database Structure The database schemas is defined using [sequelize-typescript](https://github.com/sequelize/sequelize-typescript) in [/shared/dbSchemas/](./shared/dbSchemas/). Models are separated into the following folders: diff --git a/apps/api/package-lock.json b/apps/api/package-lock.json new file mode 100755 index 000000000..e69de29bb diff --git a/apps/api/package.json b/apps/api/package.json index ac1296cf3..37975e3ba 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -14,6 +14,7 @@ "format": "prettier --write ./*.{js,json} **/*.{ts,js,json}", "lint": "eslint .", "start": "webpack --config webpack.dev.js --watch", + "dev": "npm run start", "test": "jest --selectProjects unit functional", "test:cov": "jest --selectProjects unit functional --coverage", "test:functional": "jest --selectProjects functional", @@ -40,7 +41,6 @@ "@octokit/rest": "^18.12.0", "@sentry/node": "^7.55.2", "axios": "^0.27.2", - "bufferutil": "^4.0.8", "cosmjs-types": "^0.5.0", "date-fns": "^2.29.2", "date-fns-tz": "^1.3.6", @@ -59,7 +59,6 @@ "sequelize": "^6.21.3", "sequelize-typescript": "^2.1.5", "stripe": "^10.14.0", - "utf-8-validate": "^5.0.10", "uuid": "^9.0.1", "zod": "^3.22.4" }, diff --git a/apps/api/webpack.dev.js b/apps/api/webpack.dev.js index fed69c311..4393114b1 100644 --- a/apps/api/webpack.dev.js +++ b/apps/api/webpack.dev.js @@ -1,10 +1,11 @@ const path = require("path"); -const { NODE_ENV = "development" } = process.env; const NodemonPlugin = require("nodemon-webpack-plugin"); const nodeExternals = require("webpack-node-externals"); const hq = require("alias-hq"); const webpack = require("webpack"); +const { NODE_ENV = "development" } = process.env; + module.exports = { entry: "./src/index.ts", mode: NODE_ENV, @@ -24,8 +25,7 @@ module.exports = { { test: /\.(ts|js)x?$/, exclude: /node_modules/, - loader: "ts-loader", - options: { configFile: "tsconfig.json" } + loader: "ts-loader" } ] }, diff --git a/apps/api/webpack.prod.js b/apps/api/webpack.prod.js index f676d33a8..f57ca73d8 100644 --- a/apps/api/webpack.prod.js +++ b/apps/api/webpack.prod.js @@ -1,8 +1,9 @@ const path = require("path"); -const { NODE_ENV = "production" } = process.env; +const webpack = require("webpack"); const nodeExternals = require("webpack-node-externals"); const hq = require("alias-hq"); -const webpack = require("webpack"); + +const { NODE_ENV = "production" } = process.env; module.exports = { entry: "./src/index.ts", @@ -22,11 +23,13 @@ module.exports = { { test: /\.(ts|js)x?$/, exclude: /node_modules/, - loader: "ts-loader", - options: { configFile: "tsconfig.json" } + loader: "ts-loader" } ] }, + optimization: { + minimize: false + }, plugins: [new webpack.IgnorePlugin({ resourceRegExp: /^pg-native$/ })], node: { __dirname: true diff --git a/apps/deploy-web/nginx.conf b/apps/deploy-web/nginx.conf deleted file mode 100644 index 6350c259e..000000000 --- a/apps/deploy-web/nginx.conf +++ /dev/null @@ -1,34 +0,0 @@ -# nginx.conf - -events { -} - -http { - server { - # Redirect HTTP requests to HTTPS. - listen 80; - - return 307 https://$host$request_uri; - } - - server { - listen 443 ssl; - - server_tokens off; - - ssl_certificate /etc/nginx/ssl/my_ssl_cert.crt; - ssl_certificate_key /etc/nginx/ssl/my_ssl_key.key; - - location / { - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto https; - proxy_set_header X-Forwarded-Ssl on; - proxy_set_header Host $http_host; - proxy_redirect off; - proxy_pass http://127.0.0.1:3001; - proxy_buffers 8 16k; - proxy_buffer_size 16k; - proxy_cookie_path / "/; HTTPOnly; Secure"; - } - } -} diff --git a/apps/deploy-web/package.json b/apps/deploy-web/package.json index dede84f25..81235024e 100644 --- a/apps/deploy-web/package.json +++ b/apps/deploy-web/package.json @@ -8,7 +8,7 @@ "scripts": { "build": "next build", "build-analyze": "set ANALYZE=true&& next build", - "dev": "next -p 3000", + "dev": "next", "format": "prettier --write ./*.{ts,js,json} **/*.{ts,tsx,js,json}", "lint": "eslint .", "start": "next start", @@ -144,7 +144,6 @@ "eslint": "^8.57.0", "eslint-config-next": "^14.2.3", "eslint-plugin-simple-import-sort": "^12.1.0", - "patch-package": "^8.0.0", "postcss": "^8.4.31", "postcss-nesting": "^12.0.2", "prettier": "^3.3.0", diff --git a/apps/deploy-web/patches/placeholder.txt b/apps/deploy-web/patches/placeholder.txt deleted file mode 100644 index 45ea04d7c..000000000 --- a/apps/deploy-web/patches/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -DO NOT REMOVE \ No newline at end of file diff --git a/apps/indexer/package.json b/apps/indexer/package.json index bf2ba9157..f837c7abf 100644 --- a/apps/indexer/package.json +++ b/apps/indexer/package.json @@ -18,6 +18,7 @@ "format": "prettier --write ./*.{js,json} **/*.{ts,js,json}", "lint": "eslint .", "start": "webpack --mode development --config webpack.dev.js --watch", + "dev": "npm run start", "test": "jest" }, "dependencies": { diff --git a/apps/indexer/webpack.dev.js b/apps/indexer/webpack.dev.js index 9e3038768..4393114b1 100644 --- a/apps/indexer/webpack.dev.js +++ b/apps/indexer/webpack.dev.js @@ -1,14 +1,16 @@ const path = require("path"); -const { NODE_ENV = "development" } = process.env; const NodemonPlugin = require("nodemon-webpack-plugin"); const nodeExternals = require("webpack-node-externals"); const hq = require("alias-hq"); const webpack = require("webpack"); +const { NODE_ENV = "development" } = process.env; + module.exports = { entry: "./src/index.ts", mode: NODE_ENV, target: "node", + devtool: "source-map", output: { path: path.resolve(__dirname, "dist"), filename: "server.js" diff --git a/apps/indexer/webpack.prod.js b/apps/indexer/webpack.prod.js index a53a1f31d..f57ca73d8 100644 --- a/apps/indexer/webpack.prod.js +++ b/apps/indexer/webpack.prod.js @@ -1,9 +1,10 @@ const path = require("path"); -const { NODE_ENV = "production" } = process.env; const webpack = require("webpack"); const nodeExternals = require("webpack-node-externals"); const hq = require("alias-hq"); +const { NODE_ENV = "production" } = process.env; + module.exports = { entry: "./src/index.ts", mode: NODE_ENV, diff --git a/apps/landing/package.json b/apps/landing/package.json index ce382caa2..4efb2996a 100644 --- a/apps/landing/package.json +++ b/apps/landing/package.json @@ -1,5 +1,5 @@ { - "name": "cloudmos-block-explorer", + "name": "console-landing", "version": "2.5.2", "private": true, "description": "Landing page for Cloudmos", @@ -7,7 +7,7 @@ "author": "Cloudmos", "scripts": { "build": "next build", - "dev": "next -p 3001", + "dev": "next", "format": "prettier --write ./*.{ts,js,json} **/*.{ts,tsx,js,json}", "lint": "eslint .", "start": "next start", diff --git a/apps/provider-proxy/package.json b/apps/provider-proxy/package.json index b8d76873d..d3b1f901d 100644 --- a/apps/provider-proxy/package.json +++ b/apps/provider-proxy/package.json @@ -9,7 +9,8 @@ "build": "npx tsc", "format": "prettier --write ./*.{ts,js,json} **/*.{ts,js,json}", "lint": "eslint .", - "start": "npx tsc && node ./build/main.js" + "start": "npm run build && node ./dist/server.js", + "dev": "npm run start" }, "dependencies": { "axios": "^1.3.0", diff --git a/apps/provider-proxy/main.ts b/apps/provider-proxy/server.ts similarity index 100% rename from apps/provider-proxy/main.ts rename to apps/provider-proxy/server.ts diff --git a/apps/provider-proxy/tsconfig.build.json b/apps/provider-proxy/tsconfig.build.json index e656b475b..352092b77 100644 --- a/apps/provider-proxy/tsconfig.build.json +++ b/apps/provider-proxy/tsconfig.build.json @@ -1,6 +1,3 @@ { - "compilerOptions": { - "outDir": "build", - }, "extends": "@akashnetwork/dev-config/tsconfig.base-node.json" } diff --git a/apps/provider-proxy/tsconfig.json b/apps/provider-proxy/tsconfig.json index 37039b682..734e1ab0e 100644 --- a/apps/provider-proxy/tsconfig.json +++ b/apps/provider-proxy/tsconfig.json @@ -1,7 +1,10 @@ { + "compilerOptions": { + "outDir": "dist", + }, "exclude": [ "node_modules", - "build" + "dist" ], "extends": "./tsconfig.build.json" } diff --git a/docker-compose.build.yml b/docker-compose.build.yml new file mode 100644 index 000000000..8272393c2 --- /dev/null +++ b/docker-compose.build.yml @@ -0,0 +1,40 @@ +services: + api: + build: + dockerfile: docker/Dockerfile.node + target: production + args: + WORKSPACE: apps/api + + indexer: + build: + dockerfile: docker/Dockerfile.node + target: production + args: + WORKSPACE: apps/indexer + + provider-proxy: + build: + dockerfile: docker/Dockerfile.node + target: production + args: + WORKSPACE: apps/provider-proxy + + deploy-web: + build: + dockerfile: docker/Dockerfile.nextjs + target: production + args: + WORKSPACE: apps/deploy-web + + stats-web: + build: + dockerfile: docker/Dockerfile.nextjs + args: + WORKSPACE: apps/stats-web + + landing: + build: + dockerfile: docker/Dockerfile.nextjs + args: + WORKSPACE: apps/landing diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 000000000..f6404d21f --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,75 @@ +services: + api: + restart: always + env_file: + - .env.sandbox.docker-compose-dev + environment: + PORT: 3000 + ports: + - '3080:3000' + depends_on: + db: + condition: service_healthy + + indexer: + restart: always + env_file: + - .env.sandbox.docker-compose-dev + depends_on: + db: + condition: service_healthy + + provider-proxy: + restart: always + environment: + PORT: 3000 + ports: + - '3040:3000' + + deploy-web: + restart: always + environment: + API_BASE_URL: http://api:3080 + PROVIDER_PROXY_URL: http://provider-proxy:3040 + env_file: + - apps/deploy-web/.env.local + ports: + - '3000:3000' + depends_on: + - api + - provider-proxy + + stats-web: + restart: always + env_file: + - .env.sandbox.docker-compose-dev + ports: + - '3001:3000' + depends_on: + - api + + landing: + restart: always + ports: + - '3002:3000' + + db: + build: + context: docker + dockerfile: Dockerfile.db + env_file: + - .env.sandbox.docker-compose-dev + restart: always + ports: + - '5432:5432' + volumes: + - postgres_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD", "bash", "/usr/local/bin/check-init.sh"] + interval: 10s + timeout: 5s + retries: 20 + +volumes: + postgres_data: + driver: local diff --git a/docker-compose.yml b/docker-compose.yml index 86bee4533..6977d738d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,88 +1,54 @@ services: api: build: - dockerfile: docker/Dockerfile.api - restart: always - environment: - AkashSandboxDatabaseCS: postgres://postgres:password@db:5432/cloudmos-akash-sandbox - UserDatabaseCS: postgres://postgres:password@db:5432/cloudmos-users - env_file: - - apps/api/.env.local - ports: - - '3080:3080' - depends_on: - - db + target: development + volumes: + - ./apps/api:/app/apps/api + - ./package.json:/app/package.json + - ./package-lock.json:/app/package-lock.json + - /app/node_modules + - /app/apps/api/node_modules indexer: build: - dockerfile: docker/Dockerfile.indexer - restart: always - environment: - AkashSandboxDatabaseCS: postgres://postgres:password@db:5432/cloudmos-akash-sandbox - UserDatabaseCS: postgres://postgres:password@db:5432/cloudmos-users - env_file: - - apps/indexer/.env.local - depends_on: - - db - - provider-proxy: - build: - dockerfile: docker/Dockerfile.provider-proxy - restart: always - ports: - - '3040:3040' + target: development + volumes: + - ./apps/indexer:/app/apps/indexer + - ./package.json:/app/package.json + - ./package-lock.json:/app/package-lock.json + - /app/node_modules + - /app/apps/indexer/node_modules deploy-web: build: - dockerfile: docker/Dockerfile.deploy-web - restart: always - environment: - API_BASE_URL: http://api:3080 - PROVIDER_PROXY_URL: http://provider-proxy:3040 - env_file: - - apps/deploy-web/.env.local - ports: - - '3000:3001' - depends_on: - - api - - provider-proxy + target: development + volumes: + - ./apps/deploy-web:/app/apps/deploy-web + - ./package.json:/app/package.json + - ./package-lock.json:/app/package-lock.json + - /app/node_modules + - /app/apps/deploy-web/node_modules + - /app/apps/deploy-web/.next stats-web: build: - dockerfile: docker/Dockerfile.stats-web - restart: always - environment: - API_MAINNET_BASE_URL: http://api:3080 - API_TESTNET_BASE_URL: http://api:3080 - API_SANDBOX_BASE_URL: http://api:3080 - API_BASE_URL: http://api:3080 - ports: - - '3001:3001' - depends_on: - - api + target: development + volumes: + - ./apps/stats-web:/app/apps/stats-web + - ./package.json:/app/package.json + - ./package-lock.json:/app/package-lock.json + - /app/node_modules + - /app/apps/stats-web/node_modules + - /app/apps/stats-web/.next landing: build: - dockerfile: docker/Dockerfile.landing - restart: always - ports: - - '3002:3001' - - db: - build: - context: docker - dockerfile: Dockerfile.db - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: password - POSTGRES_DBS_FOR_IMPORT: cloudmos-akash-sandbox - POSTGRES_USERS_DB: cloudmos-users - restart: always - ports: - - '5432:5432' + target: development volumes: - - postgres_data:/var/lib/postgresql/data + - ./apps/landing:/app/apps/landing + - ./package.json:/app/package.json + - ./package-lock.json:/app/package-lock.json + - /app/node_modules + - /app/apps/landing/node_modules + - /app/apps/landing/.next -volumes: - postgres_data: - driver: local diff --git a/docker/Dockerfile.api b/docker/Dockerfile.api deleted file mode 100644 index fae074c8c..000000000 --- a/docker/Dockerfile.api +++ /dev/null @@ -1,34 +0,0 @@ -FROM node:20-alpine AS builder - -WORKDIR /app - -COPY /apps/api /app/apps/api -COPY /packages /app/packages -COPY package.json /app -COPY package-lock.json /app - -RUN apk add --no-cache python3 make g++ libc6-compat postgresql-dev - -RUN npm ci -RUN npm run build --workspace apps/api - -FROM node:20-alpine - -WORKDIR /app - -COPY --from=builder /app/packages/database /app/packages/database -COPY --from=builder /app/package.json /app/package.json -COPY --from=builder /app/package-lock.json /app/package-lock.json - -COPY --from=builder /app/apps/api/dist /app/apps/api/dist -COPY --from=builder /app/apps/api/package.json /app/apps/api/package.json - -RUN apk add --no-cache python3 make g++ libc6-compat postgresql-dev - -RUN npm ci --workspace apps/api --omit=dev - -EXPOSE 80 - -WORKDIR /app/apps/api - -CMD ["node", "dist/server.js"] \ No newline at end of file diff --git a/docker/Dockerfile.db b/docker/Dockerfile.db index 8e767b57b..f37d68c14 100644 --- a/docker/Dockerfile.db +++ b/docker/Dockerfile.db @@ -2,4 +2,5 @@ FROM postgres:14.9 RUN apt-get update && apt-get install -y curl \ && rm -rf /var/lib/apt/lists/* -COPY prepare-and-seed-db.sh /docker-entrypoint-initdb.d/ +COPY bin/check-postgres-init.sh /usr/local/bin/check-init.sh +COPY bin/prepare-and-seed-postgres.sh /docker-entrypoint-initdb.d/ diff --git a/docker/Dockerfile.deploy-web b/docker/Dockerfile.deploy-web deleted file mode 100644 index a227cf152..000000000 --- a/docker/Dockerfile.deploy-web +++ /dev/null @@ -1,64 +0,0 @@ -FROM node:20 AS base - -FROM base AS deps - -WORKDIR /app - -COPY package.json /app -COPY package-lock.json /app -COPY apps/deploy-web/patches ./apps/deploy-web/patches -COPY apps/deploy-web/package.json ./apps/deploy-web/ - -RUN apt-get update && apt-get install -y libc6-dev && \ - ARCH=$(uname -m) && \ - if [ "$ARCH" = "x86_64" ]; then \ - npm install @next/swc-linux-x64-gnu; \ - elif [ "$ARCH" = "aarch64" ]; then \ - npm install @next/swc-linux-arm64-gnu; \ - else \ - echo "Unsupported architecture"; exit 1; \ - fi - -RUN npm ci - -FROM base AS builder - -WORKDIR /app - -COPY --from=deps /app/node_modules ./node_modules -COPY --from=deps /app/apps/deploy-web/node_modules ./apps/deploy-web/node_modules -COPY . . - -ENV NEXT_TELEMETRY_DISABLED 1 - -RUN npm run build -w apps/deploy-web - -FROM node:20 AS runner -WORKDIR /app - -ENV NODE_ENV production -ENV NEXT_TELEMETRY_DISABLED 1 - -RUN addgroup --system --gid 1001 nodejs -RUN adduser --system --uid 1001 nextjs - -COPY --from=builder /app/apps/deploy-web/public ./apps/deploy-web/public -COPY --from=builder --chown=nextjs:nodejs /app/apps/deploy-web/.next/standalone ./ -COPY --from=builder --chown=nextjs:nodejs /app/apps/deploy-web/.next/static ./apps/deploy-web/.next/static - -RUN apt-get update -RUN apt-get install libcap2-bin -y -RUN setcap cap_net_bind_service=+ep `readlink -f \`which node\`` - -RUN apt-get install nginx -y -RUN mkdir -p /etc/nginx/ssl -RUN openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout /etc/nginx/ssl/my_ssl_key.key -out /etc/nginx/ssl/my_ssl_cert.crt -subj "/CN=cloudmos.io" -days 600 -COPY apps/deploy-web/nginx.conf /etc/nginx/nginx.conf -RUN nginx -t - -EXPOSE 80 -EXPOSE 443 - -ENV PORT 3001 - -CMD sed -i "s/127.0.0.1/$(hostname -i)/" /etc/nginx/nginx.conf && service nginx start && node apps/deploy-web/server.js \ No newline at end of file diff --git a/docker/Dockerfile.indexer b/docker/Dockerfile.indexer deleted file mode 100644 index f07438e00..000000000 --- a/docker/Dockerfile.indexer +++ /dev/null @@ -1,29 +0,0 @@ -FROM node:20-alpine AS builder - -WORKDIR /app - -COPY /apps/indexer /app/apps/indexer -COPY /packages /app/packages -COPY package.json /app -COPY package-lock.json /app - -RUN npm ci --include-workspace-root --workspace=apps/indexer -RUN npm run build --workspace apps/indexer - -FROM node:20-alpine - -WORKDIR /app - -COPY --from=builder /app/apps/indexer/dist /app/apps/indexer/dist -COPY --from=builder /app/packages /app/packages -COPY --from=builder /app/package.json /app/package.json -COPY --from=builder /app/package-lock.json /app/package-lock.json -COPY --from=builder /app/apps/indexer/package.json /app/apps/indexer/package.json - -RUN npm ci --workspace apps/indexer --omit=dev - -EXPOSE 80 - -WORKDIR /app/apps/indexer - -CMD ["node", "dist/server.js"] \ No newline at end of file diff --git a/docker/Dockerfile.landing b/docker/Dockerfile.landing deleted file mode 100644 index f540e341f..000000000 --- a/docker/Dockerfile.landing +++ /dev/null @@ -1,43 +0,0 @@ -FROM node:20-alpine AS deps -# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. -RUN apk add --no-cache libc6-compat -WORKDIR /app - -COPY package.json /app -COPY package-lock.json /app -COPY apps/landing/package.json ./apps/landing/ - -RUN npm ci - -FROM node:20-alpine AS builder -WORKDIR /app - -COPY --from=deps /app/node_modules ./node_modules -COPY --from=deps /app/apps/landing/node_modules ./apps/landing/node_modules -COPY . . - -ENV NEXT_TELEMETRY_DISABLED 1 - -RUN npm run build -w apps/landing -ENV NEXT_TELEMETRY_DISABLED 1 - -FROM node:20-alpine AS runner -WORKDIR /app - -ENV NODE_ENV production -ENV NEXT_TELEMETRY_DISABLED 1 - -RUN addgroup --system --gid 1001 nodejs -RUN adduser --system --uid 1001 nextjs - -COPY --from=builder /app/apps/landing/public ./apps/landing/public -COPY --from=builder --chown=nextjs:nodejs /app/apps/landing/.next/standalone ./ -COPY --from=builder --chown=nextjs:nodejs /app/apps/landing/.next/static ./apps/landing/.next/static - -USER nextjs - -EXPOSE 3001 - -ENV PORT 3001 - -CMD ["node", "apps/landing/server.js"] \ No newline at end of file diff --git a/docker/Dockerfile.nextjs b/docker/Dockerfile.nextjs new file mode 100644 index 000000000..7db919b3c --- /dev/null +++ b/docker/Dockerfile.nextjs @@ -0,0 +1,54 @@ +FROM node:20-alpine AS base + +ARG WORKSPACE +ENV WORKSPACE $WORKSPACE + +ENV NEXT_TELEMETRY_DISABLED 1 + +FROM base AS development + +ENV NODE_ENV development + +WORKDIR /app + +RUN apk add --no-cache libc6-compat + +COPY $WORKSPACE ./$WORKSPACE +COPY /packages /app/packages +COPY package.json /app +COPY package-lock.json /app + +RUN npm install + +CMD ["npm", "run", "dev", "--workspace", "${WORKSPACE}"] + +FROM development AS builder + +WORKDIR /app + +ENV NODE_ENV production + +RUN npm run build -w $WORKSPACE + +FROM base AS production + +WORKDIR /app + +ENV NODE_ENV production +ENV APP_GROUP_ID 1001 +ENV APP_GROUP nodejs +ENV APP_USER app + +RUN addgroup --system --gid $APP_GROUP_ID $APP_GROUP +RUN adduser --system --uid $APP_GROUP_ID $APP_USER + +COPY --from=builder /app/$WORKSPACE/public ./$WORKSPACE/public +COPY --from=builder /app/$WORKSPACE/.next/standalone ./ +COPY --from=builder /app/$WORKSPACE/.next/static ./$WORKSPACE/.next/static +RUN chown -R $APP_USER:$APP_GROUP /app + +WORKDIR /app/$WORKSPACE + +USER $APP_USER + +CMD ["node", "server.js"] \ No newline at end of file diff --git a/docker/Dockerfile.node b/docker/Dockerfile.node new file mode 100644 index 000000000..56fc9c19b --- /dev/null +++ b/docker/Dockerfile.node @@ -0,0 +1,51 @@ +FROM node:20-alpine AS base + +ARG WORKSPACE +ENV WORKSPACE $WORKSPACE + +WORKDIR /app + +FROM base AS development + +WORKDIR /app + +COPY /$WORKSPACE /app/$WORKSPACE +COPY /packages /app/packages +COPY package.json /app +COPY package-lock.json /app + +RUN npm install + +CMD ["npm", "run", "dev", "--workspace", "${WORKSPACE}"] + +FROM development AS builder + +WORKDIR /app + +RUN npm run build --workspace $WORKSPACE + +FROM base AS production + +WORKDIR /app + +ENV NODE_ENV production +ENV APP_GROUP_ID 1001 +ENV APP_GROUP nodejs +ENV APP_USER app + +RUN addgroup --system --gid $APP_GROUP_ID $APP_GROUP +RUN adduser --system --uid $APP_GROUP_ID $APP_USER + +COPY --from=builder --chown=$APP_USER:$APP_GROUP /app/$WORKSPACE/dist /app/$WORKSPACE/dist +COPY --from=builder --chown=$APP_USER:$APP_GROUP /app/packages /app/packages +COPY --from=builder --chown=$APP_USER:$APP_GROUP /app/package.json /app/package.json +COPY --from=builder --chown=$APP_USER:$APP_GROUP /app/package-lock.json /app/package-lock.json +COPY --from=builder --chown=$APP_USER:$APP_GROUP /app/$WORKSPACE/package.json /app/$WORKSPACE/package.json + +RUN npm ci --workspace $WORKSPACE --omit=dev + +WORKDIR /app/$WORKSPACE + +USER $APP_USER + +CMD ["node", "dist/server.js"] \ No newline at end of file diff --git a/docker/Dockerfile.provider-proxy b/docker/Dockerfile.provider-proxy deleted file mode 100644 index 0dd70f192..000000000 --- a/docker/Dockerfile.provider-proxy +++ /dev/null @@ -1,27 +0,0 @@ -FROM node:20-alpine AS builder - -WORKDIR /app - -COPY /apps/provider-proxy /app/apps/provider-proxy -COPY /packages /app/packages -COPY package.json /app -COPY package-lock.json /app - -RUN npm ci -RUN npm run build --workspace apps/provider-proxy - -FROM node:20-alpine - -WORKDIR /app - -COPY --from=builder /app/package.json /app/package.json -COPY --from=builder /app/package-lock.json /app/package-lock.json - -COPY --from=builder /app/apps/provider-proxy/build /app/apps/provider-proxy/build -COPY --from=builder /app/apps/provider-proxy/package.json /app/apps/provider-proxy/package.json - -RUN npm ci --workspace apps/provider-proxy --omit=dev - -EXPOSE 80 - -CMD ["node", "apps/provider-proxy/build/main.js"] \ No newline at end of file diff --git a/docker/Dockerfile.stats-web b/docker/Dockerfile.stats-web deleted file mode 100644 index 38bc4b0eb..000000000 --- a/docker/Dockerfile.stats-web +++ /dev/null @@ -1,61 +0,0 @@ -FROM node:20 AS base - -FROM base AS deps - -WORKDIR /app - -COPY package.json /app -COPY package-lock.json /app -COPY apps/stats-web/package.json ./apps/stats-web/ - -RUN apt-get update && apt-get install -y libc6-dev && \ - ARCH=$(uname -m) && \ - if [ "$ARCH" = "x86_64" ]; then \ - npm install @next/swc-linux-x64-gnu; \ - elif [ "$ARCH" = "aarch64" ]; then \ - npm install @next/swc-linux-arm64-gnu; \ - else \ - echo "Unsupported architecture"; exit 1; \ - fi - -RUN npm ci - -FROM base AS builder - -WORKDIR /app - -COPY --from=deps /app/node_modules ./node_modules -COPY --from=deps /app/apps/stats-web/node_modules ./apps/stats-web/node_modules -COPY . . - -ENV NEXT_TELEMETRY_DISABLED 1 - -RUN npm run build -w apps/stats-web - -FROM node:20 AS runner -WORKDIR /app - -ENV NODE_ENV production -ENV NEXT_TELEMETRY_DISABLED 1 - -RUN addgroup --system --gid 1001 nodejs -RUN adduser --system --uid 1001 nextjs - -COPY --from=builder /app/package.json . -COPY --from=builder /app/package-lock.json . -COPY --from=builder /app/apps/stats-web/public ./apps/stats-web/public -COPY --from=builder --chown=nextjs:nodejs /app/apps/stats-web/.next/standalone ./apps/stats-web -COPY --from=builder --chown=nextjs:nodejs /app/apps/stats-web/.next/static ./apps/stats-web/.next/static - -RUN apt-get update -RUN apt-get install libcap2-bin -y -RUN setcap cap_net_bind_service=+ep `readlink -f \`which node\`` - - -USER nextjs - -EXPOSE 3001 - -ENV PORT 3001 - -CMD ["node", "apps/stats-web/server.js"] \ No newline at end of file diff --git a/docker/bin/check-postgres-init.sh b/docker/bin/check-postgres-init.sh new file mode 100755 index 000000000..4db59d3e9 --- /dev/null +++ b/docker/bin/check-postgres-init.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Check if the init script has completed +if [ -f /var/lib/postgresql/data/init-complete ]; then + exit 0 +else + exit 1 +fi \ No newline at end of file diff --git a/docker/prepare-and-seed-db.sh b/docker/bin/prepare-and-seed-postgres.sh similarity index 96% rename from docker/prepare-and-seed-db.sh rename to docker/bin/prepare-and-seed-postgres.sh index 69f1be56f..8d153aa74 100755 --- a/docker/prepare-and-seed-db.sh +++ b/docker/bin/prepare-and-seed-postgres.sh @@ -49,4 +49,5 @@ done IFS=$old_IFS +touch /var/lib/postgresql/data/init-complete echo "DB_SEEDER: Done." diff --git a/package-lock.json b/package-lock.json index 5efa03042..94da8cd85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,7 +37,6 @@ "@octokit/rest": "^18.12.0", "@sentry/node": "^7.55.2", "axios": "^0.27.2", - "bufferutil": "^4.0.8", "cosmjs-types": "^0.5.0", "date-fns": "^2.29.2", "date-fns-tz": "^1.3.6", @@ -56,7 +55,6 @@ "sequelize": "^6.21.3", "sequelize-typescript": "^2.1.5", "stripe": "^10.14.0", - "utf-8-validate": "^5.0.10", "uuid": "^9.0.1", "zod": "^3.22.4" }, @@ -225,7 +223,6 @@ "eslint": "^8.57.0", "eslint-config-next": "^14.2.3", "eslint-plugin-simple-import-sort": "^12.1.0", - "patch-package": "^8.0.0", "postcss": "^8.4.31", "postcss-nesting": "^12.0.2", "prettier": "^3.3.0", @@ -601,7 +598,7 @@ "integrity": "sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A==" }, "apps/landing": { - "name": "cloudmos-block-explorer", + "name": "console-landing", "version": "2.5.2", "license": "Apache-2.0", "dependencies": { @@ -17709,12 +17706,6 @@ "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" }, - "node_modules/@yarnpkg/lockfile": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", - "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", - "dev": true - }, "node_modules/abitype": { "version": "0.9.8", "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.9.8.tgz", @@ -19129,6 +19120,8 @@ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz", "integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==", "hasInstallScript": true, + "optional": true, + "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -19741,10 +19734,6 @@ "resolved": "apps/api", "link": true }, - "node_modules/cloudmos-block-explorer": { - "resolved": "apps/landing", - "link": true - }, "node_modules/cloudmos-indexer": { "resolved": "apps/indexer", "link": true @@ -20173,6 +20162,10 @@ "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==" }, + "node_modules/console-landing": { + "resolved": "apps/landing", + "link": true + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -23332,15 +23325,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-yarn-workspace-root": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", - "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", - "dev": true, - "dependencies": { - "micromatch": "^4.0.2" - } - }, "node_modules/flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", @@ -27685,15 +27669,6 @@ "node": ">=0.10.0" } }, - "node_modules/klaw-sync": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", - "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.11" - } - }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -30532,183 +30507,6 @@ "node": ">=0.10.0" } }, - "node_modules/patch-package": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", - "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", - "dev": true, - "dependencies": { - "@yarnpkg/lockfile": "^1.1.0", - "chalk": "^4.1.2", - "ci-info": "^3.7.0", - "cross-spawn": "^7.0.3", - "find-yarn-workspace-root": "^2.0.0", - "fs-extra": "^9.0.0", - "json-stable-stringify": "^1.0.2", - "klaw-sync": "^6.0.0", - "minimist": "^1.2.6", - "open": "^7.4.2", - "rimraf": "^2.6.3", - "semver": "^7.5.3", - "slash": "^2.0.0", - "tmp": "^0.0.33", - "yaml": "^2.2.2" - }, - "bin": { - "patch-package": "index.js" - }, - "engines": { - "node": ">=14", - "npm": ">5" - } - }, - "node_modules/patch-package/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/patch-package/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/patch-package/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/patch-package/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/patch-package/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/patch-package/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/patch-package/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/patch-package/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/patch-package/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/patch-package/node_modules/slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/patch-package/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/patch-package/node_modules/yaml": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", - "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", - "dev": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -36486,6 +36284,8 @@ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", "hasInstallScript": true, + "optional": true, + "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, diff --git a/package.json b/package.json index 5b4394da7..2fea3a5ac 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,10 @@ "./apps/*" ], "scripts": { + "dc:build": "docker compose -f docker-compose.build.yml build", + "dc:down": "docker compose -p console down", + "dc:up:dev": "docker compose -p console -f docker-compose.build.yml -f docker-compose.prod.yml -f docker-compose.yml up", + "dc:up:prod": "docker compose -p console -f docker-compose.build.yml -f docker-compose.prod.yml up", "format": "prettier --write ./*.{js,json} **/*.{ts,tsx,js,json}", "lint": "eslint .", "lint:api": "eslint ./apps/api"