Debugging

How to debug your application with Qovery

Your application is running, but something goes wrong? In this guide, you'll learn how to debug your application and solve your problem to make it running smoothly.

Debugging an application build

You have deployed your application with Qovery, and the status of your application is build error. Meaning, your application has failed to build correctly. There are two commands for getting a closer look at what's going on.

Qovery status

The command qovery status give the status of our application. In the case of a build error, the reason is displayed into the console as well

$ qovery status
Build error output
BRANCH NAME | STATUS | ENDPOINTS | APPLICATIONS | DATABASES
master | build error | https://main-yenr7erjbs87dk4m-gtw.qovery.io | simple-example-node-with-postgresql | my-postgresql-3498225
APPLICATION NAME | STATUS | DATABASES
simple-example-node-with-postgresql | build error | my-postgresql-3498225
DATABASE NAME | STATUS | TYPE | VERSION | ENDPOINT | PORT | USERNAME | PASSWORD | APPLICATIONS
my-postgresql-3498225 | running | POSTGRESQL | 11.5 | <hidden> | <hidden> | <hidden> | <hidden> | simple-example-node-with-postgresql
Something goes wrong:
---------- Start of error message ----------
Sending build context to Docker daemon 244.7kB
Step 1/8 : FROM node:13-alpine
---> bcfeabd22749
Step 2/8 : RUN mkdir -p /usr/src/app
---> Using cache
---> 104f4613b141
Step 3/8 : RUN toto
---> Running in 52fa3e66f0c4
/bin/sh: toto: not found
The command '/bin/sh -c toto' returned a non-zero code: 127
----------- End of error message -----------
HINT: Ensure your Dockerfile is correct. Run and test your container locally with 'qovery run'

Here we can see that the build error comes from our Dockerfile. We also have a hint affirming this problem.

Qovery run

The command qovery run is a wrapper around the commands docker build and docker run. It's the best way to test your container locally. Our motto is, if your application is running locally with qovery run then it will work on Qovery. In the case of a bad Dockerfile, by running qovery run we directly see the error

$ qovery run
Build error output
2020/04/22 10:12:37 reload master environment: DONE
Step 1/8 : FROM node:13-alpine
---> e1495e4ac50d
Step 2/8 : RUN mkdir -p /usr/src/app
---> Using cache
---> 3afe9d6678e0
Step 3/8 : RUN toto
---> Running in fadf25b6fc5e
/bin/sh: toto: not found

Debugging a running application

Your application is running, but for some reason, it is not working as expected. Here are a few tips to find out what's going on.

Qovery status

First, check that all your applications and services are up and running correctly with qovery status

$ qovery status
Check application status
BRANCH NAME | STATUS | ENDPOINTS | APPLICATIONS | DATABASES
master | running | https://main-yenr7erjbs87dk4m-gtw.qovery.io | simple-example-node-with-postgresql | my-postgresql-3498225
APPLICATION NAME | STATUS | DATABASES
simple-example-node-with-postgresql | running | my-postgresql-3498225
DATABASE NAME | STATUS | TYPE | VERSION | ENDPOINT | PORT | USERNAME | PASSWORD | APPLICATIONS
my-postgresql-3498225 | running | POSTGRESQL | 11.5 | <hidden> | <hidden> | <hidden> | <hidden> | simple-example-node-with-postgresql

Everything is fine here, meaning the problem is on our side as developer.

Qovery log

Your application is running, and logs are debug/info/warning/error messages can be thrown upon the standard output. To show them it's as easy as typing one command

$ qovery log
Log output
GET / 200 7.707 ms - 170
GET / 200 5.572 ms - 170
GET / 200 5.296 ms - 170
GET /stylesheets/style.css 200 2.812 ms - 117
GET /favicon.ico 404 8.127 ms - 913
GET /stylesheets/style.css 304 0.861 ms - -
GET / 304 5.100 ms - -
GET /stylesheets/style.css 304 0.361 ms - -
GET / 200 5.055 ms - 170

Pro tip: you can even follow the output with the -f option

$ qovery log -f

Rollback

You need more time to fix a bug? No worries, you can rollback at any time by using qovery deploy <commit id>

$ qovery deploy list
Last deployed commits
BRANCH | COMMIT DATE | COMMIT ID | COMMIT AUTHOR | DEPLOYED
master | 2020-04-22 10:34:11 +0200 +0200 | c4f5ab0396ab025a115f96c50c71e63ccf0aceae | Romaric Philogene |
master | 2020-04-22 09:55:25 +0200 +0200 | bafbc5501f016b6c906f373022ed3a40f4ecdf4b | Romaric Philogene |
master | 2020-04-22 09:39:42 +0200 +0200 | 5fe83fed61b7c6933c015d73e2588d20ba9856d1 | Romaric Philogene |
master | 2020-04-21 21:10:03 +0200 +0200 | f4b9bd4c8cc043e6a65e6a84db825d5897cbc30d | Romaric Philogene |
master | 2020-04-21 20:59:24 +0200 +0200 | 8cf3e8aec44b2468e59eca59defe164eea10c63f | Romaric Philogene |
master | 2020-04-20 22:20:04 +0200 +0200 | 5f9fd42f979f89bc20349cb89978bda139c3eca1 | Romaric Philogene |
master | 2020-04-10 20:12:22 +0200 +0200 | efbbeecaacdb5acc5f3175bd83fa39536f0ed395 | Romaric Philogene |
master | 2020-04-10 15:44:05 +0200 +0200 | ccfa5fad64dbb85d279c07f256101fd234e6624a | Romaric Philogene |
master | 2020-04-10 15:26:57 +0200 +0200 | 27df877c83ca979f026f6eb4fbba73692293da87 | Romaric Philogene |
master | 2020-04-08 20:03:29 +0200 +0200 | fa8aa4f12e80ae64b3ef8d217df1ecaccc576708 | Romaric Philogene |

To rollback on the commit 8cf3e8aec44b2468e59eca59defe164eea10c63f it's as easy as executing the command

$ qovery deploy 8cf3e8aec44b2468e59eca59defe164eea10c63f
Rollback output
deployment in progress...
Hint: type "qovery status --watch" to track the progression of this deployment

Then, we can watch the progress of the rollback with

$ qovery status --watch
Deployment progression
100% |████████████████████████████████████████| [0s:0s]
Your environment is ready!
-- status output --
BRANCH NAME | STATUS | ENDPOINTS | APPLICATIONS | DATABASES
master | running | https://main-yenr7erjbs87dk4m-gtw.qovery.io | simple-example-node-with-postgresql | my-postgresql-3498225
APPLICATION NAME | STATUS | DATABASES
simple-example-node-with-postgresql | running | my-postgresql-3498225
DATABASE NAME | STATUS | TYPE | VERSION | ENDPOINT | PORT | USERNAME | PASSWORD | APPLICATIONS
my-postgresql-3498225 | running | POSTGRESQL | 11.5 | <hidden> | <hidden> | <hidden> | <hidden> | simple-example-node-with-postgresql

Well done! You have rollback to a previous working version.

Monitoring and alerting

Qovery will provide very soon monitoring and alerting. In the meantime, we highly recommend using tools like Datadog.

Third-party integration

Qovery integrates third-party services like Datadog, NewRelic, and others. You can use any third service that you want if they support containers (which is the case of most of them).

Do you need any help? Reach us on Discord