GithubHelp home page GithubHelp logo

mohan-balakrishnan / strapi-heroku-cms-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from strapi/strapi-heroku-cms-demo

0.0 0.0 0.0 40.12 MB

Repository for "CMS" from the Gatsby / Strapi Video Tuturial Series

License: MIT License

HTML 12.97% JavaScript 49.66% CSS 37.37%

strapi-heroku-cms-demo's Introduction

Strapi with Gatsby Video Tutorial Series

This REPO contains the latest example code from the Gatsby / Strapi Video Tutorial Series. You can review the code directly, within the following directories.

NOTE: This is the BETA version of Strapi, ALPHA is not being maintained.

  • Code examples for the folder "cms". Path: ./tutorial/cms <- Strapi Project

  • Code examples for the folder "blog". Path: ./tutorial/blog. <- Gatsby Project

Instructions for cloning and using this repo locally

Create a folder, e.g. ./my-project and git clone this repo.

cd my-project
git clone https://github.com/strapi/strapi-heroku-cms-demo.git

Install this Strapi & Gatsby Project locally

From your command line, issue the following commands in order to install this Strapi and Gatsby project:

Path: ./my-project/

Install the Strapi part of the Project

git clone [email protected]:strapi/strapi-heroku-cms-demo.git
cd strapi-heroku-cms-demo
cd cms
npm install
strapi build

Once installed, you will need to do a few steps to replicate the final production environment (this steps are done also when you first upload and install to Heroku or other production environment):

  • Create a User: Under CONTENT TYPES -> Users - add a user.
  • Set WYIWYG to Visible: Under PLUGINS -> Content Manager -> Article -> [Tab] Edit View(Settings) -> Click on content -> Scroll down and toggle Display as WYSIWYG to ON.
  • Allow API Access: Under PLUGINS -> Roles & Permissions -> Public -> Article (check find and findone), User (check find and findone)
  • Enter your Cloudinary Credentials: Under PLUGINS -> FILES UPLOAD - COGWHEEL
  • Add Content: Under CONTENT TYPES -> Articles -> add content.

Test you local API routes

Upload to Heroku

You will need to have a Heroku account, and the Heroku CLI installed. Heroku install instructions

Do these steps to upload your Strapi project to Heroku:

  • Login to Heroku: heroku login
  • Initilize Git:
git init
git add .
git commit -am "Initial Commit"
  • Create a Heroku project (with a unique name for the URL)
heroku create my-uniquely-named-strapi-project
  • setup database configuration (DO NOT CUT AND PASTE - USE OWN SETTINGS)
heroku addons:create heroku-postgresql:hobby-dev
heroku config
heroku config:set DATABASE_USERNAME=example
heroku config:set DATABASE_PASSWORD=example
heroku config:set DATABASE_HOST=example.compute-2.amazonaws.com
heroku config:set DATABASE_PORT=5432
heroku config:set DATABASE_NAME=example
  • Push project to Heroku.
git push heroku master
  • Open your app project, and redo these steps to match your Development Environment:

  • Create a User: Under CONTENT TYPES -> Users - add a user.

  • Set WYIWYG to Visible: Under PLUGINS -> Content Manager -> Article -> [Tab] Edit View(Settings) -> Click on content -> Scroll down and toggle Display as WYSIWYG to ON.

  • Allow API Access: Under PLUGINS -> Roles & Permissions -> Public -> Article (check find and findone), User (check find and findone)

  • Enter your Cloudinary Credentials: Under PLUGINS -> FILES UPLOAD - COGWHEEL

  • Add Content: Under CONTENT TYPES -> Articles -> add content.

After you add content, you can go ahead and follow the next steps to create the Gatsby part of the project.

Install the Gatsby part of the Project

Open a new tab in your command line, and navigate to ./strapi-heroku-cms-demo/blog/:

Path: ./strapi-heroku-cms-demo/blog

npm install
gatsby develop

You can now check to see if Gatsby is running http://localhost:8000.

Push the Gatsby Project to a separate GitHub repo

You will need to create a separate repo to push just the Gatsby part of the project and which will link to Netlify.

git init
git add .
git commit -m "first commit"
git remote add origin [email protected]:YOUR-NAME/YOUR-NEW-EMPTY-REPO.git
git push -u origin master

Modify the Gatsby-Config file

Locate this code and replace the URL to match the URL from your Heroku install:

Path: ./blog/gatsby-config.js

    {
      resolve: `gatsby-source-strapi`,
      options: {
        apiURL: process.env.DEPLOY_URL
          ? "https://YOUR-APP-URL.herokuapp.com"
          : "http://localhost:1337",
        contentTypes: [`article`, `user`],
        queryLimit: 1000,
      },
    },

Configure Netlfiy

  • Login to Netlify with netlify login.

You will need to link netlify to this repo. Use the netlify init to do so.

netlify init

After configuring Netlify (see tutorial), you need to commit all the changes:

Commit these changes:

git add .
git commit -m "git commit -m "netlify config settings files"
git push
netlify open

Set-up the Netlify WebHook URL

The last step is to set-up the Netlify Webhook URL so it updates:

  • From your App, go to: Settings -> Build & deploy -> Continuous deployment -> Build hooks

    • Click Add build hook
    • Give your app a build hook name, e.g. strapiUpdate
    • Save it and then copy the issued URL to the clipboard
  • Change the staticWebsiteBuildURL variable found in custom.json.

These changes occur on your Strapi Project.

Path: ./cms/config/environments/production/custom.json

Replace the link with your link for the staticWebsiteBuildURL

Commit these changes:

git add .
git commit -m "Add webhook support"
git push heroku master

You are now ready to test and play with this installation. You can build or change this.

NOTE: You have NOT created a Repo for the Strapi part of the project, but this is highly recommended.

strapi-heroku-cms-demo's People

Contributors

davidkartuzinski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.