{"id":35147351,"url":"https://github.com/rvwoens/centos-laravel-stack","last_synced_at":"2025-12-28T14:08:33.565Z","repository":{"id":146934169,"uuid":"122886277","full_name":"rvwoens/centos-laravel-stack","owner":"rvwoens","description":"Simple centos laravel Zero Downtime Deployment stack with bash scripts","archived":false,"fork":false,"pushed_at":"2025-10-02T14:31:38.000Z","size":189,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-02T14:41:19.232Z","etag":null,"topics":["centos","laravel","mariadb","nginx","php-fpm","zero-downtime"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rvwoens.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-02-25T23:05:46.000Z","updated_at":"2025-10-02T14:39:34.000Z","dependencies_parsed_at":"2025-10-02T14:28:36.752Z","dependency_job_id":"50ad0f0f-8da0-4f4c-9f83-c9ac38424a17","html_url":"https://github.com/rvwoens/centos-laravel-stack","commit_stats":null,"previous_names":[],"tags_count":85,"template":false,"template_full_name":null,"purl":"pkg:github/rvwoens/centos-laravel-stack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvwoens%2Fcentos-laravel-stack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvwoens%2Fcentos-laravel-stack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvwoens%2Fcentos-laravel-stack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvwoens%2Fcentos-laravel-stack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rvwoens","download_url":"https://codeload.github.com/rvwoens/centos-laravel-stack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvwoens%2Fcentos-laravel-stack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28100676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-28T02:00:05.685Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["centos","laravel","mariadb","nginx","php-fpm","zero-downtime"],"created_at":"2025-12-28T14:06:27.771Z","updated_at":"2025-12-28T14:08:33.558Z","avatar_url":"https://github.com/rvwoens.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple Centos Laravel stack for Zero-Downtime deployment\n[![GitHub Release](https://img.shields.io/badge/release-3.1.07-blue)](https://github.com/rvwoens/centos-laravel-stack)\n[![Last commit](https://img.shields.io/github/last-commit/rvwoens/centos-laravel-stack)](https://github.com/rvwoens/centos-laravel-stack)\n[![License](https://poser.pugx.org/cosninix/cos/license)](https://github.com/rvwoens/centos-laravel-stack)\n[![Actions Status](https://github.com/rvwoens/centos-laravel-stack/workflows/CI/badge.svg)](https://github.com/rvwoens/centos-laravel-stack/actions)\n\n## Installs a fresh server with\n[![Centos version](https://img.shields.io/badge/centos-8%209%20stream-blue)](https://github.com/rvwoens/centos-laravel-stack)\n[![PHP version](https://img.shields.io/badge/PHP-8.0%208.1%208.2%208.3-blue)](https://github.com/rvwoens/centos-laravel-stack)\n[![NGINX version](https://img.shields.io/badge/Nginx-1.20.1-blue)](https://github.com/rvwoens/centos-laravel-stack)\n[![Node version](https://img.shields.io/badge/Node-24-blue)](https://github.com/rvwoens/centos-laravel-stack)\n[![Redis version](https://img.shields.io/badge/Redis-6.2-blue)](https://github.com/rvwoens/centos-laravel-stack)\n[![Laravel version](https://img.shields.io/badge/Laravel-v5%20v6%20v7%20v8%20v9%20v10-blue)](https://github.com/rvwoens/centos-laravel-stack)\n* CentOS\n* Nginx and virtual hosts\n* Php fpm \u0026 cli, composer, common php packages.\n* Nvm, Node, npm, yarn\n* Redis\n* Security and Hardening (fail2ban, firewall, strict sshd)\n* Add (multiple) Laravel projects (any Laravel version) with Zero-Downtime deployment\n\nThe scripts are all bash, and kept very simple so you can tweak them to your needs if you want to.\n\nVery easy project deployment by calling the project's  server ```puller``` script via a local ```pusher``` script\nMultiple servers per project support (production, staging..) through a local ```pusher.conf``` configuration\n\n## how to install\n\n* bring up a bare centos server somewhere (centOS 8, 9 and stream supported)\n* ssh as root and run:\n\n```bash\nyum -y install tar\ncurl -s -L https://github.com/rvwoens/centos-laravel-stack/archive/v3.1.07.tar.gz | tar -xz\ncd centos-laravel-stack-3.1.07\n./setup_full\n```\n\nThat's it (estimated 30 minutes to run, and stops for some input). Now you can add laravel apps:\n\n## Add a new laravel app with Zero Downtime Deployment\nLog in as the default (created) user and run\n```\n    addzhost \u003c\u003cdomain\u003e\u003e \u003c\u003cgit repository\u003e\u003e \u003c\u003cinitial tag\u003e\u003e\n```\n\n### Note:\nYou need access privileges from this server on the repository.\n- For github or gitlab, Go to settings-\u003essh keys and add the contents of ```~/.ssh/id_rsa.pub``` to a new ssh key.\n- As an alternative you can use the readonly ```https://github.com/\u003cuser\u003e/\u003crepo\u003e.git``` (default) repo url, but in this case the puller will just use a git clone\n\n### Directory structure\nThe zero downtime deployment creates the following directory structure for each app:\n```\n/var/www/app-domain-name\n\\_  current   - symlink to the current active release. Nginx serves from here\n\\_  puller    - puller script to deploy a new release (generated by addzhost)\n\\_  rollback  - rollback script to go back to an old release (generated by addzhost)\n\\_  releases  - all releases are kept here\n| \\_ 1.0.0\n| \\_ 1.0.1 \n| \\_ etc\n\\_  storage   - main laravel storage directory symlinked into all releases\n\\_ .env       - Main laravel .env symlinked into all releases\n```\n\n### Example:\n\n```$ addzhost myapp.example.com git@gitlab.com:myprojects/myapp.git v1.0.3```        \nNow you can browse to myapp.example.com and enjoy your v1.0.3 release (make sure DNS has been set up)\n\n\n- adds ```/var/www/myapp.example.com``` for the laravel app (make sure to configure DNS to the IP of this server)\n- creates a nginx config in ```/etc/nginx/sites-available``` and enables it\n- creates ```/var/www/myapp.example.com/releases``` dir for each inidividual release\n- creates ```/var/www/myapp.example.com/storage``` dir which is linked into each release\n- creates (stub) ```/var/www/myapp.example.com/.env``` file which is linked into each release. Tweak this to your needs.\n\n\n- generates a ```puller``` script (in /var/www/myapp.example.com) to pull a version (tag) from the repository and release it\n- generates a ```rollback``` script to roll back to a previous release (any of the releases available in the releases dir)\n- uses ```puller``` to release the initial tag into production. if it fails you can rollback everything and try again.\n\n### puller \nUsage: ```$ /var/www/[domain]/puller [tag]```\n\nPuller is generated by addzhost on the top project directory: ```/var/www/[domain]/puller```\n\n- Creates a new release in the releases directory and uses ```git archive``` to download the release\n- create symbolic links of ```/var/www/[domain]/storage``` and ```/var/www/[domain]/.env``` into the release\n- runs ```composer install```\n- You can create a custom post-deployment script in the root of your repository called ```after_deploy``` with your own artisan/composer/npm commands.\n  a typical after_deploy could look like this\n    ```\n    echo \"DEPLOY\"\n    php artisan migrate --force\n    yarn install\n    yarn run production\n    ```\n- Makes sure everything has the right chown and chmod applied\n- swaps the ```/var/www/[domain]/current``` link towards the new release to make it available with zero downtime\n\nIf any of the steps failed ```puller``` aborts before making the release current.\n\nYou can call ```puller``` from your local development machine for further integration:\n\n```\nserver=[user]@[host]\ndir=[deploy directory]\ntag=`git describe --abbrev=0 --tags`    # latest tag\necho \"$dir/puller $tag;\" | ssh $server\n```\n\n\n### rollback (generated by addzhost)\nUsage: rollback [tag]\n\nRollback is generated by addzhost on the top project directory: ```/var/www/[domain]/rollback```\n\n- swaps the /var/www/[domain]/current link to the old release to make it available with zero downtime\n\n## Local support\n\nThe local_support directory contains a few bash scripts for local deployment.\nUsed when you need to deploy against multiple instances of your app on multiple servers,\nfor instance a staging, a beta test and a production machine.\n\n### pusher (local machine)\n you can use the ```pusher``` tool to deploy to a number of instances on any server using a ```pusher.conf``` file.\nThe ```pusher.conf``` file is expected on the base path (root) of the laravel app.\n\nBy default it pushes a new version (last tag obtained from the local git) to the instance \nby using the ```newversion``` tool, however you can also specify a new tag yourself.\n\nFor conveniance, a ```config/version.php``` file is written/updated in your laravel project\n(and pushed to git) before deploying so you can show the deployed version somewhere in your app.\n\nPusher is found in the local_support directory together with an example pusher.conf file. \nPusher calls the appropriate ```puller``` script on the target machine as defined in the ```pusher.conf``` file.\n\ncopy the pusher script to a path somewhere so it can be used by multiple projects.\n\nExamples: (assume current dir is the root of a laravel project on a local machine)\n```\n$ cat pusher.conf\nstaging     example@exampleserver.com               /var/www/staging-of-myapp\nprod        example@productionserver-example.com    /var/www/myapp\nbetatest    my@exampleserver.com                    /var/www/betatest\n```\n```\n$ pusher betatest\n... determine the lastest git tag (for instance 1.3.42)\n... increments the version to 1.3.43 and sets a git tag, \n... git push and write config/version.php with 1.3.43\n... ssh into server my@exampleserver.com \n... run puller 1.3.43 on the /var/www/betatest/releases directory\n```\n\n```\n$ pusher prod 1.2.5\n... creates a version 1.2.5 and sets a git tag, \n... git push and write config/version.php with 1.2.5\n... ssh into server example@productionserver-example.com\n... run puller 1.2.5 on the /var/www/myapp directory\n```\n\n### newversion (local machine)\nSimple bash script that increments a version number.\nUse the -x option to avoid incrementing the second version element.\n\nused by the ```pusher``` script to automatically increment the version number\nExamples:\n```\n$ newversion 1.3.4 \n1.3.5\n$ newversion 1.3.9\n1.4.0\n$ newversion 1.3.09 \n1.3.10 \n$ newversion -x 1.3.9 \n1.3.10 \n```\n\n## Overview of individual installation parts run by ```setup_full```\n\nparts are numbered to show the order in which they should be run.\n\n#### 01 user create\ncreate the default user and allow sudo. Block using passwords and only allow access using your public key for security.\n\n* asks for username\n* asks for ssh public key to access this account remotely. Paste the contents of your ~/.ssh/id_rsa.pub\n\n#### 02 set hostname\nchanges the hostname\n\n#### 03 repos and yums\nAdd remi and epel repo, updates the system and ```yum``` the basics\n\n#### 04 root password\nsecures the root user\n\n#### 05 security\nfirewalls, sshd security and fail2ban - disable password logins and secure it further with ```fail2ban```\n\n#### 06 global settings\ncolor prompts, timezone settings, ntp server, fortune and cowsay (just for fun)\n\n#### 07 php\nSet up php including fpm and composer\n\n#### 08 node and npm\nOptionally Installs node, npm and yarn\n\n#### 09 mysql / mariadb\nOptionally installs mariadb and sets it up for production\n\n* MariaDB asks some questions during install, like the root password to be used\n\n#### 10 nginx\nset up nginx for php-fpm and prepare for multiple virtual hosts with the sites-enabled/sites-available pattern\n\n#### 11 laravel\nOptionally it can install a default laravel project with zero-downtime-deployment project using the ```addzhost``` command\n\n#### 12 redis\nOptionally install redis\n\n#### Finally\nlogout as root. At this moment the server is ready for project deployments.\n\n\n### extra utilities in ~/bin\n* artisan - shortcut to ```php artisan```\n* clear-laravel -  clears all possible caches and restores path permissions\n* logtail - tails the latest laravel log for a live logview (from any laravel top directory)\n* dbRemote2local - copy a remote mysql database to a local database\n* release-cleanup - removes old releases, run in the release dir of a project\n* \n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvwoens%2Fcentos-laravel-stack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frvwoens%2Fcentos-laravel-stack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvwoens%2Fcentos-laravel-stack/lists"}