Skip to content

Commit

Permalink
feat: new xboard
Browse files Browse the repository at this point in the history
  • Loading branch information
xboard committed Jan 21, 2025
1 parent 43d2fdd commit 1c6b51d
Show file tree
Hide file tree
Showing 293 changed files with 13,172 additions and 10,884 deletions.
5 changes: 0 additions & 5 deletions .docker/services/redis/Dockerfile

This file was deleted.

7 changes: 0 additions & 7 deletions .docker/services/redis/redis.conf

This file was deleted.

64 changes: 64 additions & 0 deletions .docker/supervisor/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[supervisord]
nodaemon=true
user=root
logfile=/dev/stdout
logfile_maxbytes=0
pidfil=/www/storage/logs/supervisor/supervisord.pid
loglevel=info

[program:octane]
process_name=%(program_name)s_%(process_num)02d
command=php /www/artisan octane:start --host=0.0.0.0 --port=7001
autostart=%(ENV_ENABLE_WEB)s
autorestart=true
user=www
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stdout_logfile_backups=0
numprocs=1
stopwaitsecs=10
stopsignal=QUIT
stopasgroup=true
killasgroup=true
priority=100

[program:horizon]
process_name=%(program_name)s_%(process_num)02d
command=php /www/artisan horizon
autostart=%(ENV_ENABLE_HORIZON)s
autorestart=true
user=www
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stdout_logfile_backups=0
numprocs=1
stopwaitsecs=3
stopsignal=SIGINT
stopasgroup=true
killasgroup=true
priority=200

[program:redis]
process_name=%(program_name)s_%(process_num)02d
command=redis-server --dir /data
--dbfilename dump.rdb
--save 900 1
--save 300 10
--save 60 10000
--unixsocket /data/redis.sock
--unixsocketperm 777
autostart=%(ENV_ENABLE_REDIS)s
autorestart=true
user=redis
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stdout_logfile_backups=0
numprocs=1
stopwaitsecs=3
stopsignal=TERM
stopasgroup=true
killasgroup=true
priority=300
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ docker-compose.yml
storage/laravels.conf
storage/laravels.pid
storage/laravels-timer-process.pid
/frontend
60 changes: 28 additions & 32 deletions .github/ISSUE_TEMPLATE/bug-report----问题反馈.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,39 @@
---
name: Bug report | 问题反馈
about: Tell us what problems you have encountered
title: "[BUG]"
labels: ''
name: 🐛 问题反馈 | Bug Report
about: 提交使用过程中遇到的问题 | Report an issue
title: "问题:"
labels: '🐛 bug'
assignees: ''

---

🙇‍♂️🙇‍♂️🙇‍♂️注意:XrayR等非XBoard问题请前往项目方提问
🙇‍♂️🙇‍♂️🙇‍♂️Note: XrayR and other non-XBoard issues please go to the project side to ask questions


The XBoard version number you are using
当前使用的XBoard版本号(git commit id)
--------

Would you like to deploy using Docker?
你的部署方式(是否为Docker)
--------


Please briefly describe the issue you encountered (preferably with reproducible steps).
简单描述你遇到的问题(最好带上复现步骤)
--------


<!-- 🔴 请注意:XrayR等非XBoard问题请前往相应项目提问 -->
<!-- 🔴 Note: For XrayR and other non-XBoard issues, please report to their respective projects -->

Screenshot of the reported error(Please do desensitization)
报告错误的截图(请做脱敏处理)
--------
> ⚠️ 请务必按照模板填写完整信息,没有详细描述的issue可能会被忽略或关闭
> ⚠️ Please follow the template to provide complete information, issues without detailed description may be ignored or closed
**基本信息 | Basic Info**
```yaml
XBoard版本 | Version:
部署方式 | Deployment: [Docker/手动部署]
PHP版本 | Version:
数据库 | Database:
```
**问题描述 | Description**
<!-- 简要描述你遇到的问题 -->
Screenshot of the reported error(Please do desensitization)
报告错误的截图(请做脱敏处理)
--------
**复现步骤 | Steps**
<!-- 如何复现这个问题? -->
1.
2.
**相关截图 | Screenshots**
<!-- 拖拽图片到这里(请注意隐藏敏感信息)-->
Run the php artisan log:export 7 command to export log files (where 7 represents logs for the last 7 days).
运行`php artisan log:export 7` 命令导出的日志文件(其中7为最近7天的日志)。
--------
**日志信息 | Logs**
<!-- storage/logs 目录下的日志 -->
```log
// 粘贴日志内容到这里
```
31 changes: 24 additions & 7 deletions .github/ISSUE_TEMPLATE/feature-request---功能请求.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
---
name: Feature request | 功能请求
about: Tell us what you need
title: "[Feature request]"
labels: ''
name: ✨ 功能请求 | Feature Request
about: 提交新功能建议或改进意见 | Suggest an idea
title: "建议:"
labels: '✨ enhancement'
assignees: ''

