Help Center

How do I deploy an application on a Stack?

The newly installed Stack runs a sample application. Deploying yours is a matter of replacing the contents of a directory and rebuilding.

The only directory that belongs to you

Your code goes in the app/ folder inside the Stack:

text
/root/stack/<language>/<stack>/app/

For example, /root/stack/python/flask-mysql/app/.

You have three ways to get your code there. Choose one: Git if your project is in a repository, SFTP if you prefer dragging files from your computer, or the web file manager if you don’t want to install anything.

Option 1: from Git

This is the recommended option: it leaves the server in a reproducible state, and updating is a single command.

Connect via SSH and enter the Stack directory:

bash
cd /root/stack/python/flask-mysql

The app/ directory already contains the sample application, so it isn’t empty and git clone on it will fail. Remove app/ first and clone your repository into it:

bash
rm -rf app
git clone https://github.com/your-username/your-repository.git app

Rebuild and start:

bash
docker compose up -d --build

Updating the application later

bash
cd /root/stack/python/flask-mysql/app
git pull
cd ..
docker compose up -d --build

Option 2: via SFTP

It connects with the same credentials as SSH: same host, same user, same password and same port. Nothing needs to be enabled.

In your SFTP client:

Field Value
Protocol SFTP - SSH File Transfer Protocol
Server the IP of your cloud
User root
Password the root password of your cloud
Port the SSH port we provided

Once connected, navigate to your Stack directory:

text
/root/stack/<language>/<stack>/app/

Delete the sample files inside and upload your application files in their place.

Then, via SSH, rebuild:

bash
cd /root/stack/python/flask-mysql
docker compose up -d --build

Option 3: from the browser

This is the simplest option and doesn’t require installing any program or using the console.

Your service includes Cloud Commander, a web file manager that already comes running. Access it from:

text
https://cloudcmd.yourdomain.com

Replace yourdomain.com with your service domain.

When you enter you’ll only see two folders:

  • application — your application’s code. It’s the same app/ folder you see via SSH or SFTP.
  • backups — the automatic backups of your Stack, ready to download.

To deploy: delete the sample content inside application, upload your application’s files and apply the changes.

Why always --build

bash
docker compose up -d --build

Some Stacks mount app/ inside the container, so a change in a file is seen instantly. Others compile your code into the image, and in that case a change doesn’t exist until the image is rebuilt. Also, dependencies — requirements.txt, package.json, composer.json, pom.xml — are installed during the build in all cases.

Rebuilding always works on any Stack. It’s the safe command to remember.

Verify it worked

bash
docker compose ps          # all services in "running" state
docker compose logs -f app # your application's logs, live

Then open your server’s domain in the browser.

If something goes wrong

Symptom Where to look
The application doesn’t start docker compose logs app
Error building the image The output of docker compose up --build, without -d
502 response from the browser Your application is not listening on the expected internal port
Cannot connect to the database docker compose ps — the database can take a few seconds to be ready

To return to a clean state without losing the database or backups:

bash
docker compose down
docker compose up -d --build

Your data is backed up

The Stack makes automatic backups of the database and your application once per day, and keeps the last seven. You can find them in the backups folder of Cloud Commander. The intervals and retention are changed in the .env file.

Guide g.0321 · Source version 1 · en