Normal Run

Learn how to run DocKing locally on your machine

Prerequisites

Check out the Requirement page.

Installation Steps

Step 1

Clone DocKing or download the stable release (.zip file)

Step 2

Install dependencies:

composer install
npm ci

Step 3

Copy the .env.example to .env and configure it.

Reference: Environment Variables

Step 4

Run several commands to setup the project:

php artisan key:generate
php artisan migrate
php artisan optimize
php artisan storage:link
npm run build 

Run DocKing

There are several ways to run, check this out:

PHP Dev Server

A convenient way to run a whole project in a single command for development:

php artisan serve

Then visit: http://127.0.0.1:8000, you should see a welcome page.

PHP-FPM & Nginx/Apache

With this, you can visit DocKing every time you run apache/nginx.

You'll need a PHP-FPM vhost configuration.

Apache (2.4)

docking.conf

<VirtualHost *:80>
    ServerName localhost
    ServerAlias localhost
    DocumentRoot /<path-to-docking>/public

    <Directory /<path-to-docking>/public>
        AllowOverride All
    </Directory>

    <FilesMatch \.php$>
        SetHandler "proxy:unix:/var/run/php/php8.2-fpm.sock|fcgi://localhost/"
    </FilesMatch>

    ErrorLog ${APACHE_LOG_DIR}/laravel_error.log
    CustomLog ${APACHE_LOG_DIR}/laravel_access.log combined
</VirtualHost>

Nginx

docking.conf

server {
    listen 80;
    server_name localhost;
    root /<path-to-docking>/public;

    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    }

    location /storage {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
    }
}

Run DocKing's Queue Worker

For "async" mode, the jobs will be pushed to database , in order to let the jobs render, you need to run Laravel Worker.

Development Run

php artisan queue:work

Production Run

Install supervisor and use this configuration

[program:docking-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /<path-to-your-folder>/artisan queue:work --sleep=3 --tries=1 --timeout=120
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=laravel # you can change to your user here
numprocs=5
redirect_stderr=true
stdout_logfile=/var/log/docking-worker.log
stopwaitsecs=3600

Note: you can change the numprocs if you are going to deploy DocKing on a strong server.

Then, run these commands and supervisor will start the work

sudo supervisorctl reread
 
sudo supervisorctl update
 
sudo supervisorctl start docking-worker:*

Learn more: https://laravel.com/docs/10.x/queues#installing-supervisor

Lastly

Happy rocking!

Last updated