---

Please describe in detail the problems or needs you have encountered.
请详细描述你遇到的问题或需求。
> ⚠️ 请务必按照模板详细描述你的需求,没有详细描述的issue可能会被忽略或关闭
> ⚠️ Please follow the template to describe your request in detail, issues without detailed description may be ignored or closed
**需求描述 | Description**
<!-- 描述你希望添加的功能或改进建议 -->


**使用场景 | Use Case**
<!-- 描述这个功能会在什么场景下使用,解决什么问题 -->


**功能建议 | Suggestion**
<!-- 你期望这个功能是什么样的?可以描述一下具体实现方式 -->
```yaml
功能形式 | Type: [新功能/功能优化/界面改进]
预期效果 | Expected:
```
**补充说明 | Additional**
<!-- 其他补充说明或者参考示例 -->
96 changes: 50 additions & 46 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,93 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Docker Build and Publish

on:
push:
branches: [ "dev" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
workflow_dispatch: # Enable manual trigger
branches: ["master"]
workflow_dispatch:

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: satackey/[email protected]
continue-on-error: true
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Install cosign
uses: sigstore/[email protected]
with:
cosign-release: 'v2.2.2'
platforms: 'arm64,amd64'

- name: Set up Docker Buildx
uses: docker/[email protected]
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
driver-opts: |
image=moby/buildkit:latest
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/[email protected]
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5.5.1
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha,format=long
type=raw,value=new
- name: Get version
id: get_version
run: echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT

- name: Build and push Docker image
- name: Update version in app.php
run: |
VERSION=$(date '+%Y%m%d')-$(git rev-parse --short HEAD)
sed -i "s/'version' => '.*'/'version' => '$VERSION'/g" config/app.php
echo "Updated version to: $VERSION"
- name: Build and push
id: build-and-push
uses: docker/build-push-action@v5.3.0
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/xboard:latest,${{ env.REGISTRY }}/${{ github.repository_owner }}/xboard,${{ env.REGISTRY }}/${{ github.repository_owner }}/xboard:${{ steps.get_version.outputs.version }}
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/xboard:master
${{ env.REGISTRY }}/${{ github.repository_owner }}/xboard:latest
${{ env.REGISTRY }}/${{ github.repository_owner }}/xboard
${{ env.REGISTRY }}/${{ github.repository_owner }}/xboard:${{ steps.get_version.outputs.version }}
build-args: |
BUILDKIT_INLINE_CACHE=1
provenance: false

- name: Install cosign
uses: sigstore/[email protected]
with:
cosign-release: 'v2.2.2'

- name: Sign image
if: steps.build-and-push.outputs.digest != ''
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
COSIGN_EXPERIMENTAL: 1
run: |
echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign --yes "{}@${{ steps.build-and-push.outputs.digest }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ cli-php.ini
frontend
docker-compose.yaml
bun.lockb
compose.yaml
.scribe
24 changes: 17 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
FROM phpswoole/swoole:php8.1-alpine
FROM phpswoole/swoole:php8.2-alpine

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions pcntl bcmath zip redis \
&& apk --no-cache add shadow sqlite mysql-client mysql-client mysql-dev mariadb-connector-c git patch supervisor redis \
&& addgroup -S -g 1000 www && adduser -S -G www -u 1000 www \
&& (getent group redis || addgroup -S redis) \
&& (getent passwd redis || adduser -S -G redis -H -h /data redis)

RUN install-php-extensions pcntl bcmath inotify \
&& apk --no-cache add shadow sqlite mysql-client git patch \
&& addgroup -S -g 1000 www && adduser -S -G www -u 1000 www
#复制项目文件以及配置文件
WORKDIR /www
COPY .docker /
COPY . /www
COPY .docker/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

RUN composer install --optimize-autoloader --no-cache --no-dev \
&& php artisan storage:link \
&& chown -R www:www /www \
&& chmod -R 775 /www
&& chmod -R 775 /www \
&& mkdir -p /data \
&& chown redis:redis /data

ENV ENABLE_WEB=true \
ENABLE_HORIZON=true \
ENABLE_REDIS=false

CMD php artisan octane:start --server="swoole" --port=7010
EXPOSE 7001
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
Loading

0 comments on commit 1c6b51d

Please sign in to comment.