Coder Social home page Coder Social logo

proj-auto-site-deploy's Introduction

AutoSiteDeployment

A basic and simplistic way of generating development, staging and live environments on one nginx server configuration.

Getting Started

These instructions will get you a copy of the automated deployment project up and running on your Linux machine.

Prerequisites

What things you need to install the software and how to install them

-- nginx 1.14.0 or above --

$ sudo apt update
$ sudo apt install nginx -y

File Structure

This project follows the file structure of:

├┬ /var/sites/
│ └┬ development
│   ├ staging
│   └ live
│
└┬ /etc/sites/
  └┬ development/
    ├ staging/
    └ live/

Setup

If you haven't already got the file structure as listed above, please create the missing directories.

Set up nginx configuration to read from /etc/sites

sudo nano /etc/nginx/nginx.conf

Within http {...}, underneath the title of "Virtual Host Configs" add:

include /etc/sites/*/*;

Clone this repository, and then copy the contents of the created directory (AutoSiteDeploy) to /var/sites:

# Clone repository
cd /path/to
git clone https://github.com/reecebenson/AutoSiteDeploy.git

# Move contents
mv /path/to/AutoSiteDeploy/* /var/sites

# If the . files do not move, use the below commands
mv /path/to/AutoSiteDeploy/.deploy/ /var/sites
mv /path/to/AutoSiteDeploy/.git/ /var/sites
mv /path/to/AutoSiteDeploy/.gitignore /var/sites

Nginx Configuration

Please ensure that the Nginx configuration matches your requirements, feel free to edit the default .deploy/nginxsite file to your liking but maintain the practices for:

server {
    ...

    server_name SITEURL www.SITEURL;
    root /var/sites/SITETYPE/SITENAME/public;

    ...

    error_log /var/sites/SITETYPE/SITENAME/logs/error.log;
    access_log /var/sites/SITETYPE/SITENAME/logs/access.log;

    ...
}

The nginx configuration is set to be connected to PHP 7.2's FPM socket, you can configure that in the above file.

server {
    ...

    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;

    ...
}

Usage

Create development, staging and live environments

This creates the following directories & files:

  • /var/sites/{ development, staging, live }/{ logs, public }/
  • /etc/sites/{ development, staging, live}/{ dev, stg, live }.{ sitename }
$ ./deploy.sh

Please enter the site name:
> example

Please enter the site URL:
> example.com

Delete development, staging and live environments

This cleans up files within:

  • /var/sites/{ development, staging, live }
  • /etc/sites/{ development, staging, live}/{ dev, stg, live }.{ sitename }
$ ./remove.sh

Please enter the site name:
> example

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

proj-auto-site-deploy's People

Contributors

reecebenson avatar

Watchers

James Cloos avatar  avatar

proj-auto-site-deploy's Issues

No README.md

Hi Reece,

I think users looking to use the AutoSiteDeploy script could benefit from a README.md file explaining the process.

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.