Testing nixpacks and having a problem with mysql2

I have a project that's building fine with Heroku Buildpacks, I tried turning on nixpacks and it's having an issue with mysql2.
#16 33.64 To see why this extension failed to compile, please check the mkmf.log which can
#16 33.64 be found here:
#16 33.64
#16 33.64 /usr/local/rvm/gems/ruby-3.0.0/extensions/x86_64-linux/3.0.0/mysql2-0.5.4/mkmf.log
#16 33.64
#16 33.64 extconf failed, exit code 1
#16 33.64
#16 33.64 Gem files will remain installed in
#16 33.64 /usr/local/rvm/gems/ruby-3.0.0/gems/mysql2-0.5.4 for inspection.
#16 33.64 Results logged to
#16 33.64 /usr/local/rvm/gems/ruby-3.0.0/extensions/x86_64-linux/3.0.0/mysql2-0.5.4/gem_make.out
#16 33.64
#16 33.64 An error occurred while installing mysql2 (0.5.4), and Bundler cannot continue.
#16 33.64 Make sure that `gem install mysql2 -v '0.5.4'` succeeds before bundling.
#16 33.64
#16 33.64 In Gemfile:
#16 33.64 mysql2

#16 ERROR: executor failed running [/bin/bash -ol pipefail -c bundle install]: exit code: 5
-----
> [stage-0 12/16] RUN --mount=type=cache,id=s/272cd456-7038-4e9e-9ed2-28a995039a06-/root/bundle/cache,target=/root/.bundle/cache bundle install:
-----
executor failed running [/bin/bash -ol pipefail -c bundle install]: exit code: 5

Error: Docker build failed
#16 33.64 To see why this extension failed to compile, please check the mkmf.log which can
#16 33.64 be found here:
#16 33.64
#16 33.64 /usr/local/rvm/gems/ruby-3.0.0/extensions/x86_64-linux/3.0.0/mysql2-0.5.4/mkmf.log
#16 33.64
#16 33.64 extconf failed, exit code 1
#16 33.64
#16 33.64 Gem files will remain installed in
#16 33.64 /usr/local/rvm/gems/ruby-3.0.0/gems/mysql2-0.5.4 for inspection.
#16 33.64 Results logged to
#16 33.64 /usr/local/rvm/gems/ruby-3.0.0/extensions/x86_64-linux/3.0.0/mysql2-0.5.4/gem_make.out
#16 33.64
#16 33.64 An error occurred while installing mysql2 (0.5.4), and Bundler cannot continue.
#16 33.64 Make sure that `gem install mysql2 -v '0.5.4'` succeeds before bundling.
#16 33.64
#16 33.64 In Gemfile:
#16 33.64 mysql2

#16 ERROR: executor failed running [/bin/bash -ol pipefail -c bundle install]: exit code: 5
-----
> [stage-0 12/16] RUN --mount=type=cache,id=s/272cd456-7038-4e9e-9ed2-28a995039a06-/root/bundle/cache,target=/root/.bundle/cache bundle install:
-----
executor failed running [/bin/bash -ol pipefail -c bundle install]: exit code: 5

Error: Docker build failed
14 Replies
JustJake
JustJake2y ago
That looks like an issue with your ruby stuff? #16 33.64 An error occurred while installing mysql2 (0.5.4), and Bundler cannot continue. #16 33.64 Make sure that gem install mysql2 -v '0.5.4' succeeds before bundling. It's as if your lockfile or w/e doesn't specify/fetch the correct version
macwilko
macwilko2y ago
mysql2 0.5.4 is specified in the Gemfile.lock
Results logged to
#16 33.64 /usr/local/rvm/gems/ruby-3.0.0/extensions/x86_64-linux/3.0.0/mysql2-0.5.4/gem_make.out
Results logged to
#16 33.64 /usr/local/rvm/gems/ruby-3.0.0/extensions/x86_64-linux/3.0.0/mysql2-0.5.4/gem_make.out
apparently I can see the full error here why it failed to build
JustJake
JustJake2y ago
Try adding the environment variable NIXPACKS_APT_PKGS=“libmysqlclient-dev” Sounds like we need to be detecting if the application uses MySQL and getting the apt package required
macwilko
macwilko2y ago
🚀
JustJake
JustJake2y ago
Worked?
macwilko
macwilko2y ago
#9 4.362 E: Package 'libmysqlclient-dev' has no installation candidate googling xD
JustJake
JustJake2y ago
Hmm default-libmysqlclient-dev ?
macwilko
macwilko2y ago
yesss 🙂 just trying that in the nixpack docs:
macwilko
macwilko2y ago
Ruby | Nixpacks
App source + Nix packages + Docker = Image
macwilko
macwilko2y ago
Ruby | Nixpacks
App source + Nix packages + Docker = Image
macwilko
macwilko2y ago
it runs a build command, is it possible to change that? NIXPACKS_BUILD_CMD right NIXPACKS_START_CMD gonna try these Ok thing is building now, some strange SSL issue though
Failed to validate the schema cache because of ActiveRecord::ConnectionNotEstablished: unknown error: Code: UNAVAILABLE
server does not allow insecure connections, client must use SSL/TLS
Failed to validate the schema cache because of ActiveRecord::ConnectionNotEstablished: unknown error: Code: UNAVAILABLE
server does not allow insecure connections, client must use SSL/TLS
think i fixed that... woop nearly there think that's all working 🔥 thanks cooper now to get back to Anilifts and 👨‍💻 if only I could get vercel to deploy a react app in a reasonable time now...
JustJake
JustJake2y ago
Hey Mac. I wanna add this so that it works right off the bad for Nixpacks. What did you end up having to add?
macwilko
macwilko2y ago
Yes sure! I’ll check for you in the morning!