Skip to content

bluffingo/OpenSB

Repository files navigation

OpenSB

Screen Shot 2024-09-25 at 14 37 34

MAJOR REFACTOR IN PROGRESS. USE legacy-orange BRANCH FOR THE TIME BEING

Our official instance

SquareBracket.me

Alternative domains (not recommended): SquareBracket.pw, FulpTube.rocks

How to setup an OpenSB instance.

I wouldn't recommend using this code unless if you really know what you're doing.

  1. Get a webserver (Apache or NGINX) with PHP and MariaDB (MySQL may work but it is untested) up and running, including Composer and the PHP GD library extension. We recommend Apache, as you will experience issues with NGINX.
  2. Configure your webserver. Look below the steps for an example.
  3. Run composer update from the terminal.
  4. Copy config.sample.php in private/config, rename it to config.php and fill in your database credentials.
  5. Import the database template found in sql/ into the database you want to use.
  6. 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.

Production specific

  1. Use Linux for anything related to production.
  2. Instead of installing dependencies using composer update you do composer update --no-dev
  3. Make the dynamic/ and templates/cache/ directories writable by your web server.
  4. Modify branding settings to replace the default OpenSB branding with your custom branding. Check the public/assets/placeholder directory for reference.

Development specific

  1. Enable debugging features by setting $isDebug to true.
  2. If you want to be able to upload during development, make the dynamic/ directory and the directories inside it writable by your web server.

Apache's Virtual host example

You will have to modify the directories to match your instance's location.

<VirtualHost *> 
    ServerName localhost
    DocumentRoot "C:/xampp/openSB/public"

    Alias /dynamic "C:/xampp/openSB/dynamic"

    <Directory "C:/xampp/openSB">
        Options Indexes FollowSymLinks
        Require all granted
        AllowOverride All
    </Directory>
</VirtualHost>

NGINX's config example

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  www.squarebracket.pw
    server_name  squarebracket.pw;

    root   /var/www/squarebracket/public/;

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location /dynamic/ {
        root /var/www/squarebracket/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;
    }
}