Skip to main content

Introduction

  • This article guides you through creating and hosting a pgAdmin application on Square Cloud.
  • Before getting started, make sure you have an account on Square Cloud, which you can create on the signup page with your email.
  • Finally, you need to have an active plan on your account. Compare the available plans and choose one according to your needs.

Creating the Project

  • pgAdmin runs on Python, so the project needs a requirements.txt or a pyproject.toml. See how to create a requirements.txt.
  • Your requirements.txt must have pgadmin4 and a web server to serve it. In this tutorial, we will use gunicorn.
requirements.txt
  • Next, you will need a config file config_local.py to set some paths. These paths will define where to save some infos about your pgadmin.
config_local.py
We already have everything ready for deploy in our pgadmin4-web releases. You just need to download the project.zip, fill in the two variables below and upload it.

Files in your ZIP

The following files go in your ZIP:
  • requirements.txt or pyproject.toml
  • config_local.py
  • squarecloud.app (the configuration file below)

Configuration File

  • When uploading from the dashboard, set the runtime manually to Python and use the START command below as the startup command. In a squarecloud.app configuration file, that looks like this:
squarecloud.app
  • Gunicorn listens on port 80 on all interfaces (0.0.0.0), where Square Cloud delivers your subdomain’s traffic. Keep a single worker (--workers=1) and add threads instead: with more workers, pgAdmin fails with CSRF errors.
  • Next, set 2 environment variables, PGADMIN_SETUP_EMAIL and PGADMIN_SETUP_PASSWORD. pgAdmin uses them to create the first user when it starts for the first time.
.env
  • Set them in the upload form’s Advanced configuration, on the application’s Environment Variables page (then restart it), or with squarecloud app env set. pgAdmin doesn’t read a .env file at the root of your project, so a file like the one above only works as .squarecloud/.env, the file Square Cloud loads when the application starts (our ready-made release uses it). See Environment variables.

Uploading the Project to Square Cloud

After preparing your project files, you can now upload them to Square Cloud and host your project.

Via dashboard

1

Access the Upload Page

Access the upload page and upload your project zip file.
2

Configure Your Environment

After uploading your zip, you will need to configure the name, main file or runtime environment and other settings for your project.
If you are uploading a web project, make sure to select “Web Publication” and set a subdomain to your project.
3

Deploy Your Project

Finally, click on the “Deploy” button to host your project on Square Cloud.
After deployment, you can monitor your project’s status and logs from the dashboard.
Uploading application to Square Cloud
4

Confirm Your App Is Live

Your first deploy usually takes less than a minute. In the dashboard, wait for your application status to show as running and check the logs for any startup errors.
If you deployed a website or API, open https://<your-subdomain>.squareweb.app in your browser: you should see your application responding. If you deployed a bot, send it a command to confirm it is online.
App not starting? See the Troubleshooting guide for the most common causes and fixes.

Via CLI

To use this method, your project needs a configuration file named squarecloud.app at its root. It tells Square Cloud how to run your application.

Configuration file guide

Learn how to create the squarecloud.app configuration file that defines your application’s environment.
1

Install the CLI

Install the Square Cloud CLI. If you already have it, run the same command to update it:
2

Log In

Run the command below. It opens your browser: approve the login there and the CLI is ready. There is no API key to copy. For scripts and CI, see CLI authentication.
3

Upload Your Project

From your project folder, run the command below. The CLI zips the current folder, leaving out what squarecloud.ignore lists, and uploads it:
To upload a zip you created yourself, pass it with --file:
4

Confirm Your App Is Live

Your first deploy usually takes less than a minute. Check your application status and logs directly from the terminal:
If you deployed a website or API, open https://<your-subdomain>.squareweb.app in your browser: you should see your application responding. If you deployed a bot, send it a command to confirm it is online.
App not starting? See the Troubleshooting guide for the most common causes and fixes.

Final Considerations

That’s it! Your pgAdmin panel is now live at my-pgadmin-subdomain.squareweb.app. Log in with the email and password you set, then add your PostgreSQL server to manage it from anywhere.

Next steps

Managed database

Create a PostgreSQL database to manage with pgAdmin.

Database connection errors

Fix SSL/TLS and connection errors.

Gunicorn

Tune the web server that runs pgAdmin.

Contact us

If you continue facing technical difficulties, our specialized support team is available to assist you. Contact us and we’ll be happy to help you resolve any issue: support quality is a big part of why developers rate Square Cloud 4.9/5 across 402 reviews on Google and Trustpilot.