#Install a specific Backstage version

42 messages · Page 1 of 1 (latest)

weary urchin
#

Hi All,

With the new backstage version 1.23.0 and multu-docker build, it fails with this error (even with the new backstage installation and the Dockerfile here: https://backstage.io/docs/deployment/docker#multi-stage-build, it would still fail.

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked apt-get update && apt-get install -y --no-install-recommends python3 g++ build-essential curl && yarn config set python /usr/bin/python3:

And I already have a working backstage version of 1.21.0. With the npx @backstage/create-app@latest, is it possible to set the Backstage version of our choice?

Thank You!

humble zealot
#

I think you'll need to pick the create-app version that matches your intended backstage version

simple stag
#

Hi @weary urchin, could you provide more details on your goal? Are you just trying to upgrade? Also, you did not share any errors so it's hard to help with out those details

weary urchin
#

Hi @simple stag , the issue with with the multi-stage build. It gives me an error (even for the new backstage app created anew) as below:

#16 [build 7/9] RUN yarn tsc
#16 sha256:64f9bac786e9600530717ag54fc425c76250474b64ffshwa860e9af45c9e294e4
#16 0.658 yarn run v1.22.19
#16 0.684 warning Skipping preferred cache folder "/home/node/.cache/yarn" because it is not writable.
#16 0.685 warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-1000".
#16 0.697 $ tsc
#16 0.914 error TS18003: No inputs were found in config file '/app/tsconfig.json'. Specified 'include' paths were '["packages/*/src","plugins/*/src","plugins/*/dev","plugins/*/migrations"]' and 'exclude' paths were '["node_modules"]'.
#16 0.914 
#16 0.915 
#16 0.915 Found 1 error.
#16 0.915 
#16 0.932 error Command failed with exit code 2.
#16 0.932 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#16 ERROR: executor failed running [/bin/sh -c yarn tsc]: exit code: 2
------
 > [build 7/9] RUN yarn tsc:
------

The reason I wanted to use a specific backstage version is because I have a working setup with 1.21.0. Even with a fresh backstage latest setup, the Dockerfile provided at https://backstage.io/docs/deployment/docker#multi-stage-build, doesn't work for some reason. It gives the. I think the Documentation is not updated.

[stage-2 2/7] RUN --mount=type=cache,target=/var/cache/apt,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked apt-get update && apt-get install -y --no-install-recommends python3 g++ build-essential curl && yarn config set python /usr/bin/python3:

Could you help me with the first issue? I am happy with the version 1.21.0 since the second issue is something else.

simple stag
#

OK, I'll try and find some time to investigate but the error your are running into is from running the TypeScript compile and that won't have anything to do with the Dockerfile IMO. We use more or less the same Dockerfile for the demo site (https://github.com/backstage/demo/blob/master/Dockerfile) and it's upgraded without issues. What version of TypeScript are you using?

weary urchin
#

I am using the node:18-bullseye-slim image in the Dockerfile, where in the https://backstage.io/docs/deployment/docker#multi-stage-build, it is using the ode:18-bookworm-slim, which gives the second error mentioned above. And this Dockerfile has the typescript bundled by default. Not sure about the version there though.

But this is what my /app/tsconfig.json looks like:

{
  "extends": "@backstage/cli/config/tsconfig.json",
  "include": [
    "packages/*/src",
    "plugins/*/src",
    "plugins/*/dev",
    "plugins/*/migrations"
  ],
  "compilerOptions": {
    "outDir": "dist-types",
    "rootDir": "."
  },
  "noImplicitAny": false
}

i will try the Dockerfile you have given in the master branch. Could you confirm if this works with the latest backstage version (you don't need to test, let me know if this is something you alreadt know ❤️ )?

simple stag
#

Yes, the Demo site is up to date with the weekly releases.

#

I would note that you might not be keeping up to date with the various releases which me part of the. We moved to bookworm back as part of 1.19.0. Then TypeScript went to 5.0 in 1.18.0.

#

Running yarn why typescript would tell you what version you are using.

#

TypeScript is a package and is not part of the docker images, it gets installed when you run yarn install

#

Also, having this file - /app/tsconfig.json - is something custom that you must have added as it does not ship with create-app.

weary urchin
#

Hi @simple stag , I have Found "[email protected]" version.

I tried the Dockerfile you pointed and having the same issue.

#12 CANCELED

[stage-2 2/12] RUN --mount=type=cache,target=/var/cache/apt,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked apt-get update && apt-get install -y --no-install-recommends libsqlite3-dev g++ build-essential python3 python3-pip python3-venv curl default-jre graphviz fonts-dejavu fontconfig && rm -rf /var/lib/apt/lists/* && yarn config set python /usr/bin/python3:


weary urchin
simple stag
#

Just wroth mentioning the above doesn't tell me anything, please share the error

#

Why have you added this file? /app/tsconfig.json?

simple stag
#

OK, that's not helpul either, not your fault.

weary urchin
simple stag
simple stag
#

Please remove it and see if that helps

weary urchin
#

@simple stag , this is very strange, check the terminal output when creating a new app. That tsconfig.json is auto genarated.

simple stag
#

Yes, that's in the root not in /packages/app right?

weary urchin
#

yes true,

simple stag
#

I think it's confusing as you haven't been clear what you are referring to so when you say app your mean in the Dockerfile. That makes more sense but doesn't not explain why you are having the error. Is strongly feel that some customization you have made is the problem but I don't know what that is 🤔

#

I would run the docker build with --progress=plain as that might give us more details on the error

weary urchin
#

My backstage app name is app probbaly that's why it was confusing for you. The Screenshot I sent above, I changed the app name to backstage so you wouldn't be confused. I will try with the --progress=plain.

simple stag
#

Also, you should not need to run create app more than once, you want to use yarn backstage-cli versions:bump to upgrade

weary urchin
#

Did version upgradd too, but still having the same issue.

I am not sure what is causing this issue. even with a new setup it doesn't work.

weary urchin
#

Okay I was able to fix this by modifying my .dockerignore with the following content

dist-types
node_modules
packages/*/dist
packages/*/node_modules
plugins/*/dist
plugins/*/node_modules
simple stag
#

Cool, but isn't that what's exactly in the documentation already? This just got missed?

weary urchin
#

There are few differences between the file in the doc and what i am using

simple stag
#

Can you share what the final file looks like, please?

weary urchin
#

@simple stag , here as above I put earlier:

Final .dockerignore looks like below.

dist-types
node_modules
packages/*/dist
packages/*/node_modules
plugins/*/dist
plugins/*/node_modules
simple stag
#

Ok, so that’s the same as the docs. Just wanted to be sure. If they were truly wrong then I’d would make the effort to update them 👍🏻

weary urchin
#

yes but in my file, I have specified the paths instead of specifying the whole directories

simple stag
#

Ok, what you shared above is exactly the same as the docs. I asked for your exact final file and that’s what you posted. I’d like to fix the docs if they are wrong but I can’t do that without your help. ☹️

weary urchin
#

Sorry I misunderstood your question, yes it is the same. And one suggestion would be to create this dockerfile with the correct content in the first place?

simple stag
#

Ok, no worries, it happens.

#

We don’t ship the multi-stage Dockerfile with create-app as it’s much slower and for most people it doesn’t really have much benefit.

weary urchin
#

Apologies what I meant was ship the .dockerignore with right content

simple stag
#

Guess what I’m trying to say is the docerignore that ships with create-app is for the host build docker file that also ships with create-app. The multi-stage is the one you need to do by hand and we include instructions about this file there as well