diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml new file mode 100644 index 000000000..0275b540b --- /dev/null +++ b/.github/workflows/Build.yml @@ -0,0 +1,345 @@ +name: Build + +on: + push: + branches: ['*'] + pull_request: + branches: ['*'] + schedule: + - cron: "0 0 * * 5" + +jobs: + PHPUnit-MySQL: + + strategy: + fail-fast: false + matrix: + php_versions: ['7.1', '7.2', '7.3', '7.4'] + + runs-on: ubuntu-latest + name: PHPUnit - PHP ${{ matrix.php_versions }} - MySQL + + env: + TEST_DB: default + UF_MODE: debug + DB_DRIVER: mysql + DB_HOST: 127.0.0.1 + DB_USER: userfrosting + DB_PASSWORD: password + DB_NAME: userfrosting + DB_PORT: 3306 + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_versions }} + extensions: mbstring, dom, fileinfo, gd, memcached, redis, pdo_sqlite + coverage: xdebug + tools: pecl, composer:v1 + + - uses: actions/setup-node@v2 + with: + node-version: 10 + + - name: Setup Redis-server + uses: supercharge/redis-github-action@1.1.0 + with: + redis-version: 6 + + - name: Setup Memcached + uses: niden/actions-memcached@v7 + + - name: Shutdown Ubuntu MySQL (SUDO) + run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it + + - name: Set up MySQL (PHP <= 7.3 -> MySQL 5) + if: ${{ matrix.php_versions != 7.4 }} + uses: mirromutth/mysql-action@v1.1 + with: + mysql version: '5' + mysql database: 'userfrosting' + mysql user: 'userfrosting' + mysql password: 'password' + + - name: Set up MySQL (PHP >= 7.4 -> MySQL 8) + if: ${{ matrix.php_versions == 7.4 }} + uses: mirromutth/mysql-action@v1.1 + with: + mysql version: '8' + mysql database: 'userfrosting' + mysql user: 'userfrosting' + mysql password: 'password' + + - name: Wait for MySQL + run: | + while ! mysqladmin ping --host=127.0.0.1 --password=password --silent; do + sleep 1 + done + + - name: Copy .env + run: php -r "copy('app/sprinkles.example.json', 'app/sprinkles.json');" + + - name: Install Dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Bakery Debug + run: php bakery debug + + - name: Migrate DB + run: php bakery migrate + + - name: Build Assets + run: php bakery build-assets + + - name: Execute tests + run: app/vendor/bin/phpunit --coverage-clover=coverage.xml + + - name: Upload coverage to Codecov + if: github.event_name != 'schedule' + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + fail_ci_if_error: true + + PHPUnit-SQLite: + + strategy: + fail-fast: false + matrix: + php_versions: ['7.1', '7.2', '7.3', '7.4'] + + runs-on: ubuntu-latest + name: PHPUnit - PHP ${{ matrix.php_versions }} - SQLite + + env: + TEST_DB: default + UF_MODE: debug + DB_DRIVER: sqlite + DB_NAME: database/database.sqlite + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_versions }} + extensions: mbstring, dom, fileinfo, gd, memcached, redis, pdo_sqlite + coverage: xdebug + tools: pecl, composer:v1 + + - uses: actions/setup-node@v2 + with: + node-version: 10 + + - name: Setup Redis-server + uses: supercharge/redis-github-action@1.1.0 + with: + redis-version: 6 + + - name: Setup Memcached + uses: niden/actions-memcached@v7 + + - name: Copy .env + run: php -r "copy('app/sprinkles.example.json', 'app/sprinkles.json');" + + - name: Install Dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Create SQLite Database + run: | + mkdir -p database + touch database/database.sqlite + + - name: Bakery Debug + run: php bakery debug + + - name: Migrate DB + run: php bakery migrate + + - name: Build Assets + run: php bakery build-assets + + - name: Execute tests + run: app/vendor/bin/phpunit --coverage-clover=coverage.xml + + - name: Upload coverage to Codecov + if: github.event_name != 'schedule' + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + fail_ci_if_error: true + + PHPUnit-Postgre: + + strategy: + fail-fast: false + matrix: + php_versions: ['7.1', '7.2', '7.3', '7.4'] + + runs-on: ubuntu-latest + name: PHPUnit - PHP ${{ matrix.php_versions }} - PostgreSQL + + env: + TEST_DB: default + UF_MODE: debug + DB_DRIVER: pgsql + DB_HOST: 127.0.0.1 + DB_USER: userfrosting + DB_PASSWORD: password + DB_NAME: userfrosting + DB_PORT: 5432 + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_versions }} + extensions: mbstring, dom, fileinfo, gd, memcached, redis, pdo_sqlite, pdo_pgsql + coverage: xdebug + tools: pecl, composer:v1 + + - name: Setup PostgreSQL + uses: harmon758/postgresql-action@v1 + with: + postgresql db: 'userfrosting' + postgresql user: 'userfrosting' + postgresql password: 'password' + + - uses: actions/setup-node@v2 + with: + node-version: 10 + + - name: Setup Redis-server + uses: supercharge/redis-github-action@1.1.0 + with: + redis-version: 6 + + - name: Setup Memcached + uses: niden/actions-memcached@v7 + + - name: Copy .env + run: php -r "copy('app/sprinkles.example.json', 'app/sprinkles.json');" + + - name: Install Dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Bakery Debug + run: php bakery debug + + - name: Migrate DB + run: php bakery migrate + + - name: Build Assets + run: php bakery build-assets + + - name: Execute tests + run: app/vendor/bin/phpunit --coverage-clover=coverage.xml + + - name: Upload coverage to Codecov + if: github.event_name != 'schedule' + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + fail_ci_if_error: true + + PHPUnit-Windows: + + strategy: + fail-fast: false + matrix: + php_versions: ['7.1', '7.2', '7.3', '7.4'] + + runs-on: windows-latest + name: PHPUnit - PHP ${{ matrix.php_versions }} - Windows + + env: + TEST_DB: default + UF_MODE: debug + DB_DRIVER: sqlite + DB_NAME: database/database.sqlite + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_versions }} + extensions: mbstring, dom, fileinfo, gd, pdo, sqlite, pdo_sqlite + coverage: xdebug + tools: pecl, composer:v1 + + - uses: actions/setup-node@v2 + with: + node-version: 10 + + - name: Copy .env + run: php -r "copy('app/sprinkles.example.json', 'app/sprinkles.json');" + + - name: Install Dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Create SQLite Database + run: | + mkdir -p database + touch database/database.sqlite + + - name: Bakery Debug + run: php bakery debug + + - name: Migrate DB + run: php bakery migrate + + - name: Build Assets + run: php bakery build-assets + + - name: Execute tests + run: app/vendor/bin/phpunit --coverage-clover=coverage.xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + fail_ci_if_error: true + + Asset-Build: + + strategy: + fail-fast: false + matrix: + php_versions: ['7.4'] + node_versions: ['10', '12', '14'] + os: [ubuntu-latest, windows-latest] + + runs-on: ${{ matrix.os }} + name: Assets Build - PHP ${{ matrix.php_versions }} - Node ${{ matrix.node_versions }} - ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_versions }} + extensions: mbstring, dom, fileinfo, gd + coverage: xdebug + tools: pecl, composer:v1 + + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node_versions }} + + - name: Copy .env + run: php -r "copy('app/sprinkles.example.json', 'app/sprinkles.json');" + + - name: Install Dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Execute build + run: php bakery build-assets \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e8eb42d2f..000000000 --- a/.travis.yml +++ /dev/null @@ -1,58 +0,0 @@ -dist: xenial -language: php - -services: - - mysql - - postgresql - - memcached - - redis - -php: - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -env: - jobs: - - DB=mysql - - DB=sqlite - - DB=pgsql - - DB=memory - -jobs: - fast_finish: true - -cache: - directories: - - $HOME/.composer/cache - -before_install: - # Force use of Composer 1.x - - composer self-update --1 - # copy sprinkles.json - - cp app/sprinkles.example.json app/sprinkles.json - # set up db - - bash build/before_install.sh $DB - # update node - - nvm install 10.12.0 - # Install Redis and Memcached - - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - printf "\n" | pecl install -f redis - -before_script: - # install deps and UF - - COMPOSER_MEMORY_LIMIT=-1 travis_retry composer install --no-interaction - - php bakery debug - - php bakery build-assets - - php bakery migrate - -script: - # run unit tests - - app/vendor/bin/phpunit --coverage-clover=coverage.xml - -after_success: - - bash <(curl -s https://codecov.io/bash) - -after_failure: - - cat app/log/userfrosting.log diff --git a/CHANGELOG.md b/CHANGELOG.md index 093b9cdf2..9a312cb33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [v4.4.5] + +### Changed +- Replaced Travis with Github Actions +- Force Composer 1.0 for Docker ([#1126]) +- Update error.html.twig - add container ([#1128]) +- Update some tests +- Update Vagrant doc & config + ## [v4.4.4] ### Fixed @@ -983,6 +992,8 @@ See [http://learn.userfrosting.com/upgrading/40-to-41](Upgrading 4.0.x to 4.1.x [#1107]: https://github.com/userfrosting/UserFrosting/pull/1107 [#1109]: https://github.com/userfrosting/UserFrosting/pull/1109 [#1114]: https://github.com/userfrosting/UserFrosting/pull/1114 +[#1126]: https://github.com/userfrosting/UserFrosting/pull/1126 +[#1128]: https://github.com/userfrosting/UserFrosting/pull/1128 [v4.2.0]: https://github.com/userfrosting/UserFrosting/compare/v4.1.22...v4.2.0 [v4.2.1]: https://github.com/userfrosting/UserFrosting/compare/v4.2.0...v.4.2.1 @@ -997,3 +1008,4 @@ See [http://learn.userfrosting.com/upgrading/40-to-41](Upgrading 4.0.x to 4.1.x [v4.4.2]: https://github.com/userfrosting/UserFrosting/compare/v4.4.1...v4.4.2 [v4.4.3]: https://github.com/userfrosting/UserFrosting/compare/v4.4.2...v4.4.3 [v4.4.4]: https://github.com/userfrosting/UserFrosting/compare/v4.4.3...v4.4.4 +[v4.4.5]: https://github.com/userfrosting/UserFrosting/compare/v4.4.4...v4.4.5 diff --git a/README.md b/README.md index a0268dc83..b50f11f48 100644 --- a/README.md +++ b/README.md @@ -3,22 +3,22 @@ [![Latest Version](https://img.shields.io/github/release/userfrosting/UserFrosting.svg)](https://github.com/userfrosting/UserFrosting/releases) ![PHP Version](https://img.shields.io/packagist/php-v/userfrosting/userfrosting.svg?color=brightgreen) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md) -[![Join the chat at https://chat.userfrosting.com/channel/support](https://demo.rocket.chat/images/join-chat.svg)](https://chat.userfrosting.com/channel/support) +[![Join the chat at https://chat.userfrosting.com/channel/support](https://chat.userfrosting.com/api/v1/shield.svg?name=UserFrosting)](https://chat.userfrosting.com/channel/support) [![Backers on Open Collective](https://opencollective.com/userfrosting/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/userfrosting/sponsors/badge.svg)](#sponsors) [![Donate](https://img.shields.io/badge/Open%20Collective-Donate-blue.svg)](https://opencollective.com/userfrosting#backer) | Branch | Version | Build | Coverage | Style | | ------ |:-------:|:-----:|:--------:|:-----:| -| [master] | ![](https://img.shields.io/github/release/userfrosting/userfrosting.svg?color=success&label=Version) | [![](https://travis-ci.org/userfrosting/UserFrosting.svg?branch=master)][UF-Travis] | [![](https://codecov.io/gh/userfrosting/userfrosting/branch/master/graph/badge.svg)][UF-Codecov] | [![][style-master]][style] | -| [hotfix] | ![](https://img.shields.io/badge/Version-v4.4.x-yellow.svg) | [![](https://travis-ci.org/userfrosting/UserFrosting.svg?branch=hotfix)][UF-Travis] | [![](https://codecov.io/gh/userfrosting/userfrosting/branch/hotfix/graph/badge.svg)][UF-Codecov] | [![][style-hotfix]][style] | -| [develop] | ![](https://img.shields.io/badge/Version-v4.5.x-orange.svg) | [![](https://travis-ci.org/userfrosting/UserFrosting.svg?branch=develop)][UF-Travis] | [![](https://codecov.io/gh/userfrosting/userfrosting/branch/develop/graph/badge.svg)][UF-Codecov] | [![][style-develop]][style] | +| [master] | ![](https://img.shields.io/github/release/userfrosting/userfrosting.svg?color=success&label=Version) | [![](https://github.com/userfrosting/userfrosting/workflows/Build/badge.svg?branch=master)][UF-Build] | [![](https://codecov.io/gh/userfrosting/userfrosting/branch/master/graph/badge.svg)][UF-Codecov] | [![][style-master]][style] | +| [hotfix] | ![](https://img.shields.io/badge/Version-v4.4.x-yellow.svg) | [![](https://github.com/userfrosting/userfrosting/workflows/Build/badge.svg?branch=hotfix)][UF-Build] | [![](https://codecov.io/gh/userfrosting/userfrosting/branch/hotfix/graph/badge.svg)][UF-Codecov] | [![][style-hotfix]][style] | +| [develop] | ![](https://img.shields.io/badge/Version-v4.5.x-orange.svg) | [![](https://github.com/userfrosting/userfrosting/workflows/Build/badge.svg?branch=develop)][UF-Build] | [![](https://codecov.io/gh/userfrosting/userfrosting/branch/develop/graph/badge.svg)][UF-Codecov] | [![][style-develop]][style] | [master]: https://github.com/userfrosting/UserFrosting [hotfix]: https://github.com/userfrosting/UserFrosting/tree/hotfix [develop]: https://github.com/userfrosting/UserFrosting/tree/develop -[UF-Travis]: https://travis-ci.org/userfrosting/UserFrosting +[UF-Build]: https://github.com/userfrosting/userfrosting/actions?query=workflow%3ABuild [UF-Codecov]: https://codecov.io/gh/userfrosting/userfrosting [style-master]: https://github.styleci.io/repos/18148206/shield?branch=master&style=flat [style-hotfix]: https://github.styleci.io/repos/18148206/shield?branch=hotfix&style=flat diff --git a/app/defines.php b/app/defines.php index cbd11bdea..778df9d38 100755 --- a/app/defines.php +++ b/app/defines.php @@ -11,7 +11,7 @@ namespace UserFrosting; // Some standard defines -define('UserFrosting\VERSION', '4.4.4'); +define('UserFrosting\VERSION', '4.4.5'); define('UserFrosting\DS', '/'); define('UserFrosting\PHP_MIN_VERSION', '7.1'); define('UserFrosting\PHP_RECOMMENDED_VERSION', '7.3'); diff --git a/app/sprinkles/core/templates/pages/abstract/error.html.twig b/app/sprinkles/core/templates/pages/abstract/error.html.twig index a6da90c60..568ff3046 100644 --- a/app/sprinkles/core/templates/pages/abstract/error.html.twig +++ b/app/sprinkles/core/templates/pages/abstract/error.html.twig @@ -9,7 +9,7 @@
-
+
{% block headline %}

