1
0
mirror of https://github.com/ascribe/wp-theme synced 2024-12-22 01:03:40 +01:00

remove CI stuff, refactor deployment script, update server documentation

This commit is contained in:
Matthias Kretschmann 2018-05-23 13:47:25 +02:00
parent 5c892f8234
commit babdca4d63
Signed by: m
GPG Key ID: 606EEEF3C479A91F
6 changed files with 36 additions and 42 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules
composer.lock composer.lock
phpunit.xml phpunit.xml
ascribe/assets/dist ascribe/assets/dist
package-lock.json

View File

@ -2,15 +2,13 @@
> WordPress theme for ascribe's landing page and blog > WordPress theme for ascribe's landing page and blog
[ ![Codeship Status for ascribe/wp-theme](https://codeship.com/projects/33c7d280-cf2d-0133-1c09-5ed74b30bb55/status?branch=master)](https://codeship.com/projects/141150)
## Prerequisites ## Prerequisites
- node & npm - node & npm
- composer - composer
```bash ```bash
npm install && composer npm i && composer install
``` ```
## Development ## Development
@ -31,27 +29,28 @@ The following compiles css & js files only:
gulp build gulp build
``` ```
## Deployment: Continuous Delivery ## Deployment
The theme under `ascribe/` gets built & deployed automatically via Codeship under the following conditions: Deployment happens via rsync'ing the theme folder `./ascribe/` over SSH, as defined in the [deployment script](deploy.sh).
- every push builds the site If you have SSH access to the server, you can do a deployment by calling the deployment script:
- every push to the master branch initiates a live deployment
Deployment happens via rsync'ing the theme build artifacts as defined in the [deployment script](_ci/deploy.sh):
```bash ```bash
sudo rsync --recursive --delete --delete-excluded --checksum --verbose -e "ssh" $DEPLOY_SRC $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH # do a fresh build of the CSS & JS
gulp build
# Then deploy
./deploy.sh
``` ```
The [deployment script](_ci/deploy.sh) requires the following environment variables to be set in Codeship: It requires the following environment variables to be defined, which is done in the deployment script:
variable | description variable | description
---|--- ---|---
`$DEPLOY_SRC` | source of CI build artifacts. On Codeship this is usually just relative to cloned repo path, so `ascribe/` `$ASCRIBE_DEPLOY_SRC` | source of CI build artifacts. On Codeship this is usually just relative to cloned repo path, so `ascribe/`
`$DEPLOY_USER` | user for connecting to deploy server `$ASCRIBE_DEPLOY_USER` | user for connecting to deploy server
`$DEPLOY_HOST` | hostname of deploy server `$ASCRIBE_DEPLOY_HOST` | hostname of deploy server
`$DEPLOY_PATH` | path to deploy into on the server, should be `PATH_ON_SERVER/wp-content/themes/` `$ASCRIBE_DEPLOY_PATH` | path to deploy into on the server, should be `PATH_ON_SERVER/wp-content/themes/`
## Server documentation ## Server documentation
@ -59,6 +58,6 @@ Site is hosted on an AWS EC2 instance with WordPress running on nginx.
Option | Server path Option | Server path
---|--- ---|---
Host | `ec2-52-29-65-193.eu-central-1.compute.amazonaws.com` Host | `ec2-52-57-166-130.eu-central-1.compute.amazonaws.com`
WordPress installation | `/var/www/ascribe-wp/` WordPress installation | `/var/www/ascribe-wp/`
Active theme | `/var/www/ascribe-wp/wp-content/themes/ascribe/` Active theme | `/var/www/ascribe-wp/wp-content/themes/ascribe/`

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
set -e;
gulp build
exit;

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
# $DEPLOY_SRC = ~/src/github.com/ascribe/wp-theme/ascribe/
set -e;
if [ $CI_BRANCH == "master" ]; then
rsync --recursive --delete --delete-excluded --checksum --verbose -e "ssh" $DEPLOY_SRC $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH
fi;
exit;

View File

@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -e;
npm install gulp -g
npm install
exit;

20
deploy.sh Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
ASCRIBE_DEPLOY_SRC="./ascribe"
ASCRIBE_DEPLOY_USER="ubuntu"
ASCRIBE_DEPLOY_HOST="ec2-52-57-166-130.eu-central-1.compute.amazonaws.com"
ASCRIBE_DEPLOY_PATH="/var/www/ascribe-wp/wp-content/themes"
set -e;
rsync \
--recursive \
--delete \
--delete-excluded \
--checksum \
--verbose \
--rsync-path="sudo rsync" \
-e "ssh" \
$ASCRIBE_DEPLOY_SRC $ASCRIBE_DEPLOY_USER@$ASCRIBE_DEPLOY_HOST:$ASCRIBE_DEPLOY_PATH
exit;