fly.io Dockerize style deployment - vite-ruby
Earlier I tried to deploy my car-maintenance app with Fly.io without success.
At first I try to not to have redis as I think that might allow me zero cost deployment. But actually with lowest spec of Redis I can achieve zero cost too.
Then I got an error when deploying my app. It tries to connect to a localhost redis
I have to create and attach a Redis server. Fly cli has the command to create Redis via Upstash and I did it.
`fly redis create`
fly redis list
fly redis status <redis-instance-name>
Then I need to put the redis url into the docker as an argument like below
This will properly set the environment environment.
After this fly deploy command successfully executed.
After visited the url provided by fly cli earlier, it has an error regarding vite_typescript_tag
I was clueless earlier and try to follow leads / hint it was showing but its too ambiguous. something about manifest.json and website.ts which really leads to nothing.
With searching for production context, I read on Vite website and found a command to compile the assets.
It is vite build
After I try out this command, I knew that I need to put this command into the Dockerfile. It produce the compiled asset into app public folder.
I put the command somewhere before yarn install and it throws an error.
After few attempts, fly deploy returns a success.
I put the vite build command below bootsnap precompile
I'm able to open the app I am deploying.
Comments
Post a Comment