Giter VIP home page Giter VIP logo

craftcms's Introduction

Deploy Craft CMS with Porter

This is a quickstart repository you can fork to develop and deploy Craft CMS on Kubernetes on AWS/GCP/DO with Porter.

Quick Deploy

Deploying PostgreSQL Database (OPTIONAL)

This quickstart guide connects Craft CMS to a PostgreSQL database deployed on Porter. You can connect Craft CMS instances deployed on Porter to any external databases, but Porter lets you deploy a PostgreSQL instance in just one click. If you want to connect to a database that's deployed via Porter, please follow this guide. To seed the deployed database with existing data, you can use Porter's Remote Execution feature to run psql commands inside the deployed database.

Create Environment Group

To allow users to easily reuse the same set of environment variables across deployments, Porter supports Environment Groups. In this guide, we will be deploying two services for Craft CMS that use the same set of environment variables - we recommend you to store these as an environment group for convenience.

  1. Navigate to the Environment Group tab. Create a new environment group by loading in from a file or manually inputting the variables.
  2. Ensure that all environment variables outlined below are included. Your DATABASE environment variables must match the config of the database you are trying to connect to. If you're trying to connect to a database on Porter, see this guide for more details.
NODE_ENV=production
APP_ID=
SECURITY_KEY=
DATABASE_HOST=
DATABASE_PORT=5432
DATABASE_NAME=
DATABASE_USERNAME=
DATABASE_PASSWORD=

Deploying Craft CMS

  1. Create an account on Porter.
  2. One-click provision a Kubernetes cluster in a cloud provider of your choice, or connect an existing cluster if you already have a cluster.
  3. Fork this repository.
  4. We will launch two separate services: web and console. From the Launch tab, navigate to Web Service > Deploy from Git Repository. Select the forked repository and web.Dockerfile from the root directory. Click Continue.
  5. Configure the port to 8080, load in the environment variables from the Environment Group you created in the previous section, then hit deploy.
  6. Next we will deploy a console service. Navigate to Worker > Deploy from Git Repository from the launch tab. Select the forked repository and console.Dockerfile from the root directory. Load in the same set of environment variables as those used for web service, then hit deploy.
  7. Porter will now automatically handle CI/CD for your Craft CMS deployments whenever you push to the forked repository.

Development & Propagating Changes

To develop, clone this repository to your local environment and run docker-compose -f docker-compose.yml up --build from the root directory. To propagate your changes to the production environment, you need to run php craft migrate/all and php craft project-config/apply in one of your deployed services. You can do this via Porter's Remote Execution feature. This feature works in a similar way as ssh and allows you to run commands inside a deployment. After you've successfully deployed your changes, you can run these commands to propagate your changes.

porter run [DEPLOYMENT_NAME] -- php craft migrate/all
porter run [DEPLOYMENT_NAME] -- php craft project-config/apply

Alternatively, if you want to open up an interactive shell instance in the deployment to run other commands, run:

porter run [DEPLOYMENT_NAME] -- sh

Questions?

Join the Porter Discord community if you have any questions. For contributions/suggestions to docs, please open an issue in our open source repository.

craftcms's People

Contributors

porter-bot avatar sunguroku avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.