Overview

Render is a Platform as a Service that makes deploying and hosting Spree applications super easy.

Spree Starter is pre-configured to work with Render out of the box. It includes render.yaml file that is used to deploy the application.

Prerequisites

Setup repository

Firstly create your own repository based on Spree Starter template.

Go to Spree Starter repository and click on “Use this template” button and select “Create a new repository”.

Supply the repository name and click on “Create repository from template” button.

Make sure to set your repository visibility to “Private” so no one can see your code. This is crucial for your application security.

Now clone the repository to your local machine.

git clone https://github.com/your-username/my_spree_app.git

Now you can start working on your application. Make sure your environment is set up correctly (follow the Getting Started guide).

Running the bin/setup script should set your credentials correctly.

Don’t loose your config/master.key file or share it with anyone. It’s crucial for your application to work. We recommend to add it to 1password or other password manager.

Now add your config/credentials.yml.enc file to the repository.

git add config/credentials.yml.enc

Commit the changes.

git commit -m "Add credentials"
git push

This file is encrypted and cannot be seen by anyone without the master.key file.

Don’t commit your master.key file to the repository!

You can learn more about credentials in the Ruby on Rails Security Guide.

Create Render account and connect your repository

Go to render.com and create an account. We recommend to use your GitHub account to sign up as it will automatically link your GitHub repositories to Render.

Create Render blueprint

Render blueprints are YAML files used to deploy your application to Render. They consist a list of services that are required to run your application.

In the Render dashboard select “New blueprint” from the “+New” button.

Now select your repository from the list of repositories.

You should see the the new blueprint form.

  1. Set your blueprint name - eg. Spree App

  2. Copy your config/master.key file to the clipboard.

    cat config/master.key | pbcopy
    
  3. Paste it to the RAILS_MASTER_KEY environment variable.

After that is done click the “Deploy Blueprint” button. Now wait a few minutes for Render to setup your application.

You should see the following screen with the list of created services.

That’s it! Your application is now deployed to Render.

You can now access the admin dashboard of your application at the following URL.

https://<your-application-name>.onrender.com/admin

The default credentials are:

Email: [email protected]
Password: password

We recommend changing credentials after logging in! You can also do it from the Rails console. In your Render dashboard select your web service and click on the “Shell” tab.

Now you can open the Rails console by running bin/rails console.

Spree::User.first.update!(email: "<[email protected]>", password: "<your_password>", password_confirmation: "<your_password>")

Render will automatically any new changes you push to your repository.

Next steps

Now that your application is deployed, you also need to setup asset storage as Render only provides ephemeral storage.

Before going to full production, we recommend to also: