Skip to main content

Introduction

This guide covers deploying Phoenix applications on Shard Cloud. Phoenix is a web framework for Elixir that delivers fast, fault-tolerant applications with real-time capabilities.

Creating Your Project

Ensure you have Elixir and Phoenix installed.

Creating a New Phoenix Project

mix phx.new my_phoenix_app
cd my_phoenix_app

Basic Application Structure

Your Phoenix application should have this structure:
my_phoenix_app/
├── lib/
│   ├── my_phoenix_app/
│   └── my_phoenix_app_web/
├── config/
├── priv/
├── assets/
├── mix.exs
└── .shardcloud

Configuring Port 80

Update config/runtime.exs to use port 80:
config/runtime.exs
config :my_phoenix_app, MyPhoenixAppWeb.Endpoint,
  http: [ip: {0, 0, 0, 0}, port: 80],
  server: true
Or configure via environment variable:
config/runtime.exs
config :my_phoenix_app, MyPhoenixAppWeb.Endpoint,
  http: [ip: {0, 0, 0, 0}, port: String.to_integer(System.get_env("PORT") || "80")],
  server: true

Shard Cloud Configuration

Create a .shardcloud file:
.shardcloud
DISPLAY_NAME=Phoenix Website
DESCRIPTION=Elixir Phoenix Application
MAIN=mix.exs
MEMORY=512
VERSION=recommended
SUBDOMAIN=my-phoenix-site
CUSTOM_COMMAND=mix phx.server
The CUSTOM_COMMAND=mix phx.server is required to start Phoenix in server mode.

Deploying

1

Verify Locally

Run mix phx.server to verify your application works locally.
2

Prepare Your Files

Ensure you have:
  • All source files (lib/, config/, priv/)
  • mix.exs
  • .shardcloud
  • assets/ folder (if using frontend assets)
3

Exclude Unnecessary Files

Remove:
  • _build/
  • deps/
  • .elixir_ls/
  • node_modules/ (if present in assets)
4

Create ZIP Archive

Zip the entire Phoenix application folder.
5

Upload to Shard Cloud

Go to Shard Cloud Dashboard and upload.

Database Configuration

If your Phoenix app uses a database, configure it in config/runtime.exs:
config/runtime.exs
config :my_phoenix_app, MyPhoenixApp.Repo,
  url: System.get_env("DATABASE_URL"),
  pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
Set the DATABASE_URL environment variable in your Shard Cloud dashboard.

Additional Resources

Visit the official Phoenix documentation for more information.

Troubleshooting

  • Ensure CUSTOM_COMMAND=mix phx.server is set in .shardcloud
  • Verify port 80 is configured in config/runtime.exs
  • Check that server: true is set in your endpoint config
  • Make sure mix.exs includes all required dependencies
  • Remove deps/ folder before uploading (Shard Cloud will fetch them)
  • Ensure assets/ folder is included in your ZIP
  • Run mix assets.deploy locally before uploading for production assets
  • Verify DATABASE_URL environment variable is set in dashboard
  • Check database credentials and connection string format