| Version | Date | Notes | By |
|---|---|---|---|
| 0.1 | 2025-07-01 | Initial release | BRB |
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get install apache2 php8.4 libapache2-mod-php8.4
sudo apt install php8.4-fpm php8.4-cli php8.4-curl php8.4-dev php8.4-mysql php8.4-ldap php8.4-xml php8.4-curl php8.4-gd php8.4-zip php8.4-mbstring php8.4-soap php8.4-fileinfo php8.4-sqlite3 php8.4-intl php8.4-bcmath php8.4-redis php8.4-imagick
sudo a2enmod actions proxy_fcgi setenvif ssl
sudo a2enconf php8.4-fpm
sudo apt install redis
From gitlab, it is recommended to clone using ssh connection rather than http, since ssh means you won't have to authenticate everytime you pull modules
git clone ssh:link-to-backend-core wemake-sgi-backend
cd wemake-sgi-backend
cd modules
Do this to capitalize the names immediately:
git clone ssh:module_name ModuleName
Example: git clonse ssh:audits-link RiskAssessments
This is for git to ignore some unimportant files
git config core.fileMode false
Copy .env.example and change values in file .env (include the web links to access laravel logs)
composer install (if need satis and you don't know, ask for password)
php artisan key:generate
php artisan jwt:secret
This is what defines which modules you're using:
MODULE_LOADER_INCLUDED_MODULES=audits,documents,ems,equipments,meetings,occupational-health,occurrences,ohs,plans,processes,processes-engine,projects,reporting-channel,risk,risk-assessments,statement-of-applicability,suppliers,surveys,training
When you have every module installed and a new app key, you can run the migrations:
php artisan migrate
Permissions:
sudo chown -R your-username:www-data bootstrap/cache/ storage/
sudo chmod 775 -R bootstrap/cache/ storage/
IDE Helper:
php artisan ide-helper:generate (this is to help IDE with issue detection and stuff)
Install Laravel echo server:
sudo npm install -g laravel-echo-server
Go to backend folder and run:
cp laravel-echo-server.example.json laravel-echo-server.json
Change the values of laravel-echo-server.json:
{
"appKey": "47r1i66li4cn9anb4pocpb9h6eb5fc7d35f5lhs363gho1kmqcqf2tred6p2",
"authHost": "http://sgi-back.domain.com",
"authEndpoint": "/broadcasting/auth",
"database": "redis",
"databaseConfig": {
"redis": {
"port": "6379",
"host": "127.0.0.1",
"options": {
"db": 1
}
},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": false,
"host": "sgi-back.domain.com",
"port": "6001",
"referrers": [
{
"host": "*",
"apiKey": "nrhmk8ic64lgnqbs6t794gpj6per33ho5q34j2mrgia61j8hf238rf0c014b"
}
],
"socketio": {
"cookie": "false"
},
"protocol": "http",
"sslCertPath": "",
"sslKeyPath": "",
"verifyAuthPath": true,
"verifyAuthServer": false
}
sudo apt-get install libxrender1 wget xfonts-75dpi fontconfig xfonts-base
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb
sudo dpkg -i wkhtmltox_0.12.6.1-3.jammy_amd64.deb
Check if it's correctly installed
wkhtmltopdf --version
Should output: wkhtmltoimage 0.12.6 (with patched qt)
Check where it got installed:
which wkhtmltopdf
which wkhtmltoimage
# In your .env, change these lines to the path you got:
WKHTML_PDF_BINARY="/usr/local/bin/wkhtmltopdf"
WKHTML_IMG_BINARY="/usr/local/bin/wkhtmltoimage"
git clone ssh:gitlab-link-to-frontend wemake-sgi-frontend
cd wemake-sgi-frontend
Copy .env.example and change values or get from somebody else in the DEV team. You have to create a token in your personal github for jspm to have public* access to repositories.
Install NodeJs and NPM using NVM:
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash \n
nvm install 16
Check NodeJs and NPM versions:
node --version
v16.20.2
npm --version
8.19.4
In frontend folder:
npm init
npm install -g gulp
npm install -g jspm@0.16.55
Check gulp and jspm versions
gulp --version
CLI version: 2.3.0
Local version: 4.0.2
jspm --version
0.16.55
If no problems with jspm version check:
jspm init
jspm install -y
# Fix some JSPM package issues
cd temp-fixes
bash fix.sh
Create the apache /etc/apache2/sites-available .conf files for backend and frontend:
cd /etc/apache2/sites-available
For the following configurations, you can use different domain names (ServerName).
Backend site:
nano wemake-sgi-backend.conf (Ctrl+X to save, ESC to close the editor after saving)
OR
vi wemake-sgi-backend.conf (press i to start writing in the file, ESC to stop editing, :wq! to save and close)
<VirtualHost *:80>
ServerName sgiv10-back.devel
DocumentRoot /home/username/devel/apps/wemake/sgi/wemake-sgi-backend/public
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.4-fpm.sock|fcgi://localhost"
</FilesMatch>
<Directory "/home/username/devel/apps/wemake/sgi/wemake-sgi-backend/public">
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/sgiv10-back.error.log
CustomLog ${APACHE_LOG_DIR}/sgiv10-back.access.log combined
</VirtualHost>
Frontend site:
nano wemake-sgi-frontend.conf
OU
vi wemake-sgi-frontend.conf
<Directory /home/username/devel/apps/wemake/sgi/wemake-sgi-frontend>
AllowOverride All
Require all granted
</Directory>
<VirtualHost sgiv10.devel:80>
ServerName sgiv10.devel
DocumentRoot /home/username/devel/apps/wemake/sgi/wemake-sgi-frontend
ErrorLog /var/log/sgi.domain.com/apache-logs/error.log
CustomLog /var/log/sgi.domain.com/apache-logs/access.log combined
</VirtualHost>
Enable the two sites:
sudo a2ensite wemake-sgi-backend.conf wemake-sgi-frontend.conf
sudo systemctl restart apache2
Add your backend and frontend domains to your /etc/hosts file.
127.0.0.1 sgiv10-back.devel sgiv10.devel
Because of Ubuntu 22 (and maybe Ubuntu 24), go to your home directory /home/ and run:
sudo chmod -R 755 your-username
You can just install MYSQL8, follow some internet instructions for installation for Ubuntu 24.
Enter into MySQL:
sudo mysql
In MySQL shell:
CREATE DATABASE db_name CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON db_name.* TO 'username'@'localhost';
In Dbeaver -> Edit localhost connection settings -> Local Client browse to usr/bin (it should contain a mysql file, just choose usr/bin and dbeaver will find it). This is important for when you try to import databases, for example.
Run this on all modules and backend/frontend:
git config core.fileMode false
Very important for git, otherwise all files are counted as changes
Pulling commits:
When you restore a new database, run this to quickly change passwords to "wemake"
DB::table('t00_users')->where('id','=', 1)->update(['password' => Hash::make('wemake')]);