Created scripts folder to store update/install/release process

This commit is contained in:
Nicolas Lœuillet 2016-10-09 21:50:15 +02:00
parent 26490a8794
commit 4e7863c6aa
No known key found for this signature in database
GPG key ID: 5656BE27E1E34D0A
4 changed files with 39 additions and 26 deletions

View file

@ -1,10 +1,6 @@
TMP_FOLDER=/tmp TMP_FOLDER=/tmp
RELEASE_FOLDER=wllbg-release RELEASE_FOLDER=wllbg-release
SSH_USER=framasoft_bag
SSH_HOST=78.46.248.87
SSH_PATH=/var/www/framabag.org/web
ENV=prod ENV=prod
help: ## Display this help menu help: ## Display this help menu
@ -14,19 +10,10 @@ clean: ## Clear the application cache
@rm -rf var/cache/* @rm -rf var/cache/*
install: ## Install wallabag with the latest version install: ## Install wallabag with the latest version
TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) @sh scripts/install.sh $(ENV)
@git checkout $(TAG)
@SYMFONY_ENV=$(ENV) composer install --no-dev -o --prefer-dist
@php bin/console wallabag:install --env=$(ENV)
update: ## Update the wallabag installation to the latest version update: ## Update the wallabag installation to the latest version
@rm -rf var/cache/* @sh scripts/update.sh $(ENV)
@git fetch origin
@git fetch --tags
TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
@git checkout $(TAG)
@SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist
@php bin/console cache:clear --env=prod
run: ## Run the wallabag server run: ## Run the wallabag server
php bin/console server:run --env=$(ENV) php bin/console server:run --env=$(ENV)
@ -41,17 +28,7 @@ release: ## Create a package. Need a VERSION parameter (eg: `make release VERSIO
ifndef VERSION ifndef VERSION
$(error VERSION is not set) $(error VERSION is not set)
endif endif
version=$(VERSION) @sh scripts/release.sh $(VERSION) $(TMP_FOLDER) $(RELEASE_FOLDER) $(ENV)
@rm -rf $(TMP_FOLDER)/$(RELEASE_FOLDER)
@mkdir $(TMP_FOLDER)/$(RELEASE_FOLDER)
@git clone git@github.com:wallabag/wallabag.git -b $(VERSION) $(TMP_FOLDER)/$(RELEASE_FOLDER)/$(VERSION)
@cd $(TMP_FOLDER)/$(RELEASE_FOLDER)/$(VERSION) && SYMFONY_ENV=$(ENV) composer up -n --no-dev
@cd $(TMP_FOLDER)/$(RELEASE_FOLDER)/$(VERSION) && php bin/console wallabag:install --env=$(ENV)
@cd $(TMP_FOLDER)/$(RELEASE_FOLDER) && tar czf wallabag-$(VERSION).tar.gz --exclude="var/cache/*" --exclude="var/logs/*" --exclude="var/sessions/*" --exclude=".git" $(VERSION)
@echo "MD5 checksum of the package for wallabag $(VERSION)"
@md5 $(TMP_FOLDER)/$(RELEASE_FOLDER)/wallabag-$(VERSION).tar.gz
@scp $(TMP_FOLDER)/$(RELEASE_FOLDER)/wallabag-$(VERSION).tar.gz $(SSH_USER)@$(SSH_HOST):$(SSH_PATH)
@rm -rf $(TMP_FOLDER)/$(RELEASE_FOLDER)
travis: ## Make some stuff for Travis-CI travis: ## Make some stuff for Travis-CI

8
scripts/install.sh Normal file
View file

@ -0,0 +1,8 @@
#! /usr/bin/env bash
ENV=$1
TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
git checkout $TAG
SYMFONY_ENV=$ENV composer install --no-dev -o --prefer-dist
php bin/console wallabag:install --env=$ENV

17
scripts/release.sh Normal file
View file

@ -0,0 +1,17 @@
#! /usr/bin/env bash
VERSION=$1
TMP_FOLDER=$2
RELEASE_FOLDER=$3
ENV=$4
rm -rf $TMP_FOLDER/$RELEASE_FOLDER
mkdir $TMP_FOLDER/$RELEASE_FOLDER
git clone git@github.com:wallabag/wallabag.git -b $VERSION $TMP_FOLDER/$RELEASE_FOLDER/$VERSION
cd $TMP_FOLDER/$RELEASE_FOLDER/$VERSION && SYMFONY_ENV=$ENV composer up -n --no-dev
cd $TMP_FOLDER/$RELEASE_FOLDER/$VERSION && php bin/console wallabag:install --env=$ENV
cd $TMP_FOLDER/$RELEASE_FOLDER && tar czf wallabag-$VERSION.tar.gz --exclude="var/cache/*" --exclude="var/logs/*" --exclude="var/sessions/*" --exclude=".git" $VERSION
echo "MD5 checksum of the package for wallabag $VERSION"
md5 $TMP_FOLDER/$RELEASE_FOLDER/wallabag-$VERSION.tar.gz
scp $TMP_FOLDER/$RELEASE_FOLDER/wallabag-$VERSION.tar.gz framasoft_bag@78.46.248.87:/var/www/framabag.org/web
rm -rf $TMP_FOLDER/$RELEASE_FOLDER

11
scripts/update.sh Normal file
View file

@ -0,0 +1,11 @@
#! /usr/bin/env bash
ENV=$1
TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
rm -rf var/cache/*
git fetch origin
git fetch --tags
git checkout $TAG
SYMFONY_ENV=$ENV composer install --no-dev -o --prefer-dist
php bin/console cache:clear --env=$ENV