Spinning up a Castopod Instance


  • Castopod Setup
  • oemb1905
  • gnulinux.news
  • webmaster@haacksnetworking.org

//castopod//


Latest Updates: https://wiki.haacksnetworking.org/doku.php?id=computing:castopod

This tutorial is for Debian users wanting to set up a production-ready Castopod instance. Make sure you have a [[https://wiki.haacksnetworking.org/doku.php?id=computing:apachesurvival|sufficiently hardened]] VPS and LAMP stack first, then proceed:

sudo apt install php-intl php8.4-mysql php-gd php-curl php-mbstring php-xml php-zip mailutils postfix
sudo a2enmod rewrite proxy_fcgi ssl headers
sudo mkdir -p /var/www/gnulinux.news/
cd /var/www/gnulinux.news/
sudo wget https://code.castopod.org/-/project/2/uploads/419c795a5ab306a27082b7d86aa43df6/castopod-1.15.5.zip
sudo unzip castopod-1.15.5.zip
sudo rm castopod-1.15.5.zip
sudo mv castopod public_html
sudo chown -R www-data:www-data /var/www/gnulinux.news/public_html
sudo chmod -R 755 /var/www/gnulinux.news/public_html
sudo chown -R www-data:www-data /var/www/gnulinux.news/public_html/writable
sudo chmod -R 775 /var/www/gnulinux.news/public_html/writable
sudo apache2ctl configtest
sudo systemctl restart apache2 php8.4-fpm

Make sure you set the /etc/postfix/main.cf interface to loopback-only. Now, set up the database by running sudo mysql -u root -p and entering something like:

CREATE DATABASE castop CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'Strong-Password';
GRANT ALL PRIVILEGES ON castop.* TO 'user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

You http vhost should look like:

<VirtualHost *:80>

        ServerName gnulinux.news
        ServerAdmin webmaster@haacksnetworking.org
        DocumentRoot /var/www/gnulinux.news/public_html/public

        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        #Include conf-available/serve-cgi-bin.conf
        <FilesMatch ".+\.ph(ar|p|tml)$">
                SetHandler "proxy:unix:/run/php/php8.4-fpm.sock|fcgi://localhost"
        </FilesMatch>

        RewriteEngine on
        RewriteCond %{SERVER_NAME} =gnulinux.news
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>

Your https vhost should look like:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName gnulinux.news
    DocumentRoot /var/www/gnulinux.news/public_html/public

    <Directory /var/www/gnulinux.news/public_html/public>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    <FilesMatch ".+\.ph(ar|p|tml)$">
        SetHandler "proxy:unix:/run/php/php8.4-fpm.sock|fcgi://localhost"
    </FilesMatch>

    SSLCertificateFile /etc/letsencrypt/live/gnulinux.news/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/gnulinux.news/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

Additionally, make sure you’ve allowed overrides in the global ”/etc/apache2/apache.conf” as well. We are now going to create the virtual environment:

cd /var/www/gnulinux.news/public_html
sudo cp .env.example .env
sudo chown www-data:www-data .env
sudo chmod 644 .env
sudo nano .env

In the ”.env” config, enter something like the following:

app.baseURL="https://gnulinux.news/"
media.baseURL="https://gnulinux.news/"
admin.gateway="cp-admin"
auth.gateway="cp-auth"
analytics.salt="64-character-salt"
database.default.hostname="localhost"
database.default.database="castopod"
database.default.username="cpuser"
database.default.password="Strong-Password"
database.default.DBPrefix="cp_"
email.fromEmail="noreply@gnulinux.news"
email.fromName="GNU/Linux News"
email.protocol="mail"

Regular cronjobs as follows:

#castopod spark
* * * * * /usr/bin/php /var/www/gnulinux.news/public_html/spark tasks:run >> /dev/null 2>&1
#casto cleanup
0 3 * * * find /var/www/gnulinux.news/public_html/writable/temp -type f -mtime +7 -delete >/dev/null 2>&1
0 3 * * * find /var/www/gnulinux.news/public_html/writable/session -type f -mtime +2 -delete >/dev/null 2>&1

Once you have configured everything, visit ”https://gnulinux.news/cp-install” and choose your super admin credentials. Alright folks, enjoy!

Thanks,
oemb1905

Leave a Reply

Your email address will not be published. Required fields are marked *

Close