Migrate your Parse App from Buddy to Back4App
As you have probably heard, the Buddy.com platform is turning off its Parse hosting service. We are glad to offer our assistance to help Buddy users to migrate to Back4App. We’ve developed a CLI Migration tool especially for migrating Parse Apps to Back4App. The tool is so straightforward that it can help Buddy users to migrate their apps in minutes. In this post, I describe in detail how to use this CLI Migration tool to move your database and files from Buddy. Also, I suggest an approach to migrate other features such as cloud code and integrations.
Suggested Migration Strategy
Users of Parse Apps may draw upon a number of resources for the migration process. To simplify the discussion I will group those resources into three main components: Database & Files, Cloud Code, Integrations.
Database and Files
We recommend starting the migration process by moving the Parse App database and the files to Back4App. It is logical to start in this way because the app’s data is the main resource of a Parse App, and most of the other features you need to migrate depend on the database and the files to be tested.
Migrating cloud functions is the next recommended step. It is important to note that cloud code compatibility may change depending on the version of Parse Server used. I suggest you keep the same version of Parse Server that you used in Buddy (2.6.0 or 2.7.4). You can easily modify the version of Parse Server in Back4App.
After deploying the cloud codes call each function and make sure that all of these run properly. It is also essential to check if the Logs screen shows any problem running or deploying functions.
Finally, the integrations you may have configured with external services should be migrated. Back4App is already prepared to receive integrations from the following services (with npm modules installed): Mailgun, Mandrill, SendGrid, Stripe, Braintree, Twilio. Also, it is very easy to install new npm modules when needed.
We also recommend retesting your app completely after the migration process.
1-Database & Files
1.1-Prepare your data
The first step to migrate your database to Back4App is to follow the instructions on Buddy’s Page and request a data export (see below).
You will receive an email with a copy of your database similar to that shown below:
Now its time to pick up the zip file that you’ve received from Buddy and unzip it into a folder of your choice. After unzip your database dump file you will see the folder structure shown below.
You have a dump of your database now you have to download your files. Click over the fileList.txt if you want to check a list of all your files on Buddy. To simplify our migration process let’s create a folder called files and download all your files inside that folder. To do that create a new folder and execute the command as shown below. This will download all the files to the current directory (/files).
//create a folder mkdir files cd files
//Download the files wget -i ../fileList.txt # <-- Back4App recommendation
# or using curl xargs -n 1 curl -O < ../fileList.txt # <-- Buddy default
TIP: We do recommend use the wget command to download the files because If a file name has a space character you can have problems using curl.
Once you have downloaded your database dump and files you can start the migration using our CLI Migration tool. Before starting to use the CLI Migration tool you have to check if you already have MongoDB and npm installed on your machine. If you don’t have please follow the links below to install them:
Install Node.js (>= 8) and npm
1.2-Install the CLI Migration tool
It is very simple to install the CLI. When this is an npm module, execute the following npm command:
npm install -g @back4app/m2b4a
After the install process finishes this screen is displayed:
1.3-Execute the migrate command
Execute the command below:
Follow the instructions on the migration tool:
After this process, you’ll see as a result all your app information including your App Keys. Please copy the last key (the Mongo URI).
At any moment if you need assistance you can reach us on website chat or schedule an appointment with our engineering team.
1.4 – Connect your current API to your new database at Back4App
Now it is time to update your current API to use the new MongoDB database at Back4App so you can make sure that your current users will start reading and writing from/to Back4App. If you didn’t copy the MongoURI on the last step let’s do it now. Go to your Back4App Dashboard and copy your database URI, is under the Core Settings App Menu.
After that let” s point your Buddy App to the new database. At Buddy platform go to App Settings->General. Then click over the link: Migrate from external Parse Server under App Management section.
Click over the button Set External URL and insert the URI you have copied previously. Save the new URI path clicking over the button Set external mongo URL.
After saving the new URI you will see that the Label and description of your database on Buddy’s App Management section will change to External Database.
1.5 – Connect your frontend code to Back4App
Now you need to change your frontend code to connect to Back4App API (https://parseapi.back4app.com) and use your new credentials what were printed in step 3.
1.6 – Test your app and deploy the new versions to the store
That’s the final step and once you have concluded it, your app is safe at Back4App!
At any moment if you need assistance you can reach us on website chat or schedule an appointment with our engineering team at [email protected]
To move Cloud code files to Back4App it is very simple once the file structure is very similar. Both of them have the folders Public(where static files are located) and cloud(where the cloud code functions are placed). At Back4App the folder Cloud only allows code-related-files(JS, JSON, EJS), all other assets or files you need you will have to upload on Public Folder.
The first step is to download your files from Buddy. You can do it easily using the Buddy CLI tool. After this step, you will have to upload your files to Back4App. You can do it using our dashboard or using our Back4App CLI tool.
Important points to consider when making this process:
- TIP: When using our CLI, use the command ‘b4a new’ to download the directory structure to paste your cloud code files and ‘b4a deploy’ to upload them to your app.
- Back4App uses 2 main folders: “public/” to public files, like HTML, CSS, etc. and “cloud/” to private cloud code.
- Inside “cloud/” Back4App import 2 files. One named “app.js” for your custom API (app.get(‘/my-custom-api’) for ex.) and “main.js” for Parse.Cloud functions and jobs
- VERY IMPORTANT! “app” (the express.js instance) and “Parse” variables are global. Don’t install them on your package.json or require them in your cloud code (don’t use require(‘express’) or require(‘parse/node’), just use the app and Parse variables).
- VERY IMPORTANT-2! Please check you Parse Server Version and make sure you are using the same version you’ve been using on Buddy.
The main integration point to consider when migrating from Budyy is about the email verification mechanism. On Buddy, you use to have an integration with an email service provider in order to send an account email verification. On Back4App you can choose if you want to keep using your previous integration or if you want to use our email verification tool.
If you want to keep using your email service provider please take a look at this guide for MailGun setup. For any other
Before concluding your migration we reinforce you should test all your App and make sure every feature is working properly. We are available to help you on your migration at any time if you need further assistance on migration please talk to us on website chat or schedule an appointment with our engineering team.