Observability
Up until now, you have used Architect to develop and deploy your application. However, Architect’s role in your development process does not end there. You still need to monitor the system and be able to dive in when a problem occurs. To help facilitate this, Architect provides some helpful commands that will allow you better insights into how your system is doing.
Whether it be a remote deployment using architect deploy
or a local one using
architect dev
these commands will give you a deeper insight into your product.
We will assume that you have deployed the example react app to a remote environment for the following examples.
Remote vs local
The following commands will work on both a remote deployment and a local
deployment. The main difference is that a remote deployment is tied to an
account where as a local deployment is not. So if you would like to access a
remote deployment you would include the --account
flag. If you do not include
the --account
flag, the Architect CLI will prompt you with a list of both
local and remote options.
Don’t worry, if you are unsure about what account, environment or service you are trying to work with, then just leave them out of the command. The Architect CLI will present you with a list of options and help you find what you are looking for.
Logging
As your application runs, it will generally print important information to
stdout and stderr. The logs
command will allow you to stream those logs from a
remote service to your console. For instance, let’s say you wanted to see the
latest logs for the API of the example react app. You would do the following.
The output would be
To have a constant stream of logs, you can add the --follow
flag to the
command.
For more options please take a look at our Readme.
Remote execution
Sometimes logs do not paint the complete picture of what is happening in
production, or you may want to run some unique script on a remote deployment.
Either way, Architect has you covered with our exec
command. Using this
command, we can run arbitrary commands on any remote service. By providing the
command with the name of a service, a container running that service is picked,
and the container will execute your designated command. So, for instance, if you
were running the react example app and wanted to know what the remote file
structure looked like, you could run.
Which would output
While this is great for quick one-off commands, sometimes a more interactive
approach would be preferred. Instead, you can create an interactive session with
the remote container using the -ti
flags.
Depending on the base image your service is using, sh might not be a valid command. If not, the other most common terminal is /bin/bash.
For more options please take a look at our Readme.
Port forwarding
To access services running inside the cluster without exposing them publicly, you can use the port-forward command. This will allow you to access these services on your local machine and is useful for debugging non-HTTP services.
Which would expose the react api’s port 8080 on your own localhost at http://localhost:5000.
For more options please take a look at our Readme.