{% endblock %}
@@ -29,4 +29,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/sprinkles/core/tests/Integration/Filesystem/FilesystemTest.php b/app/sprinkles/core/tests/Integration/Filesystem/FilesystemTest.php index bc51a38fd..481d49a21 100644 --- a/app/sprinkles/core/tests/Integration/Filesystem/FilesystemTest.php +++ b/app/sprinkles/core/tests/Integration/Filesystem/FilesystemTest.php @@ -134,19 +134,23 @@ public function testNonExistingAdapter() /** * @depends testNonExistingAdapter + * @see https://github.com/thephpleague/flysystem/blob/13352d2303b67ecfc1306ef1fdb507df1a0fc79f/src/Adapter/Local.php#L47 */ public function testAddingAdapter() { $filesystemManager = $this->ci->filesystem; $filesystemManager->extend('localTest', function ($configService, $config) { - return new Filesystem(new LocalAdapter($config['root'])); + $adapter = new LocalAdapter($config['root']); + + return new Filesystem($adapter); }); $disk = $filesystemManager->disk('testingDriver'); $this->assertInstanceOf(FilesystemAdapter::class, $disk); // Make sure the path was set correctly - $this->assertEquals(\UserFrosting\STORAGE_DIR . \UserFrosting\DS . 'testingDriver' . \UserFrosting\DS, $disk->path('')); + $path = $disk->path(''); + $this->assertEquals(\UserFrosting\STORAGE_DIR . \UserFrosting\DS . 'testingDriver' . DIRECTORY_SEPARATOR, $path); } } diff --git a/app/sprinkles/core/tests/Integration/I18n/SiteLocaleTest.php b/app/sprinkles/core/tests/Integration/I18n/SiteLocaleTest.php index 15746ea7e..046fde7c7 100644 --- a/app/sprinkles/core/tests/Integration/I18n/SiteLocaleTest.php +++ b/app/sprinkles/core/tests/Integration/I18n/SiteLocaleTest.php @@ -15,6 +15,7 @@ use UserFrosting\I18n\Locale; use UserFrosting\Sprinkle\Core\I18n\SiteLocale; use UserFrosting\Tests\TestCase; +use UserFrosting\UniformResourceLocator\ResourceLocator; /** * SiteLocaleTest class. @@ -86,11 +87,9 @@ public function testgetAvailable(): void */ public function testgetAvailableOptions(): void { - // Implement fake locale file location - - /** @var \UserFrosting\UniformResourceLocator\ResourceLocator $locator */ - $locator = $this->ci->locator; - $locator->removeStream('locale')->registerStream('locale', '', __DIR__ . '/data', true); + // Implement fake locale file location & locator + $locator = new ResourceLocator(__DIR__); + $locator->registerStream('locale', '', 'data', true); // Set expectations. Note the sort applied here $expected = [ @@ -98,7 +97,9 @@ public function testgetAvailableOptions(): void 'fr_FR' => 'Tomato', // Just to be sure the fake locale are loaded ;) ]; - $options = $this->ci->locale->getAvailableOptions(); + /** @var \UserFrosting\Sprinkle\Core\I18n\SiteLocale */ + $locale = $this->ci->locale; + $options = $locale->getAvailableOptions(); $this->assertIsArray($options); $this->assertSame($expected, $options); diff --git a/build/before_install.sh b/build/before_install.sh deleted file mode 100644 index 637b54eac..000000000 --- a/build/before_install.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# -# Inspired by ownCloud´s before_install.sh script <3 -# - -WORKDIR=$PWD -DB=$1 - -echo "Work directory: $WORKDIR" -echo "Database: $DB" - -# -# set up mysql -# -if [ "$DB" == "mysql" ] ; then - echo "Setting up mysql ..." - mysql -u root -e "CREATE DATABASE userfrosting;" - mysql -u root -e "GRANT ALL ON userfrosting.* TO 'travis'@'localhost';" - printf "UF_MODE=\"debug\"\nDB_DRIVER=\"mysql\"\nDB_HOST=\"localhost\"\nDB_PORT=\"3306\"\nDB_NAME=\"userfrosting\"\nDB_USER=\"travis\"\nDB_PASSWORD=\"\"\nTEST_DB=\"default\"\n" > app/.env -fi - -# -# set up pgsql -# -if [ "$DB" == "pgsql" ] ; then - echo "Setting up pgsql ..." - psql -c "CREATE DATABASE userfrosting;" -U postgres - psql -c "GRANT ALL PRIVILEGES ON DATABASE userfrosting TO postgres;" -U postgres - printf "UF_MODE=\"debug\"\nDB_DRIVER=\"pgsql\"\nDB_HOST=\"localhost\"\nDB_PORT=\"5432\"\nDB_NAME=\"userfrosting\"\nDB_USER=\"postgres\"\nDB_PASSWORD=\"\"\nTEST_DB=\"default\"\n" > app/.env -fi - -# -# set up sqlite -# -if [ "$DB" == "sqlite" ] ; then - echo "Setting up sqlite ..." - touch userfrosting.db - printf "UF_MODE=\"debug\"\nDB_DRIVER=\"sqlite\"\nDB_HOST=127.0.0.1\nDB_NAME=\"userfrosting.db\"\nTEST_DB=\"default\"\n" > app/.env -fi - -# -# set up memory -# Need to setup MySQL for the debug part -# -if [ "$DB" == "memory" ] ; then - echo "Setting up in memory sqlite ..." - mysql -u root -e "CREATE DATABASE userfrosting;" - mysql -u root -e "GRANT ALL ON userfrosting.* TO 'travis'@'localhost';" - printf "UF_MODE=\"debug\"\nDB_DRIVER=\"mysql\"\nDB_HOST=\"localhost\"\nDB_PORT=\"3306\"\nDB_NAME=\"userfrosting\"\nDB_USER=\"travis\"\nDB_PASSWORD=\"\"\n" > app/.env -fi diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile index 5c61b9ea1..0f8d92b40 100644 --- a/docker/app/Dockerfile +++ b/docker/app/Dockerfile @@ -25,6 +25,8 @@ RUN apt-get install -y \ # COMPOSER INSTALL RUN curl -sSfo /tmp/composer.phar https://getcomposer.org/installer RUN php /tmp/composer.phar --install-dir=/usr/local/bin --filename=composer +# Force Composer Stable Version 1 +RUN composer selfupdate --1 # Install and configure PHP extensions RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ diff --git a/vagrant/README.md b/vagrant/README.md index 8d7a81ede..1ab888454 100644 --- a/vagrant/README.md +++ b/vagrant/README.md @@ -2,7 +2,7 @@ UserFrosting includes support for Vagrant. This allows you to run UserFrosting without the need to set up your own local web server with traditional WAMP/MAMP stacks. It also provides a consistent environment between developers for writing and debugging code changes more productively. -UserFrosting uses the [Laravel/Homestead](https://laravel.com/docs/5.6/homestead) Vagrant box. It runs a Linux server with Ubuntu 16.04, PHP 7.1, Nginx, SQLite3, MySQL, and a whole lot more (complete specs below). +UserFrosting uses the [Laravel/Homestead](https://laravel.com/docs/8.x/homestead) Vagrant box. It runs a Linux server with Ubuntu 16.04, PHP 7.4, Nginx, SQLite, MySQL, and a whole lot more (complete specs below). ## Get Started @@ -12,7 +12,7 @@ UserFrosting uses the [Laravel/Homestead](https://laravel.com/docs/5.6/homestead * Clone Homestead from the root of your cloned fork of the UserFrosting Git repository ```sh -git clone https://github.com/laravel/homestead.git vagrant/Homestead +git clone https://github.com/laravel/homestead.git vagrant/Homestead -b 20.04 ``` * Run `vagrant up` from the root of your cloned fork of the UserFrosting Git repository @@ -21,10 +21,35 @@ git clone https://github.com/laravel/homestead.git vagrant/Homestead $ vagrant up ``` -* Access UserFrosting at `http://192.168.10.10/` +Once finished, you must update your computer's hosts file. This file is typically located at `/etc/hosts` for MacOS/Linux or `C:\Windows\System32\drivers\etc\hosts` for Windows. Open this file and add the following line to it, at the very bottom, and save. + +``` +192.168.10.10 userfrosting.test +``` + +* Access UserFrosting at `http://userfrosting.test/` * Username: **admin** * Password: **adminadmin12** +## Troubleshoot + +On MacOS, if you experience error related to `failed to open stream: No such file or directory`, open `vagrant/bootstrap.yaml`, find this : + +``` + - map: . + to: /home/vagrant/userfrosting +``` + +and replace with : + +``` + - map: . + to: /home/vagrant/userfrosting + type: "nfs" +``` + +Reload the VM using `vagrant reload --provision` + ## Additional commands: * Access your Linux server from the command line: @@ -56,12 +81,6 @@ $ vagrant destroy By default, UserFrosting is pre-configured to install with a MySQL database. You can, however, switch to PostegreSQL or SQLite3 by editing the `install-config.yml` file in the vagrant directory. The next time you run `vagrant up` (or `vagrant provision`) it will be installed under the new configuration. -If you prefer to access UserFrosting from the more friendly URL `http://userfrosting.test` then you must update your computer's hosts file. This file is typically located at `/etc/hosts` for Mac/Linux or `C:\Windows\System32\drivers\etc\hosts` for Windows. Open this file and add the following line to it, at the very bottom, and save. - -``` -192.168.10.10 userfrosting.test -``` - ## How it all works When you vagrant up, the Laravel/Homestead box is transparently loaded as a Virtual Machine on your computer (this may take several minutes the very first time while it downloads the VM image to your computer). Your local UserFrosting repository clone is mirrored/shared with the VM, so you can work on the UserFrosting code on your computer, and see the changes immediately when you browse to UserFrosting at the URL provided by the VM. @@ -98,10 +117,9 @@ $ mysql -uhomestead -psecret UserFrosting < /home/vagrant/userfrosting/userfrost ### Included Software -* Ubuntu 16.04 +* Ubuntu 20.04 * Git -* PHP 7.1 -* HHVM +* PHP 7.4 * Nginx * MySQL * Sqlite3 diff --git a/vagrant/after.sh b/vagrant/after.sh index 4be3d9800..0c077e6df 100644 --- a/vagrant/after.sh +++ b/vagrant/after.sh @@ -2,21 +2,31 @@ BASE_PATH="/home/vagrant/userfrosting" +# Welcome message +echo "\n\n" +echo " *****************************\n" +echo " * Welcome to UserFrosting ! *\n" +echo " *****************************\n" + # Update nodejs +echo "\n\n >> Updating npm\n" npm cache clean -f npm install -g n n -q lts # Ensure composer deps are installed +echo "\n\n >> Installating Composer\n" cd ${BASE_PATH} +composer self-update --1 composer install # Setup .env +echo "\n\n >> Setting up Sprinkles\n" echo 'UF_MODE=""' > app/.env echo 'DB_DRIVER="mysql"' >> app/.env echo 'DB_HOST="localhost"' >> app/.env echo 'DB_PORT="3306"' >> app/.env -echo 'DB_NAME="UserFrosting"' >> app/.env +echo 'DB_NAME="homestead"' >> app/.env echo 'DB_USER="homestead"' >> app/.env echo 'DB_PASSWORD="secret"' >> app/.env echo 'SMTP_HOST="host.example.com"' >> app/.env @@ -27,9 +37,10 @@ echo 'SMTP_PASSWORD="password"' >> app/.env cp app/sprinkles.example.json app/sprinkles.json # Install UserFrosting +echo "\n\n >> UserFrosting installation\n" php bakery debug php bakery migrate php bakery create-admin --username="admin" --email="admin@userfrosting.test" --password="adminadmin12" --firstName="Admin" --lastName="istrator" php bakery build-assets -echo "\n\nUserFrosting is ready at http://192.168.10.10/" +echo "\n\nUserFrosting should be ready at http://userfrosting.test (Don't forget to update your hosts file !)" diff --git a/vagrant/bootstrap.yaml b/vagrant/bootstrap.yaml index 49fd4f547..76165dd0a 100644 --- a/vagrant/bootstrap.yaml +++ b/vagrant/bootstrap.yaml @@ -18,8 +18,7 @@ folders: sites: - map: userfrosting.test to: /home/vagrant/userfrosting/public + php: "7.4" - map: phpmyadmin.test to: /usr/share/phpmyadmin - -databases: - - UserFrosting + php: "7.4"