[Rails] Can't deploy an app following the Getting Started guide

Loaded my dev environment on WSL Ubuntu of my PC, created a fresh rails app and there it failed too:

➜  list git:(main) ✗ fly deploy
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-dry-wave-1528 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
Sending build context to Docker daemon  18.69kB
[+] Building 815.7s (1/1) FINISHED
 => ERROR [internal] load remote build context                                                               815.7s
------
 > [internal] load remote build context:
------
Error failed to fetch an image or build from source: error building: error during connect: Post "http://[fdaa:0:bea9:a7b:99:8229:3604:2]:2375/v1.41/build?buildargs=null&buildid=upload-request%3A1dc10d577b07b2e0fbe62a0b67ae71263b1c569ab62f280890d79bd002f14586&cachefrom=null&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=&labels=null&memory=0&memswap=0&networkmode=&rm=0&shmsize=0&target=&ulimits=null&version=2": EOF

Rails 7.0.4.1
Ruby 3.1.2

Let’s approach this methodically. First let’s start clean. Go to Sign In · Fly and delete everything - your app, database, and redis.

In WSL2, make sure you have docker installed, create an empty directory and open a terminal window with that directory as the current directory.

Copy/paste the following script into that window: dockerfile-rails/DEMO.md at main · rubys/dockerfile-rails · GitHub

This will run a Rails, Postgres, Redis application inside a docker container on your machine.

Once that is working, type fly launch. Say no to replacing your Dockerfile. Say no to replacing .dockerignore. Say yes to creating Postgres. Say yes to creating Redis.

Now try fly deploy.

Once that’s working you can repeat the process with your application. Feel free go into the dashboard and delete the demo application if you would like to remain under the free tier allowances.

The process for getting an existing application up and running locally under docker is as follows:

bundle add dockerfile-rails --group development
bin/rails generate dockerfile --compose
docker buildx build . -t rails-welcome
docker run -p 3000:3000 -e RAILS_MASTER_KEY=$(cat config/master.key) rails-welcome

Feel free to replace rails-welcome with the name of your application.

Again, once it it working locally, try fly launch and fly deploy. This week I’ll be working on updating flyctl so that it doesn’t prompt to replace your Dockerfile and .dockeringore files, and will even install the dockerfile-rails gem for you.

is there a way how to find a fix without going through Docker? I’m having issues installing that too :sweat_smile:

Managed to install Docker. Followed the steps you described (after running the script I left the docker image running while launching fly from a different terminal on the same directory). I ended up getting this error which I’ll be looking up next how to solve:

ERRO[0014] Tar: Can't stat file /home/naokimi/code/Naokimi/empty/welcome to tar: open /home/naokimi/code/Naokimi/empty/welcome/tmp/db: permission denied

Just a thought: could the issue be that on both computers I have installed Ruby through rbenv? More precisely following this guide: GitHub - lewagon/setup: Setup instructions for Le Wagon's students on their first day of Web Development Bootcamp