Remotely Accessing your Containers
Updating information held on container volumes, debugging a running instance, backing up files locally, or just making sure everything is where you expect it to be… remote access is an integral part of any system.
In this article, we’re going to take a look at:
- Using the two-way console to debug a running instance.
- Extending your local machine into your private environment through a VPN connection to be able to interact with databases and API’s.
- Remotely accessing container volumes through SFTP, for file management.
Debugging and the console
There are two consoles available to Cycle developers.
Both are available by navigating to the following path from the environment dashboard.
Containers > "Container Name" > Instances > Select Instance
The Instance Console shows the console output for your container’s PID1 / init process. This is a great place to start your debugging or more generally see what your container is up to.
Additionally, Cycle offers a Two-Way Console. This console allows you to create an emulated ssh connection between your terminal and the running instance.
Head back over to the dashboard of the instance you wish to access and click “Request Access”.
After requesting access, you’re given credentials to ssh into your container. These credentials are valid to log in for up to 30 minutes and then need to be regenerated by using the “regenerate” button at the bottom.
This console gives you full access to your container’s filesystem and you can make changes as you wish. That being said any changes not stored directly into the volume path will not persist across restarts.
Let’s take a look at some common commands you can use to diagnose what’s going on inside your container.
Being able to quickly access your containers and get a specific look at processes is incredibly powerful.
Extending your local machine into your private container environment through VPN
When you create your environment, Cycle automatically establishes a private network for your containers. That means that all of your containers can talk to each other on the same network regardless of the infrastructure they are deployed to, and you have total control over which containers to expose to the public internet. We wanted to make it easy to extend your local machine into that private network through a VPN. Setting this up is a snap.
- Head to the environment dashboard and navigate to
VPNusing the top nav
- Enable VPN access
- Download the VPN files by clicking the
Download VPN filesbutton in the top right ( it may take a moment for them to be available after enabling )
- Once you have the VPN files extract them and find config.conf
- Use this file to create a new connection on your client
To avoid setting up users and passwords for the new connection, select
Allow Cycle Logins from the
Access Control settings and then save with
Update VPN Access. This allows you to use your Cycle email and password as a user for the VPN connection we just set up.
Once you connect to the VPN you can make sure you have extended into the private network by pinging a container that doesn’t have public network enabled.
If I wanted to see if a running container was producing a result when sent a query, I could now ask that container questions on the private network.
For example, if I had an API that was only used by other containers, I could send requests to it to make sure I was getting the desired result.
If you have a database container and want to remotely connect using a tool like Sequel Pro or another database management application, you can log in using the container hostname as the hostname ( alongside whatever username and password credentials you set up ). That way, you never have to put a public IP on your DB.
File Management with SFTP
If you have a group of files you need to add to your container volume, want to back up your current directories, or need to add a file or two —S FTP can be an excellent choice for file management.
In the past, it may have been a pain to set up a remote connection to a container volume, but on Cycle its just a few easy steps.
First, let’s make sure that we have remote access enabled on our container.
- Navigate to your environment dashboard
Volumeslocated on the top nav
- Enable remote access
- Check the
Enablebox, choose your algorithm and password
- Make sure to
If you’re unfamiliar with Cycle password algorithms, check out this guide to get more info on how to use the Algorithm and Password fields.
Now that remote access is enabled, it’s easy to access the volume via SFTP.
Instancesfrom the top navigation
- Select the instance which holds the volume you wish to access
This takes you to the instance dashboard. Scroll to the bottom, and you should see a button that says
This will pop up a modal with your SFTP login credentials. Use these credentials to log into your SFTP client.
If you have your SFTP client properly configured, another option is to press the
OPEN IN SFTP APPLICATION button. This will open a connection automatically in your default FTP client and connect to the volume.
Not all FTP clients are created equal. Some clients will require you to press the button a second time to initiate a connection. I use the free version of Cyberduck and from time to time I push the button twice.
Now that we have connected via SFTP, you can see all the files and folders in your volume. Transfer over any files you want to add, remove files you no longer need, or create a copy of your files for backup and then close the connection. There is no need to restart the container.
You’ve now seen 3 different ways to access and communicate with your containers remotely. There are lots of times that being able to quickly update, manage, or interact with live instances is vital to making sure your applications are fully tested and working as you expect.
The better you get at using these techniques, the faster you will be able to work with your operations team and get your services up and running.
Still Have Questions?
If you want to dive in and learn more, head over to our slack channel. Our community is growing, and our team hangs out there daily. Feel free to shoot us a message any time with your questions and we’ll be sure to respond!
Of course, for a more in-depth look at how to use Cycle, check out our documentation.