R
Railway

✋|help

Fontconfig to canvas

Mmiikha8/25/2023
Hi, I've been using the node-canvas in default railway when I use that, only libuuid and libGL are installed, through libs like: fontconfig.
Do you have any option to install the fontconfig lib without create a custom Dockerfile? :cattroll:

Context: 4b5e343b-a630-49ff-8375-74a2e5bba62c
Mmiikha8/25/2023
4b5e343b-a630-49ff-8375-74a2e5bba62c
Bbrody1928/25/2023
give this nixpacks.toml file a shot
[phases.setup]
nixPkgs = ['...', 'fontconfig']
Mmiikha8/25/2023
Can I follow these configs in nixpacks.toml to do commands too?
Bbrody1928/25/2023
explain please
Mmiikha8/25/2023
like a RUN in docker compose
RUN yarn lint
for example
inside a .toml file
Do you have a link to toml config file documentation?
Mmiikha8/25/2023
oh great
let me see
[phases.build]
cmds = ['yarn run server:build']

this works
I think
Thanks! :LINKSBR_vamo:
Bbrody1928/25/2023
no problem
Mmiikha8/25/2023
Works, I installed the libs
but
in fontconfig specific
It return this error:

Fontconfig error: Cannot load default config file
Do you have any way to config the font path like a:
export FONTCONFIG_PATH=/etc/fonts
Bbrody1928/25/2023
install it as an apt package instead
Mmiikha8/25/2023
let me try it
Bbrody1928/25/2023
show me the nixpacks file before you push changes though
Mmiikha8/25/2023
of course
Mmiikha8/25/2023
[phases.setup]
aptPkgs = ["...",'fontconfig', 'freetype']


Let me show you the errors.
In upper have the fontconfig error, down bellow has a out of memory error
Bbrody1928/25/2023
what's the out of memory for?
you're on the hobby plan, that's 8gb of mem
Mmiikha8/25/2023
Yeah, lol! haha
My app uses less 1gb
I belive it's because the fontconfig
then canvas join in looping
Bbrody1928/25/2023
what kind of app is this
Mmiikha8/25/2023
Is a nestjs app
a api
to create and handle some images
using canvas
simple app
Bbrody1928/25/2023
show me the build table at the top of the build logs?
Mmiikha8/25/2023
oh sure:
Bbrody1928/25/2023
have you tried to set any variables related to font config yourself?
Mmiikha8/25/2023
like that, right?
Bbrody1928/25/2023
yeah, have you done that?
Mmiikha8/25/2023
I didn't try
let me set this
and try again
Bbrody1928/25/2023
you really shouldn't need to
I have a canvas project and all I needed to do was install fontconfig as an apt package and it worked
are you using node-canvas instead of canvas?
Mmiikha8/25/2023
in package.json
Mmiikha8/25/2023
is only canvas
https://github.com/Automattic/node-canvas
I followed
this steps
Bbrody1928/25/2023
that's the same canvas version I use, but I do not have the fontconfig npm package
Mmiikha8/25/2023
I'll remove that
because a have the apt fontconfig now
Bbrody1928/25/2023
a guess would be that the npm fontconfig is messing something up
Mmiikha8/25/2023
yeah
Bbrody1928/25/2023
https://github.com/brody192/node-canvas-fonts
I install the fontconfig from within the railway.json, but it makes no difference
Mmiikha8/25/2023
O sure
let me try
Bbrody1928/25/2023
try what
Mmiikha8/25/2023
uninstall the fontconfig from my npm
Bbrody1928/25/2023
ah okay
Mmiikha8/25/2023
and install with apt
Thanks again!
Mmiikha8/25/2023
Fontconfig works now. But the out of memory error still happens. It's crazy because the server memory is bellow than 150mb

Is it possible that Node.js has a memory limit inside the container?
Bbrody1928/25/2023
maybe the heap limit or something
Mmiikha8/25/2023
yes, in my local machine run the same build works using 500mb in the max
That happens when start a new promise inside canvas, I'll search in canvas issues. Thanks Brody, you helped a lot with fontconfig! :OK:
Bbrody1928/25/2023
try setting a service variable NODE_OPTIONS = --max-old-space-size=4096
Mmiikha8/25/2023
the error still happen :I69_cat_Cry:
Bbrody1928/25/2023
what version of node do you use locally
Mmiikha8/25/2023
16.16.0
in Win
Bbrody1928/25/2023
railway uses node 16 something by default too
so we are back to code issue 🙂
Mmiikha8/25/2023
yeah, I'll check in canvas issues
with nest idk...
thanks

Looking for more? Join the community!

Recommended Posts
volumehey guys! quick question, I've got a golang project. I need it to create a json file on railway and system ran out of memoryCan someone help me? When I try to run my react app i get this error message. > tuya_react_frontend@Litestar command not foundHey all apologies for the possibly silly question. I am looking to deploy this repo: https://github.save temporary archivesCan i save temporary pdfs to a back-end host ? I'm trying to save a pdf file from a client upload bHow to host websockets?This is my first time hosting socket server, how can i do that on railway? I docs there are only webI cannot use opencv2 and received ImportError: libgl.so.1 cannot open shared object file no such filCan anyone help me with that ??LibreofficeHi I need libreoffice installed to use in my code. I attempted using the below nixpacks.toml ``` [Random app crash, no logs or other indicatorWhen trying my healtcheck I get random crashes, no recent deploy was made, I don't see any logs on mModify build commandHow would I modify the build command so it does a pip install of `psycopg2` ? I was told to remove tPayment method removalHey, how do I remove my payment method? I opted in for a credit subscriptions but still see my crediDeploying crashedHello, i'm facing a problem when deploying my spring boot application to railway, my application worInternal server error when accessing TypebotI noticed that since yesterday the new installations with the Typebot template present the error IntRAILWAY_PUBLIC_DOMAIN replaces RAILWAY_STATIC_URLHi team, we've been hunting down a bug with our app today, occurring on many PR Environments and it'My Subscription issueHello dear support guys: I found that I have been downgraded to No Subscription.. If my memory is rIs it normal for hello world json to return in 600ms? - GO FIBERHelp setting up a monorepoI'm getting this error when deploying my project. I made sure no other deployments are running, but Deployment and logging issues (Maven)Hello, My program is running fine locally, but when I deploy it with Railway, I start seeing issuesIssues with Postgres DBI don't really understand why I am not seeing any tables in my DB. Seeding works, but the database sversion 'GLIBC 2.29' not foundweird error that seems to be because of my code, but it works on my computer <:bing_shrug:5837915814Use rust nightlyidk how docker works but i cant use the nightly rust dockerfile image for some reason