You can migrate your application from Heroku to Cloud 66 in 3 steps:
- Build and deploy your application's code via the Cloud 66 dashboard
- Import your data to your new environment
- Redirect traffic to the new endpoint
Cloud 66 does not host apps
Cloud 66 does not host applications. We automate the build and deployment of your application to the cloud provider of your choice, or your own servers (virtual or physical).
What you’ll need
Before you begin migrating your application please check you have the following:
- A Cloud 66 Account — If you don't already have one, sign up for a Cloud 66 account. You'll get free unlimited access to all products for 4 weeks.
- A Git repo containing your application code — This can be a public or private repo. You can use any Git provider like GitHub / BitBucket or use your own privately hosted repo.
- A Cloud Account or Your Own Servers — See below.
Cloud 66 supports both VPC and (for AWS accounts created before 2014) EC2-Classic. We also support reserved instances. To use a VPC, your account must conform with the default VPC guidelines.
You need to configure AWS so that Cloud 66 to access your account. To to this:
- Log into the web interface for your AWS account
- Click on the name of your account in the top right corner of your AWS account, and select My Security Credentials.
On the next screen, some users will be asked to choose between Security Credentials and IAM users. We support both methods but we recommend that experienced users select IAM (Identity and Access Management) for better security because allows you to set permissions for specific users. Click on your chosen option below for more instructions.
Help with advanced AWS features:
If you delete your application from Cloud 66, your servers will not be deleted on your cloud provider unless the physical server deletion setting is turned on.
What server size do I need?
Using Heroku, you can choose between 1X (512 MB), 2X (1 GB) and PX (6 GB) server sizes. This makes it easy to calculate your server requirements, and we recommend that you use similar server resources when deploying your application via Cloud 66. We also recommend that you have a separate server for your database in production environments.
1. Build and deploy your code
Using the Cloud 66 Dashboard, you can pull your code directly from your Git repository and build it into a new version of your application on your own servers.
If you need help getting started, please read our Deploying your first Rails app guide.
We also have a guide to accessing your Git repository.
Once your code is deployed, you'll need to migrate your data across. The process differs for PostgreSQL and MySQL databases:
From your Heroku toolbelt, create a database backup URL by running
heroku pgbackups:url. Next, visit your Application Overview and click the Import Heroku data link. Paste the URL provided by the toolbelt into the field, and click Import Heroku data.
Missing Import Heroku Data button?
The Import Heroku Data button will disappear 2 weeks after you set up your app. If you need to access it, add
/heroku_import to the end of your app's Dashboard URL. For example
Start by dumping your existing database. Refer to the ClearDB documentation for common problems.
$ mysqldump -u [username] -p[password] [dbname] > backup.sql
Once you have a MySQL dump file, use the Cloud 66 toolbelt to upload the file to your application database server. Remember to replace the fields below with your values.
$ cx upload -s "[app_name]" --server [database_server_name] backup.sql /tmp/backup.sql
Next, use the toolbelt to SSH to your server.
$ cx ssh -s "[app_name]" [server_first_name]
Finally, use the command below to import your backup into the database. You can find the generated username, password and database name by visiting your Application Overview and clicking into your database server (e.g. MySQL server).
$ mysql -u [generated_user_name] -p [generated_password] "[database_name]" < /tmp/backupfile.sql
Once you're ready to serve traffic from your Cloud 66 application, you need to direct your traffic to it. For help doing this, see Configure your DNS.
Web server and Procfile
By default, Cloud 66 will deploy your application with Phusion Passenger, but you can also choose a custom Rack server like Puma, Thin or Unicorn. You may have a
web entry in your Procfile to do this on Heroku. Cloud 66 ignores this entry to avoid compatibility issues.
To run a custom web server, we require a
custom_web entry. It is important to set this before analyzing your application, to avoid building the application with Passenger.
You can also use the Procfile to define other background jobs.
Heroku restarts all dynos at 24 hours of uptime, which may conceal possible memory leaks in your application. When you migrate to Cloud 66, these will become noticeable because we don't restart your workers (other than during a deployment), so the leak can grow to be bigger. A temporary solution is to re-create the Heroku restart behavior, for example with this script:
for OUTPUT in $(pgrep -f sidekiq); do kill -TERM $OUTPUT; done
This will send a TERM signal to any Sidekiq workers, giving them 10 seconds (by default) to finish gracefully. Any workers that don't finish within this time period are forcefully terminated and their messages are sent back to Redis for future processing. You can customize this script to fit your needs, and add it to your application as a Server Job.
Note that this is a temporary solution, and we recommend that you use a server monitoring solution to identify the source of your leak.
Asset Pipeline Compilation
If you haven't compiled assets locally, Heroku will attempt to run the assets:precompile task during slug compilation. Cloud 66 allows you to specify whether or not to run this during deployment.