3dmaksik/chel-region-helpdesk

Laravel Chel 项目


README

关于项目

该系统是一个简单的为地方政府提供的帮助台。主要目的是组织用户向IT服务提交的申请,但也可以用于内部工作。项目功能(本节将在开发功能时逐步完善)

  • 可以以注册或未注册的方式提交申请,并可以附加截图;
  • 可以设置四个处理状态的申请;
  • 管理员可以设置优先级,以区分重要申请和次要申请;
  • 可以创建申请类别,定义员工办公室,以便指定精确位置;
  • 推送新申请、即将到期的警告和逾期申请的通知;
  • 简单的新闻流通知用户。

要求

  • Astra Linux 1.8+ 或其他俄罗斯操作系统,或者任何当前 Linux 操作系统;
  • PHP 8.1-8.3 并带有 fileinfo 扩展,以及通常默认包含的所有标准扩展:[pgsql, sqlite3, gd, imagick, curl, imap, mysql, mbstring, xml, zip, bcmath, soap, intl, readline, ldap, msgpack, igbinary, redis, pcov]
  • 可选择的数据库:MYSQL 8.0+/MariaDB 10.8+、PostgreSQL 14+;
  • 服务器 Ngnix 1.23+,不推荐使用 Apache;
  • 可选择的缓存:Memcashed 1.6+、Redis 7.0 或不使用;
  • Composer、Node、NPM、git。

安装准备

创建工作目录,例如/var/www/html,并将服务器指向public子目录。以下是 Ngnix 服务器重定向配置示例。在文件/etc/nginx/nginx.conf中进行更改。

    server {
    listen 80;
    server_name server_domain_or_IP;
    root /var/www/html/chel-region-helpdesk/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

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

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.*-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
           }

如果使用 Apache(不推荐),在根目录 /var/www/html/chel-region-helpdesk/ 中创建一个名为 .htaccess 的文件,内容大致如下。

Options +FollowSymLinks
RewriteEngine On
#RewriteCond %{HTTPS} =off
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /public/$1 [L]
RewriteRule ^ index.php [L]

如果服务器允许,则更安全地通过VirtualHost进行设置

$ sudo nano /etc/apache2/sites-available/helpdesk.conf

<VirtualHost *:80>
 ServerAdmin admin@example.com
 ServerName mydomain.com
 DocumentRoot /var/www/html/chel-region-helpdesk/public
   <Directory /var/www/html/chel-region-helpdesk>
     Options Indexes MultiViews
     AllowOverride None
     Require all granted
   </Directory>
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

后续启动
$ sudo a2enmod rewrite
$ sudo a2ensite helpdesk.conf

之后,需要重启任何服务器。

安装

  1. 将项目复制到服务器上之前创建的目录中

$ cd /var/www/html $ git clone https://github.com/3dmaksik/chel-region-helpdesk.git

  1. 安装项目和库 $ composer install --no-dev && npm install && npm run prod

  2. 设置文件夹权限,与服务器用户相同

$ sudo chgrp -R www-data ./storage ./bootstrap/cache

$ sudo chmod -R ug+rwx ./storage ./bootstrap/cache

  1. 创建文件夹和符号链接以上传文件

$ mkdir storage/images && mkdir storage/avatar && mkdir storage/sound
$ sudo php artisan storage:link

  1. 复制配置文件

$ cp .env.example .env && cp config/settings.php.example config/settings.php

  1. 生成项目密钥 $ php artisan key:generate
  2. 在文件 .env 中填写所有空白字段。
  3. 安装数据库 $ php artisan migrate:fresh --seed
  4. 在文件 config/settings.php 中按需编辑设置。
  5. 使用守护进程设置套接字、计划任务和任务

$ sudo apt install supervisor
$ sudo npm install -g @soketi/soketi
$ sudo systemctl enable supervisor
$ sudo nano /etc/supervisor/conf.d/soketi.conf

[program:soketi]
command=soketi start --config=/srv/example.com/soketi.json
numprocs=1
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
stopwaitsecs=60
stopsignal=sigint
minfds=10240
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0
user=example_user

$ sudo nano /etc/supervisor/conf.d/schedule.conf

[program:schedule]
command=/usr/bin/php /srv/example.com/artisan schedule:work
numprocs=1
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
stopwaitsecs=60
stopsignal=sigint
minfds=10240
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0
user=example_user

$ sudo nano /etc/supervisor/conf.d/queue.conf

[program:queue]
command=/usr/bin/php /srv/example.com/artisan queue:work
numprocs=1
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
stopwaitsecs=60
stopsignal=sigint
minfds=10240
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0
user=example_user

$ sudo supervisorctl update

之后项目即可投入使用。

更新

  1. 更新项目 $ git pull origin master && sudo supervisorctl update
  2. 更新工作库 $ composer update && npm update && npm run prod
  3. 如果对文件 settings.php 进行了任何修改,需要从文件 settings.php.example 复制或更改缺失的变量,相关信息将在发布时告知。
  4. 如果数据库有任何更改,需要执行 $ php artisan migrate

使用 Docker 运行项目

  1. 如果尚未安装 Docker,请安装它(在表中点击您的系统)(安装说明)
  2. 为了安装项目,需要以非 root 用户运行脚本(需要 wget 和 ID 为 1000 的用户,通常是在安装操作系统时创建的用户)$ wget https://raw.githubusercontent.com/3dmaksik/chel-region-helpdesk/master/build/project/install.sh && sudo chmod +x install.sh && ./install.sh
  3. .env 文件中,请在 APP_URL 行中指定使用的 IP 地址或域名。
  4. 为了更新项目,需要运行脚本,如果之前下载过,请先删除旧的文件:$ wget https://raw.githubusercontent.com/3dmaksik/chel-region-helpdesk/master/build/project/update.sh && sudo chmod +x update.sh && ./update.sh
  5. 您还可以将脚本保存到单独的文件中,而不需要下载。
  6. 如果在第一次安装或更新时出现错误,首先需要重新运行最后选择的脚本。工作将继续从错误点开始。

问题和建议

对于发现的任何错误和建议,请在这里撰写。

使用的库、关联库、字体的许可证。

  1. Laravel- MIT
  2. Permission- MIT
  3. Pusher- MIT
  4. Websockets- GNU
  5. Boostrap- MIT
  6. JQuery- MIT
  7. RuangAdmin- MIT
  8. eStartup- CC
  9. Fancybox- GPLv3
  10. FontAwesome- CC BY 4.0, SIL OFL 1.1, MIT
  11. Select2- MIT
  12. Nunito Font- OFL

结束