diff options
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | .gitlab-ci.yml | 20 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rwxr-xr-x | deploy.sh | 5 |
4 files changed, 25 insertions, 12 deletions
@@ -27,5 +27,7 @@ _vimrc_local.vim /vendor/ /composer.lock -node_modules -public/assets
\ No newline at end of file +# Frontend files +/node_modules +/public/assets +/package-lock.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8018543b..9fed9ea0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ image: php cache: paths: - - .composer + - .composer services: - mariadb:10.2 @@ -37,7 +37,16 @@ before_script: # Install Composer - &before_install_composer |- curl -sS https://getcomposer.org/installer | php -- --no-ansi --install-dir /usr/local/bin/ --filename composer - /usr/local/bin/composer --no-ansi install + composer --no-ansi install + # Install Node.js and Yarn + - &before_install_yarn |- + apt -yqq install gnupg2 apt-transport-https + curl -sL https://deb.nodesource.com/setup_8.x | bash - + curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - + echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list + apt -yqq update && apt -yqq install nodejs yarn + yarn install + yarn build .test_template: &test_definition stage: test @@ -61,11 +70,12 @@ test:7.1: services: [] stage: deploy only: - - master + - master before_script: - *before_fix_permissions - *before_install_packages - *before_install_composer + - *before_install_yarn .deploy_template_script: # Configure SSH @@ -78,8 +88,8 @@ test:7.1: - &deployment_dependencies |- chmod +x ./deploy.sh apt update && apt install -yqq rsync openssh-client - /usr/local/bin/composer --no-ansi install --no-dev - /usr/local/bin/composer --no-ansi dump-autoload --optimize + composer --no-ansi install --no-dev + composer --no-ansi dump-autoload --optimize deploy_staging: <<: *deploy_definition @@ -10,7 +10,7 @@ To report bugs use [engelsystem/issues](https://github.com/engelsystem/engelsyst ## Installation ### Requirements: - * PHP >= 7.0.0 + * PHP >= 7.0 * MySQL-Server >= 5.5 or MariaDB-Server >= 5.5 * Webserver, i.e. lighttpd, nginx, or Apache * Node >= 8 (Development/Building only) @@ -18,7 +18,7 @@ To report bugs use [engelsystem/issues](https://github.com/engelsystem/engelsyst ### Directions: * Clone the master branch: `git clone https://github.com/engelsystem/engelsystem.git` - * Install [Composer](https://getcomposer.org/download/) and [Yarn](https://yarnpkg.com/en/docs/install) + * Install [Composer](https://getcomposer.org/download/) and [Yarn](https://yarnpkg.com/en/docs/install) (which requires [Node.js](https://nodejs.org/en/download/package-manager/)) * Install project dependencies: ```bash composer install @@ -77,7 +77,7 @@ To use the deployment features the following secret variables need to be defined ```bash SSH_PRIVATE_KEY # The ssh private key STAGING_REMOTE # The staging server, e.g. user@remote.host -STAGING_REMOTE_PATH # The psth on the remote server, e.g. /var/www/engelsystem +STAGING_REMOTE_PATH # The path on the remote server, e.g. /var/www/engelsystem PRODUCTION_REMOTE # Same as STAGING_REMOTE but for the production environment PRODUCTION_REMOTE_PATH # Same as STAGING_REMOTE_PATH but for the production environment ``` @@ -50,7 +50,7 @@ fi echo "syncing ${PWD}/ to ${remote_host}:${remote_path}/${deploy_id}/" -rsync -vAax --exclude '.git*' --exclude .composer/ \ +rsync -vAax --exclude '.git*' --exclude .composer/ --exclude node_modules/ \ -e "ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \ ./ "${remote_host}:${remote_path}/${deploy_id}/" @@ -63,7 +63,8 @@ ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "${remote_hos fi echo \"Changing symlink\" - unlink \"${remote_path}/current\" && ln -s \"${remote_path}/${deploy_id}\" \"${remote_path}/current\" + unlink_cmd=\$(command -v unlink || command -v rm) + \$unlink_cmd \"${remote_path}/current\" && ln -s \"${remote_path}/${deploy_id}\" \"${remote_path}/current\" if [[ -f \"${deploy_id}-config.php\" ]]; then echo \"Restoring config\" |