Native Installation
This document will guide you through a native installation of Cyca.
Requirements
- php 7.4 FPM and additional extensions:
- bcmath
- curl
- exif
- gd
- imagick
- intl
- mbstring
- pcntl
- pdo
- redis
- xml
- composer
- Database server:
- MySQL or MariaDB, SQLServer, PostgreSQL or SQLite
- matching php extension
- Web server
- Redis server (optionnal)
- git (optionnal, used to get Cyca)
- A process manager to run the queues and websocket (Systemd or Supervisor)
Depending on your operating system and php distribution, most of php extensions should be available out-of-the-box. Exceptions are imagick, PDO extension matching the database server you choose and redis, which need separate installation.
If you want to contribute to Cyca with frontend content (javascript or themes), you will also need nodejs. Cyca is built using the LTS version of nodejs.
Installation
Cyca files
Download a copy of Cyca, either using latest archive or git.
- Download archive
- Or clone the repository:
git clone https://git.athaliasoft.com/richard/cyca.git /var/www/cyca
Ensure the web server owns Cyca’s files:
chown -R www-data:www-data /var/www/cyca
Install dependencies
cd /var/www/cyca
composer update
If you installed nodejs for contributing to Cyca with frontend content, install nodejs dependencies:
npm i
Create a configuration file
Copy the .env.example file to .env and generate an application key:
cp .env.example .env
php artisan key:generate
Modify this file according to your needs. Every option is documented, some require change, some could be changed, and some shouldn’t need to be changed.
Most important variable is APP_KEY, which will be used for cryptographic purposes (like password hashing), so it’s very important to generate a proper key using the command above.
Then, set Cyca’s URL, and adjust database and email settings.
You will need to change the following variables, as their current values are set for a docker installation:
- DB_HOST
- REDIS_HOST
- PUSHER_HOST
You can set them both to localhost if you plan on running the database server, redis server and the websockets server on the same host, otherwise set them to the host name these servers will run on.
Create and populate database
Database specified in the configuration file must already exist. Please check your database server’s documentation to learn how to create the database before running commands below.
Once database is ready, run the migrations:
php artisan migrate
Configure web server
Cyca is developed using nginx as a web server, so a reliable configuration for this web server is provided. If running another web server, you will need to adapt your configuration.
There is an example configuration file in the resources/examples folder.
Create a virtual host in your nginx configuration:
server {
listen 80;
# Replace with the FQDN you will actually use to connect to Cyca
server_name localhost;
# nginx must serve files in Cyca's "public" directory
root /var/www/cyca/public;
index index.html index.htm index.php;
charset utf-8;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log stderr error;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Change this path to Cyca's actual "public" path
location /var/www/cyca/public/ {
# Change this host if you don't host the websockets server on the same
# computer
proxy_pass http://localhost:6001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location ~ \.php$ {
fastcgi_pass localhost:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
}
Queues and websockets
You will need a process monitor, such as Supervisor or Systemd, to run the queue server and the websocket server. You will find sample configuration files for the Supervisor daemon in the examples/supervisor
directory for both processes. Be sure to edit them before you copy them in the /etc/supervisor.d/conf
directory, especially the paths to Cyca’s directory.
Once your configuration is ready, you can launch the processes:
supervisorctl reread
supervisorctl update
supervisorctl start cyca_queue:*
supervisorctl start cyca_websocket
Check your logs in the storage/logs directory for any error that could have been thrown.
Scheduled tasks
Cyca needs to run tasks at regular interval. To do this, add a cron entry to the www-data user.
crontab -u www-data -e
* * * * * cd /var/www/cyca && php artisan schedule:run >> /dev/null 2>&1
As usual, replace /var/www/cyca with the real directory where you put Cyca into.
Register
You should now be able to browse to Cyca and register your first user !