Installation
Prerequisites
1. Please install locally:
- Node with NPM - we recommend you have the latest LTS version installed
- Grunt to make Alfred UI changes
- Composer - for PHP dependency management
2. To install and run Alfred project, you need also:
- Nginx or Apache
- PHP 8.0+
- MySQL 8.0 database (can be MariaDB)
If you want to use Docker to install those 3 components - please read the next section. If you use MacOS or Windows system and you do not want to use Docker (ya, it is so slow!), you should install them manually (for example using Homebrew on your Mac). If you are on Windows, you can install the oldschool XAMPP package or MAMP (recommended!) - it is fine to use it and contains PHP, Apache and MySQL (just make sure you choose the right version). You will have a lot of other useful tools too such as PHPMyAdmin where you can create and manage databases.
Docker
In the Alfred repository (see the link to it in the section below) there is the docker-compose.yml file and entire Nginx/PHP/MySQL configuration. You can just run docker-compose up and follow the installation steps below.
Installation
Plain Alfred code repository you can find here: https://bitbucket.org/snowflakers/alfred-v1/src/master/. Please follow the installation steps below.
Installation & running project without Docker
- Download all the code from repository (inc.
.gitignorefile, Docker configuration and so on) and paste it into root of your project. - Create a database (you can use PHPMyAdmin if you prefer) and import the
database.sqlfile. - In the
cms-backend/folder create the.envfile and paste the contents of.env.example. Enter the credentials, at least for the database connection and email sending. - Install the PHP dependencies, running
composer installand thenphp artisan key:generatein the terminal, from thecms-backend/location. - Run
php artisan serveand you should be able to see the project and start developing.
Installation & running project on Docker
- Download all the code from repository (inc.
.gitignorefile, Docker configuration and so on) and paste it into root of your project. - Create
.envfile in the root folder with the contents of/.env.exampleand set thePROJECT_NAMEand database settings (MYSQL_*). - In the
cms-backend/folder create the.envfile and paste the contents ofcms-backend/.env.example. Enter the credentials, at least for the database connection and email sending. - Run
docker-compose upfrom the root folder (you will see errors but do not worry about it for now - see next points). - Copy the database file (
database.sql) into database container* (docker cp database.sql DATABASE_CONTAINER_NAME:/) - Connect to the database container* (
docker exec -it DATABASE_CONTAINER_NAME bash); connect to MySQL service usingmysql -u MYSQL_USER -pand import the database file into selected database (source /database.sql). - Connect to Alfred container* (
docker exec -it ALFRED_CONTAINER_NAME bash) and install the PHP dependencies from there, runningcomposer install+php artisan key:generate. - Once the dependencies are installed, you should be able to open the project at
http://0.0.0.0:8000and start developing.
* if you do not know the container names, just run docker ps to find them out.
Other Code Repositories
Alfred Examples Library - this is the main repository you need. Lots of helpful examples how to implement common section types, how to creare microcomponent etc.
Please also see the list of available ready-to-use modules on Bitbucket. Copy the code of some needed module and paste into your project following the README files.
Extremely helpful repository you can also find here - https://bitbucket.org/snowflakers/alfred-microcomponents/src/master/. You can find there ready custom microcomponents that you can re-use and adjust to meet your project requirements.
Production deployment requirements
- Nginx (preferrable) or Apache
- PHP 8.0+
- MySQL 8.0 database (can be MariaDB)
Website document root should be set to cms-backend/public folder.
Useful information about setting up a production server to run Alfred project you can find here: https://bitbucket.org/snowflakers/server-nginx-configuration/src/master/. It is oriented to deployment to DigitalOcean but lots of configuration instructions can be helpful for you even if you decide to launch your project with totally different hosting provider.