subsquid / squid-cli

CLI for managing squid deployments to the Subsquid Cloud
17 stars 16 forks source link

sqd deploy from within a monorepo #63

Open mlenser opened 5 months ago

mlenser commented 5 months ago

Hi,

We have a monorepo where our indexer is a package of many. sqd deploy expects a package-lock.json (or the equivalent for yarn/pnpm) within the package, but the lock file is at the root of the monorepo. We've worked around this a bit by forcing our indexer to generate a package-lock.json via npm i --omit=dev --legacy-peer-deps --install-strategy=nested --workspaces=false --package-lock-only.

But that presents its own challenges as we cannot import from any other packages within the monorepo and we have to continuously update the package-lock.json just for sqd deploy.

Is there a recommended path here? We just switched from yarn to pnpm at the monorepo root if it matters.

mo4islona commented 5 months ago

Hey! Could you please clarify how you deploy squid - are you deploying squid from the package folder rather than from the monorepo root folder? Is the Squid manifest also in that folder?

We run npm ci or add --frozen-lockfile flag for pnpm/yarn builds to ensure that you will have he same list of deps as you expect. Obviously this won't work if the lockfile is missing

mlenser commented 5 months ago

We're running sqd deploy from within the indexer package. The manifests are also in the indexer package.

We run npm ci or add --frozen-lockfile flag for pnpm/yarn builds to ensure that you will have he same list of deps as you expect. Obviously this won't work if the lockfile is missing

Ya, that's why we have to add this fake package-lock.json for the indexer package which also prevents indexer from being able to import from other packages.

mlenser commented 4 months ago

Hi @mo4islona gentle reminder. Is there a pattern to make squid-cli work in a monorepo without the hacks and to allow it to import from local packages?

mo4islona commented 4 months ago

Hey @mlenser! Sorry for the delay.

But that presents its own challenges as we cannot import from any other packages within the monorepo and we have to continuously update the package-lock.json just for sqd deploy.

You can run the postintsall script so that it will automatically trigger now when you make changes to the root package.json. Have you tried copying the lock file to the squid folder?

"scripts": {
    "postinstall": "cp yarn.lock packages/indexer/yarn.lock"
}

In general, I see 2 options to solve the issue:

WDYT?

mlenser commented 4 months ago

Copying the pnpm-lock.yaml (same for yarn.lock) from the root of the monorepo to the squid package won't work as we'll get a ERR_PNPM_LOCKFILE_CONFIG_MISMATCH error:


Step 11/24 : ADD assets assets
---> 04e023b2b072
Step 12/24 : ADD db db
---> db13bf7fb06a
Step 13/24 : ADD schema.graphql .
---> d678c2a1c7f7
Step 14/24 : ADD src src
---> 3f974c1a08c9
Step 15/24 : RUN pnpm install --frozen-lockfile
---> Running in cae545c34c40
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH  Cannot proceed with the frozen installation. The current "overrides" configuration doesn't match the value found in the lockfile

