I wouldn't recommend using this code unless if you really know what you're doing.
- Get a webserver (Apache or NGINX) with PHP and MariaDB or MySQL up and running, including Composer and the PHP GD library extension.
- Configure your webserver. Look below the steps for an example.
- Run
composer update
from the terminal. - Copy
config.sample.php
inprivate/config
, rename it toconfig.php
and fill in your database credentials. - Import the database template found in
sql/
into the database you want to use. - Run the
compile-scss
script available in the tools directory to generate the required stylesheets. You may find Dart-Sass here at https://sass-lang.com/install. Ruby Sass is deprecated, do not use it. You MUST use a specific Dart-Sass, or it won't work. You can find it here.
- Use Linux for anything related to production.
- Instead of installing dependencies using
composer update
you docomposer update --no-dev
- Make the
dynamic/
andtemplates/cache/
directories writable by your web server. - Modify branding settings to replace the default OpenSB branding with your custom branding. Check the
public/assets/placeholder
directory for reference.
- Enable debugging features by setting
mode
toDEV
. - If you want to be able to upload during development, make the
dynamic/
directory and the directories inside it writable by your web server.
If you are trying to setup an instance of OpenSB on a Linux installation with SELinux enabled (eg: Fedora installs by default). There may be some issues.
Run these commands as root or through an utility like sudo (replace /var/www/opensb
with the location of your instance):
setsebool -P httpd_can_network_connect on
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/opensb/dynamic(/.*)?"
restorecon -Rv /var/www/opensb/dynamic
You will have to modify the directories to match your instance's location.
<VirtualHost *>
ServerName localhost
DocumentRoot "/var/www/opensb/public"
Alias /dynamic "/var/www/opensb/dynamic"
<Directory "/var/www/opensb/">
Options Indexes FollowSymLinks
Require all granted
AllowOverride All
</Directory>
</VirtualHost>
Please note that this example uses php-fpm
.
You will have to modify the directories to match your instance's location.
server {
listen 80;
server_name localhost;
root /var/www/opensb/public/;
location / {
try_files $uri /index.php$is_args$args;
}
location /dynamic/ {
root /var/www/opensb/dynamic/;
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}