{"id":23582599,"url":"https://github.com/alexandergw/jwsa","last_synced_at":"2026-04-19T19:32:35.143Z","repository":{"id":77179023,"uuid":"185684617","full_name":"AlexanderGW/jwsa","owner":"AlexanderGW","description":"JWSA (Jenkins Web Scripts by Alex) - BASH scripts for Continuous Deployment (CD) of Drupal 8, with Jenkins (Drupal 7, and WordPress coming soon)","archived":false,"fork":false,"pushed_at":"2022-09-23T13:43:50.000Z","size":154,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-16T22:13:46.091Z","etag":null,"topics":["backups","bash","continuous-deployment","drupal","jenkins","jenkins-pipeline","rsync"],"latest_commit_sha":null,"homepage":"https://gailey-white.com/jwsa-continuous-deployment-jenkins-declarative-pipelines-composer-drupal-8","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexanderGW.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2019-05-08T21:56:35.000Z","updated_at":"2021-12-13T23:27:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"a9e69865-bde0-4db5-ab0b-fb90954368f3","html_url":"https://github.com/AlexanderGW/jwsa","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/AlexanderGW/jwsa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderGW%2Fjwsa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderGW%2Fjwsa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderGW%2Fjwsa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderGW%2Fjwsa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexanderGW","download_url":"https://codeload.github.com/AlexanderGW/jwsa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderGW%2Fjwsa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32020542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"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":["backups","bash","continuous-deployment","drupal","jenkins","jenkins-pipeline","rsync"],"created_at":"2024-12-27T01:12:11.899Z","updated_at":"2026-04-19T19:32:35.136Z","avatar_url":"https://github.com/AlexanderGW.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jenkins Web Scripts by Alex\n\nBASH scripts to running important Drush/WP-CLI commands for build, and deployment tasks.\n\nCall these scripts from Declarative Pipelines steps, or as an executed shell script (if using the execute script method, the environment variables that you pass to the shell would be `${JOB_NAME}` instead of `${env.JOB_NAME}` used in Groovy pipelines)\n\nThe `example-test` project template is based on a Composer Drupal \u003chttps://github.com/drupal-composer/drupal-project\u003e PuPHPet \u003chttps://puphpet.com\u003e Vagrant environment\n\n\u003chttps://gailey-white.com/jenkins-web-scripts-by-alex\u003e\n\n### Script requirements\n\n#### Environment\n\nSpecify the `$LAST_BUILD_ID` with a curl/wget, for the last successful build ID. This value is used to optimise the script steps, and database names for 'prod' (production) suffixed projects.\n\n#### Libraries\n\nmysql-client, openssh, rsync, scp, curl/wget\n\n#### Project environments\nThese scripts expect a database on either the local, or remote environment.\n\nThe `.env` files will be generated based on the information available at the time. Some values (such as database name) will default  to `$PROJECT_NAME`.\n\n#### Rsync\nThe rsync command for webserver configs, requires `sudo` access. Add the following to `sudo visudo` to allow this.\n\n```\n\u003cusername\u003e ALL=NOPASSWD:\u003cpath to rsync\u003e\n```\n\n### Caveat\nCompletely removing a Composer CMS dependency (such as a Drupal module) will require an initial deployment \nto disable and remove the module in config, before removing the dependency codebase. Otherwise you remove the code, before formally uninstalling it within Drupal.\n\nA solution to this, would be to create a module to handle 'releases'.\n\n```\nfunction HOOK_update_8001(\u0026$sandbox) {\n  // Perform data handling and uninstall tasks here...\n  \\Drupal::service('module_installer')-\u003euninstall(['mymodule']);\n}\n```\n\n### Pipeline example\nExample of the build and deploy scripts, used in Jenkins pipeline steps.\n\n```\nstage('Build') {\n\tsteps {\n\t\tsh \"~/jwsa/build.sh ${env.JOB_NAME} ${env.WORKSPACE} /path/to/project/envs/${env.JOB_NAME}/.env\"\n\t}\n}\n\nstage(\"Deploy\") {\n\tsteps {\n\t\tsh \"~/jwsa/deploy.sh ${env.JOB_NAME} ${env.WORKSPACE} ${env.BUILD_ID}  /path/to/project/envs/${env.JOB_NAME}/.env\"\n\t}\n}\n```\n\n### To build the workspace.\n\n`/path/to/build.sh ${env.JOB_NAME} ${env.WORKSPACE} /path/to/env-files/${env.JOB_NAME}/.env`\n\n- SSH connection test\n- Bootstrap test\n- Import database from remote\n- Run database routines\n\n### To deploy the workspace, to the environment.\n\n`/path/to/deploy.sh ${env.JOB_NAME} ${env.WORKSPACE} ${env.JOB_ID}  /path/to/project/envs/${env.JOB_NAME}/.env`\n\n- SSH connection test\n- Directory structure test\n- Bootstrap test\n- Rsync build (Make a copy of previous build if bootstrap successful, to ease transfer time on diff)\n- **Run platform routines (drupal8, etc)**\n\t- **If running 'prod' environment routines**\n    \t- Enable read-only mode\n    \t- Copy database\n    \t- Run database routines\n    \t- Switch build symlinks\n    \t- Disable read-only mode\n    - **Else, running default routines**\n    \t- Enable maintenance mode\n    \t- Backup database\n    \t- Switch build symlinks\n    \t- Run database routines\n    \t- Disable maintenance\n- Clean up old builds, backups\n- **NOTE: Build will (in many cases) be reverted if any of the core routines fail.**\n\n### Setting up a project\n\nThe `~/project` directory is where `$PROJECT_NAME` directories are kept, holding variables, optional web configs (named `$PROJECT_NAME`.conf, within their respective `$SERVICE` directories) for the build and deploy tasks, and backups synced from the destination.\n\n### The .env template\n\n```\nMYSQL_DATABASE=\"dbname\"\nMYSQL_HOSTNAME=\"localhost\"\nMYSQL_PASSWORD=\"123\"\nMYSQL_PORT=3306\nMYSQL_USER=\"dbuser\"\nHASH_SALT=\"your-salt-here\"\nAPP_ENV=\"dev\"\n```\n\n### Maria/MySQL credentials\n\nAll of these commands run without credentials. Setup a `~/.my.cnf` for the `$DEST_SSH_USER` using a similar template as below.\n\n```\n[mysql]\n user = myuser\n password = secret\n \n[mysqldump]\n user = myuser\n password = secret\n\n[mysqlshow]\n user = myuser\n password = secret\n```\n\n### Can I display this information within the CMS?\n\n#### Drupal 7 module\nComming soon...\n\n#### Drupal 8 module\n\u003chttps://github.com/AlexanderGW/jwsa_build_info_drupal\u003e\n\n#### WordPress module\nComming soon...","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandergw%2Fjwsa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexandergw%2Fjwsa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandergw%2Fjwsa/lists"}