Update your lockfile using "pnpm install --no-frozen-lockfile"
The command '/bin/sh -c pnpm install --frozen-lockfile' returned a non-zero code: 1
◷ Building the squid... 
 ›   Error: ❌ An error occurred while building the squid
 ›   ------
 ›   Please report to Discord https://discord.gg/KRvRcBdhEE or SquidDevs 
 ›   https://t.me/HydraDevs
 ›   Deploy: 31917
 ›   Squid: OMITTED_REPO_NAME-ci
 ›   Version: v1
 ELIFECYCLE  Command failed with exit code 2.
 ```

🤔 
mo4islona commented 4 months ago

Got it. So for now we can only automate lock file generation with postintsall and npm i --omit=dev --legacy-peer-deps ..... and wait until we add support for monorepo.

Are you using pnpm and not rush, right?

mlenser commented 4 months ago

We're currently using pnpm at the root and npm inside the indexer package. We have pnpm workspace dependencies inside devDependencies of indexer which we strip out before generating the package-lock.json as npm can't handle workspaces.

Our generate-lock-file script:

pnpm package-json:remove-workspaces && npm i --omit=dev --legacy-peer-deps --install-strategy=nested --workspaces=false --package-lock-only && prettier --log-level warn --write package-lock.json && pnpm package-json:add-workspaces

This allows it to function as the devDependencies aren't used by squid, but it presents 2 problems as discussed above:

  1. Having to generate the lock file (tolerable)
  2. Not being able to import from other packages (this is the problem)

I'm trying to solve for the second issue at least, but I'm not seeing a way to make pnpm generate a lock file just for indexer like we do with npm. It all boils down to squid here though.

mo4islona commented 4 months ago

So, we are preparing a new release with a feature allowing customization of the install command. I'll provide instructions how to update when ready

mo4islona commented 4 months ago

So

  1. Please update CLI to 2.8.4 npm i -g @subsquid/cli@2.8.4
  2. Remove all lock files from squid directory
  3. Add custom install command to build section
    build:
    # ... other options
    install:
    cmd: 
      - pnpm
      - install

This will allow you to install deps without a lockfile. But be aware of their possible inconsistency.

mlenser commented 4 months ago

That sounds very promising, thank you!

Upon testing it our squid has been building for 1 hour and 20 mins when it previously took around 5-30 mins. I assume it has failed.

sqd deploy -ru -m ./squid-ci.yaml -o OMITTED_ORG_NAME .
Squid directory: /home/runner/work/OMITTED_REPO_NAME/services/indexer
Build directory: /home/runner/work/OMITTED_REPO_NAME/services/indexer/builds
Manifest: ./squid-ci.yaml
◷ Compressing the squid to OMITTED_REPO_NAME-ci-8017521824-v1.tar.gz ... 85 file(s) ✔️
adding .dockerignore
adding .eslintignore
adding .eslintrc.js
adding .gitignore
adding .gitpod.yml
adding .prettierignore
adding .prettierrc.js
adding .turbo
-- ignoring Dockerfile
adding LICENSE
adding README.md
adding abi
adding assets
-- ignoring builds
adding commands.json
adding db
-- ignoring lib
-- ignoring node_modules
adding package.json
adding renovate.json
adding schema.graphql
adding scripts
adding squid-ci.yaml
adding squid-mainnet.yaml
adding squid-sepolia.yaml
adding src
adding tsconfig.json
adding tsconfig.lint.json
adding .turbo/turbo-build.log
adding assets/README.MD
adding db/migrations
adding db/migrations/1708437055647-Data.js
adding db/migrations/17086OMITTED_PRIVATE_HASH 305309-Data.js
adding src/abi/multicall.ts
adding src/model/generated
adding src/model/index.ts
◷ Uploading OMITTED_PRIVATE_NAME-8017521824-v1.tar.gz... ✔️
🦑 Releasing the squid from local folder
◷ Preparing the squid... ✔️
Downloading squid archive from https://storage.googleapis.com/subsquid-rest-api-tmp-upload/tmp/b0a8bd69-9c5f-430b-be13-d024a56eb664.tar.gz...
Extracting archive...
Extracted 86 files from archive, hash OMITTED_PRIVATE_HASH
◷ Building the squid...
◷ You may now detach from the build process by pressing Ctrl + C. The Squid deployment will continue uninterrupted.
◷ The new squid will be available as soon as the deployment is complete.
◷ Building the squid...
◷ Building the squid...
◷ Building the squid...
forever and ever
mo4islona commented 4 months ago

Well, your build just hanged on our builder. I'm investigating

mlenser commented 4 months ago

Update: I let one build run for 1 hour & 22 minutes. It built the squid forever and then got to

Step 1/13 : FROM node:20-alpine as squid
---> df6a39829ab5
Step 2/13 : WORKDIR /squid
---> Using cache
---> 19764c93dbed
Step 3/13 : RUN echo -e "loglevel=silent\nupdate-notifier=false" > /squid/.npmrc
---> Using cache
---> b2c27c3cb284
Step 4/13 : RUN corepack enable && npm i -g @subsquid/commands && mv $(which squid-commands) /usr/local/bin/sqd
---> Using cache
---> 936572e31741
Step 5/13 : ADD assets assets
---> Using cache
---> 432c1a1f02eb
Step 6/13 : ADD db db
---> Using cache
---> 1908813900c2
Step 7/13 : ADD commands.json commands.json
---> Using cache
---> d08a3d064fad
Step 8/13 : ADD schema.graphql schema.graphql
---> Using cache
---> fb3d08a67db1
Step 9/13 : ADD src src
---> Using cache
---> 8652bab1923e
Step 10/13 : ADD package.json package.json
---> Using cache
---> acb824fc9858
Step 11/13 : ADD tsconfig.json tsconfig.json
---> Using cache
---> 24494db6158d
Step 12/13 : RUN pnpm install
---> Running in a16beb0af720
The command '/bin/sh -c pnpm install' returned a non-zero code: 137
◷ Building the squid... 
 ›   Error: ❌ An error occurred while building the squid
 ›   ------
 ›   Please report to Discord https://discord.gg/KRvRcBdhEE or SquidDevs 
 ›   https://t.me/HydraDevs
 ›   Deploy: 32148
 ›   Squid: OMITTED_REPO_NAME-ci-8018486937
 ›   Version: v1
 ELIFECYCLE  Command failed with exit code 2.
 ›   Error: Nonexistent flag: -o
 ›   See more help with --help
mo4islona commented 4 months ago

Update: I let one build run for 1 hour & 22 minutes. It built the squid forever and then got to

Thats fine for now. I'll come back when issue will be fixed

mo4islona commented 4 months ago

I assume the problem is that the squid directory cannot be built with pnpm but somehow it doesn't stop the build itself

pnpm install
ERR_PNPM_WORKSPACE_PKG_NOT_FOUND  In : "eslint-config-astaria@workspace:*" is in the dependencies but no package named "eslint-config-astaria" is present in the workspace

This error happened while installing a direct dependency of /Users/user/Downloads/b0a8bd69-9c5f-430b-be13-d024a56eb664

Packages found in the workspace:
mo4islona commented 4 months ago

But, in general, you are importing internal packages thats missing in the archive

"contracts-internal": "workspace:*",
"rewards": "workspace:*",

In that case, I think, you should try to upload whole monorepo and modify run commands instead of install


build:
  node_version: 20
  # package_manager: pnpm - BTW no need to specify it explicitly, it will understand by the pnpm lockfile in the root
  # do not modify install / build command
deploy:
   processor:
      cmd: 
        - cd
        - packages/indexer
        - &&
        - node
        - lib/main
   api:
     cmd: 
      - cd
      - packages/indexer
      - &&
      - npx
      - squid-graphql-server
      - '--dumb-cache'
      - in-memory
      - '--dumb-cache-ttl'
      - '1000'
      - '--dumb-cache-size'
      - '100'
      - '--dumb-cache-max-age'
      - '1000'
mlenser commented 4 months ago
 »   Error: Validation error occurred:
 »   1) "deploy.processor[0].cmd[2]" must be a string
 »   2) "deploy.api.cmd[2]" must be a string
error Command failed with exit code 2.
mo4islona commented 4 months ago

Please add quotes '&&' / "&&"

mlenser commented 4 months ago

Ya, I tried that as well. 😋

 »   Error: Validation error occurred:
 »   1) "deploy.processor[0].cmd[2]" with value "&&" is invalid. Only latin letters, numbers, ".", "-", "_", "/" and 
 »   ":" symbols are allowed.
 »   2) "deploy.api.cmd[2]" with value "&&" is invalid. Only latin letters, numbers, ".", "-", "_", "/" and ":" symbols
 »    are allowed.
error Command failed with exit code 2.
mo4islona commented 4 months ago

Oh, I see :(

Okay, I'll try to make it work and come back again.

mo4islona commented 4 months ago

Hey! What is the structure of your monorepo directories?

A classical one?

package.json
tsconfig.json
packages/
    packages/indexer/....
    packages/other-package/....
mlenser commented 4 months ago
package.json
pnpm.lock.yaml
pnpm-workspace.yaml
apps
    web-app
packages
    sdk
    others
services
    indexer

Indexer only imports from packages. pnpm wires it all together.

The current structure of squid isn't setup for the standard setup or our setup.

mo4islona commented 4 months ago

Well, we've added support for combining commands with "&&". Please update to 2.8.5 npm i -g @subsquid/cli@2.8.5

How do you build the squid? Probably you have to setup a proper build command

mlenser commented 4 months ago

When deploying from the root I run into:

Error: The squid archive size is too large (840118875 bytes), exceeding the limit of 52.0M.

😢

Our monorepo isn't very big. Any idea how to prune things like node_modules or expand the limit?

mo4islona commented 4 months ago

Could you please provide a full log?

mo4islona commented 4 months ago

Or, if the repo is in the public domain, I can take a look at it and try to deploy it

mlenser commented 4 months ago

Let me get back to you tomorrow. I may have it set up properly and working in CI minus some internal config issues. The memory warning only happens when I run it locally.

I'll update tomorrow.

mlenser commented 4 months ago

Is there a way I can give you a log via some id? I'm running into the memory issue when trying another method of pnpm deploy and then trying to use that.

The issue is squid throws an error if it's >52 MB. Not sure that'll be avoidable with these methods that inherently group a lot more data. Deploying from the root for example includes everything in apps even though it's never included in indexer.

mo4islona commented 4 months ago

Is there a way I can give you a log via some id?

I'm actually interested in the client-side log. 52 MB is not a memory issue, it's the maximum size of the uploaded file.

I believe the problem is that the node_modules of all subpackages are getting into the final archive But ok, I'll try to reproduce with some fake package with a lot of deps.

mo4islona commented 4 months ago

I hope it's only node_modules, which is pretty easy to fix. And there aren't some huge directories in there that we couldn't fix so easily unless we have .squidignore file.

mo4islona commented 4 months ago

BTW have you tried to deploy a package?

pnpm --filter=<deployed project name> deploy <target directory>

https://pnpm.io/cli/deploy

mlenser commented 4 months ago

I'm trying 2 methods currently:

Method 1: Deploy from the root

From root package.json run sqd deploy -ru -m ./services/indexer/squid-ci.yaml . This bundles everything - all apps, all services, all packages, etc. It may be the . at the end.

This uses squid-ci.yaml

build:
  node_version: 20
  package_manager: pnpm
  cmd:
    - pnpm
    - indexer:build
deploy:
  processor:
    - cmd:
        - cd
        - services/indexer
        - '&&'
        - node
        - lib/main.js
  api:
    cmd:
      - cd
      - services/indexer
      - '&&'
      - npx
      - squid-graphql-server

This includes everything and I don't love deploying from the root as it requires me to install things at the root.

Method 2: pnpm deploy and then sqd deploy that

From indexer package.json run pnpm deploy-setup:prepare && sqd deploy -ru -m ./squid-ci.yaml . && pnpm deploy-setup:after where

"deploy-setup:after": "cd ../ && rimraf indexer-deploy",
"deploy-setup:prepare": "pnpm --filter=indexer deploy indexer-deploy && cd indexer-deploy",

This is including all the node_modules in indexer-deploy which is getting to around 58 MB.

I think this is likely the better option if I can get it working as pnpm deploy includes all the dependencies. The issue is that squid is then trying to reinstall dependencies (maybe ok?) and including the node_modules in the archive.

mo4islona commented 4 months ago

I think this is likely the better option if I can get it working as pnpm deploy includes all the dependencies.

Unfortunately the node modules installed locally can't be used because the container has different OS arch. So to make it works we have do it in the docker.

Also these used sub-packages within a monorepo will be copied as is with pnpm deploy, i.e. TS files not JS, if you use TS. So it must be build first

mlenser commented 4 months ago

What's the recommendation then? Neither method works - from the root is hanging again (may be due to the size?) and pnpm deploy before sqd deploy is failing due to the size of the archive.

mo4islona commented 4 months ago

Please take a look at https://github.com/mo4islona/squid-monorepo

I see 2 ways:

And easy - include full monorepo into Docker

sqd deploy -m packages/indexer/squid-full-repo.yaml .

With manifest https://github.com/mo4islona/squid-monorepo/blob/main/packages/indexer/squid-full-repo.yaml

Is not working for now but it could be fixed

More complicated

sqd deploy -m packages/indexer/squid.yaml .
  1. Deploy package first https://github.com/mo4islona/squid-monorepo/blob/main/package.json#L11
  2. Then we move deployed package to the root https://github.com/mo4islona/squid-monorepo/blob/main/package.json#L12
  3. Important line is also here — by default pnpm deploy will not copy indexer built files according to the .gitignore. To avoid rebuilding out_dir I just added them them explicitly
sqd deploy -m packages/indexer/squid.yaml .
.....
◷ Compressing the squid to pnpm-monorepo-v1.tar.gz ... 45 file(s) ✔️
🦑 Releasing the squid from local folder
◷ Uploading pnpm-monorepo-v1.tar.gz... ✔️
◷ Preparing the squid... ✔️
Downloading squid archive from ...
Extracting archive...
Extracted 46 files from archive, hash d2c9fee2f26139c4f675831b179ebac110dcae23
◷ You may now detach from the build process by pressing Ctrl + C. The Squid deployment will continue uninterrupted.
◷ The new squid will be available as soon as the deployment is complete.
◷ Building the squid... ✔️
◷ Pushing the image... ✔️
The squid is up and running. The GraphQL API will be shortly available at ...
Streaming logs from the squid... ⣟
init 2024-02-27T12:03:18.237Z INFO query: SELECT * FROM "information_schema"."tables" WHERE "table_schema" = 'public' AND "table_name" = 'migrations'
init 2024-02-27T12:03:18.246Z INFO query: SELECT * FROM "migrations" "migrations" ORDER BY "id" DESC
init 2024-02-27T12:03:18.248Z INFO No migrations are pending
init 2024-02-27T12:03:18.117Z WARNING sqd:typeorm-config ignoring DB_PASS, because DB_URL is set
init 2024-02-27T12:03:18.229Z INFO query: SELECT version();
init 2024-02-27T12:03:18.116Z WARNING sqd:typeorm-config ignoring DB_HOST, because DB_URL is set
init 2024-02-27T12:03:18.117Z WARNING sqd:typeorm-config ignoring DB_PORT, because DB_URL is set
init 2024-02-27T12:03:18.117Z WARNING sqd:typeorm-config ignoring DB_USER, because DB_URL is set
init 2024-02-27T12:03:18.117Z WARNING sqd:typeorm-config ignoring DB_NAME, because DB_URL is set
init 2024-02-27T12:03:18.118Z WARNING sqd:typeorm-config ignoring DB_SSL, because SSL settings where provided in DB_URL
│ processor {"level":"info","time":1709035569650,"ns":"sqd:processor","msg":"last processed final block was 14624839"}                                                                                        │
│ processor {"level":"info","time":1709035569650,"ns":"sqd:processor","msg":"processing blocks from 14624840"}                                                                                                │
│ processor {"level":"info","time":1709035570224,"ns":"sqd:processor","msg":"using archive data source"}                                                                                                      │
│ processor {"level":"info","time":1709035570435,"ns":"sqd:processor","msg":"prometheus metrics are served at port 3000"}                                                                                     │
│ processor {"level":"info","time":1709035572218,"ns":"sqd:processor:mapping","msg":"Burned 0 Gwei from 14624840 to 14664459"}                                                                                │
│ processor {"level":"info","time":1709035572268,"ns":"sqd:processor","msg":"14664459 / 19281507, rate: 21585 blocks/sec, mapping: 1752 blocks/sec, 1142 items/sec, eta: 4m"}
....

And please update cli first before try npm i -g @subsquid/cli@2.8.6 This release has a fix to not include any node_modules inside

mlenser commented 4 months ago

Deploy package first https://github.com/mo4islona/squid-monorepo/blob/main/package.json#L8

Line 8 seems to be missing image

should it be line 11?

mo4islona commented 4 months ago

Yes, sorry for confusing. I just added one more line after comment

mo4islona commented 4 months ago

Is not working for now but it could be fixed

I've found a way how run w/o any fix on backend/cli side

https://github.com/mo4islona/squid-monorepo/commit/b6e9d2592d98bff7fab016bc68e8794c93a50bf5

mlenser commented 4 months ago

I've been trying the basic version and everything seems to work except the migration/init of the db

When you say:

Is not working for now but it could be fixed

What doesn't work and how can it be fixed?

Logs I'm seeing:

Healthy deploy (old setup):

db 2024-02-26T21:35:46.158Z INFO CREATE DATABASE
db 2024-02-26T21:35:46.640Z INFO starting PostgreSQL 14.7 (Debian 14.7-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
db 2024-02-26T21:35:46.641Z INFO listening on IPv4 address "0.0.0.0", port 5432
db 2024-02-26T21:35:46.646Z INFO listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db 2024-02-26T21:35:46.654Z INFO database system was shut down at 2024-02-26 21:35:46 GMT
db 2024-02-26T21:35:46.742Z INFO database system is ready to accept connections
init 2024-02-26T21:36:25.425Z WARNING sqd:typeorm-config ignoring DB_HOST, because DB_URL is set
init 2024-02-26T21:36:25.426Z WARNING sqd:typeorm-config ignoring DB_PASS, because DB_URL is set
init 2024-02-26T21:36:25.426Z WARNING sqd:typeorm-config ignoring DB_PORT, because DB_URL is set
init 2024-02-26T21:36:25.426Z WARNING sqd:typeorm-config ignoring DB_NAME, because DB_URL is set
init 2024-02-26T21:36:25.426Z WARNING sqd:typeorm-config ignoring DB_USER, because DB_URL is set
init 2024-02-26T21:36:25.427Z WARNING sqd:typeorm-config ignoring DB_SSL, because SSL settings where provided in DB_URL
init 2024-02-26T21:36:27.228Z WARNING sqd:typeorm-config ignoring DB_HOST, because DB_URL is set
init 2024-02-26T21:36:27.229Z WARNING sqd:typeorm-config ignoring DB_USER, because DB_URL is set
init 2024-02-26T21:36:27.229Z WARNING sqd:typeorm-config ignoring DB_PORT, because DB_URL is set
init 2024-02-26T21:36:27.230Z WARNING sqd:typeorm-config ignoring DB_NAME, because DB_URL is set
init 2024-02-26T21:36:27.230Z WARNING sqd:typeorm-config ignoring DB_PASS, because DB_URL is set
init 2024-02-26T21:36:27.231Z WARNING sqd:typeorm-config ignoring DB_SSL, because SSL settings where provided in DB_URL
init 2024-02-26T21:36:25.592Z INFO query: SELECT * FROM "information_schema"."tables" WHERE "table_schema" = 'public' AND "table_name" = 'migrations'
init 2024-02-26T21:36:25.624Z INFO 0 migrations are already loaded in the database.
init 2024-02-26T21:36:25.695Z INFO query: CREATE TABLE "intent" ("id" character varying NOT NULL, "short_id" text NOT NULL, "chain_id" integer NOT NULL, "deadline" numeric NOT NULL, "start_time" numeric NOT NULL, "end_time" numeric NOT NULL, "start_rate" numeric NOT NULL, "end_rate" numeric NOT NULL, "min_amount" numeric NOT NULL, "max_amount" numeric NOT NULL, "collateral" jsonb NOT NULL, "debt" jsonb NOT NULL, "is_recall" boolean, "assortment_id" text NOT NULL, "signed_caveat_id" character varying, "recall_id" character varying, CONSTRAINT "REL_7f105e1132a99fcc4ef7e6e18b" UNIQUE ("signed_caveat_id"), CONSTRAINT "REL_3b295e0aefc64bb21c38b6bd2f" UNIQUE ("recall_id"), CONSTRAINT "PK_513a9beef6edc5701fbd955321d" PRIMARY KEY ("id"))
...
lots more db interactions

Unhealthy deploy (monorepo imports setup):

db 2024-02-27T14:54:38.088Z INFO CREATE DATABASE
db 2024-02-27T14:54:38.132Z INFO /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
db 2024-02-27T14:54:38.135Z INFO received fast shutdown request
db 2024-02-27T14:54:38.137Z INFO waiting for server to shut down....{"timestamp":"2024-02-27T14:54:38.137Z","level":"INFO","message":"aborting any active transactions"}
db 2024-02-27T14:54:38.140Z INFO background worker "logical replication launcher" (PID 56) exited with exit code 1
db 2024-02-27T14:54:38.232Z INFO shutting down
db 2024-02-27T14:54:36.288Z INFO     pg_ctl -D /data/pgdata -l logfile start
db 2024-02-27T14:54:36.933Z INFO waiting for server to start....{"timestamp":"2024-02-27T14:54:36.930Z","level":"INFO","message":"starting PostgreSQL 14.7 (Debian 14.7-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit"}
db 2024-02-27T14:54:36.947Z INFO database system was shut down at 2024-02-27 14:54:35 GMT
db 2024-02-27T14:54:38.336Z INFO database system is shut down
db 2024-02-27T14:54:38.441Z INFO  done
db 2024-02-27T14:54:38.442Z INFO server stopped
db 2024-02-27T14:54:38.442Z INFO PostgreSQL init process complete; ready for start up.
db 2024-02-27T14:54:38.745Z INFO starting PostgreSQL 14.7 (Debian 14.7-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
db 2024-02-27T14:54:38.745Z INFO listening on IPv4 address "0.0.0.0", port 5432
db 2024-02-27T14:54:38.754Z INFO listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db 2024-02-27T14:54:38.764Z INFO database system was shut down at 2024-02-27 14:54:38 GMT
db 2024-02-27T14:54:38.847Z INFO database system is ready to accept connections
mo4islona commented 4 months ago

What doesn't work and how can it be fixed?

Using cd command — cd some-path && .... But it can be used in package script, like in this comment https://github.com/mo4islona/squid-monorepo/commit/b6e9d2592d98bff7fab016bc68e8794c93a50bf5

mo4islona commented 4 months ago

Is it v1-indexer-ci-8067863032 squid?

dotenv -- turbo migration:apply --filter=indexer "apply" x Could not find the following tasks in project: apply

mlenser commented 4 months ago

Ya, that's us. I'll look into this and get back to you. Thanks for being so responsive.

mlenser commented 4 months ago

@mo4islona I've tried the "more complicated" version of what you're shared above and it appears to be having the same issue. It seems to not do the migration successfully.

The logs on https://app.subsquid.io/squids don't provide any data while it's in progress. Is there any way to see the issue as you saw it?

It could be a problem on our end, but it's hard to know what is going on.

mo4islona commented 4 months ago

I just tried one of your latest uploads. I see errors in CLI and UI

image image

If you manipulate directories using a second approach, you don't need to add cd services/indexer &&, because it will be a root after such a manipulation.

And as I said "cd ... &&" is not working atm.

mo4islona commented 4 months ago

After removing cd commands, it started, but

— final image is very big (>2GB), this is why you don't see any logs for a while. Probably could be reduced by cleaning up after build. — it is still not working, because you didn't build TS files from subpackages

image image
mlenser commented 4 months ago

it is still not working, because you didn't build TS files from subpackages

Yup, that's the next step. We're using internal-packages for turbo repo. We'll have to hack together some builds to make squid work. 😢

mlenser commented 4 months ago

We've got step one done: building from the root with all the setup above. Now I'm working on the building dependency packages. How were you able to see the above images about

— it is still not working, because you didn't build TS files from subpackages

mlenser commented 4 months ago

Nevermind - I'm seeing some errors in the logs

SyntaxError: Unexpected token 'export'
mlenser commented 4 months ago

Update: We got it working, mostly.

I'm finishing off some edge case stuff. Once it's in a solid state hopefully I can write our solution here for others.