Test Node.js Application without redeploying

Hello guys!

I added new features to my app and I want to test them before I deploy them.
Is this possible via fly.io?

Thanks!

Hi!

You can create a second app for a staging environment, and deploy to that! The fly ... commands usually take a flag to let you specify a specific fly.toml file, which in turn can help you point to a different app - e.g. fly deploy -c fly-staging.toml.

Another tactic: Since Fly deploys are based on a Dockerfile you can build your Docker image locally (if you have docker locally) and run it. (docker build...., docker run --rm -it ...)

Hi @fideloper-fly!

Thanks for your quick answer.

I like the second tactic with the docker file.

Could you please explain how I can build a docker file locally?

Thanks in advance.

Greetings from
@TheDev

Sure, shouldn’t be anything too tricky but I have to guess on a few things.

Build It:

cd ~/path/to/codebase

docker build -t mycoolimage:latest .

Run It:

docker run --rm -it -p 8080:8080 mycoolimage:latest

# Then head to http://localhost:8080 in your browser

I’m assuming port 8080 is listening for connections in the container. In other words, whatever is running in the container - your app - is setup to listen for HTTP connections on port 8080 - it might not be!

If you want to share your Dockerfile and fly.toml (redact anything sensitive) - that will help.

I think in my case it isn’t possible - but thanks anyway!