Skip to content

Commit

Permalink
* Merge the front and back end code.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouyq committed Jun 23, 2022
1 parent c5afc6f commit e13bedf
Show file tree
Hide file tree
Showing 72 changed files with 278 additions and 469 deletions.
3 changes: 2 additions & 1 deletion backend/.dockerignore → .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.git
!**/*.go
!**/*.mod
!**/*.sum
!Makefile
!VERSION
!VERSION
File renamed without changes.
5 changes: 5 additions & 0 deletions backend/.gitignore → .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
frontend/www/data
.DS_Store
*.code-workspace
.vscode

# ---> Go
# Binaries for programs and plugins
*.exe
Expand Down
2 changes: 1 addition & 1 deletion frontend/.gitlab-ci.yml → .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ gentag-tags:
build:
stage: build
script:
- docker buildx build --pull --push --platform linux/amd64 -t hub.qucheng.com/platform/qucheng:${BUILD_TAG} -f docker/Dockerfile .
- make build && make push
after_script:
- echo "clean build"

Expand Down
File renamed without changes.
14 changes: 10 additions & 4 deletions frontend/Makefile → Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
export TAG := $(shell grep ver VERSION | cut -d '=' -f 2)
date_time := $(shell date +%Y%m%d )
export commit_id := $(shell git rev-parse --short HEAD)
export branch_name := $(shell git branch --show-current|sed 's#/#-#g')
export TAG := $(shell echo $(branch_name)-$(date_time)-$(commit_id) )

help: ## this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

build: ## 构建镜像
docker build --build-arg VERSION=$(TAG) -t hub.qucheng.com/platform/qucheng:$(TAG) -f docker/Dockerfile .
docker build --build-arg VERSION=$(TAG) \
--build-arg GIT_COMMIT=$(commit_id) \
--build-arg GIT_BRANCH=$(branch_name) \
-t hub.qucheng.com/platform/qucheng:$(TAG) -f docker/Dockerfile .

push: ## push 镜像
docker push hub.qucheng.com/platform/qucheng:$(TAG)
Expand All @@ -13,8 +19,8 @@ run: ## 运行
docker-compose -f docker-compose.yml up -d mysql qucheng

run-dev: ## 运行开发环境
chown 82:82 . -R
[ ! -d www/data ] && mkdir -pv www/data && chown 82.82 www/data
chown 33:33 . -R
[ ! -d frontend/www/data ] && mkdir -pv frontend/www/data && chown 33.33 frontend/www/data
docker-compose -f docker-compose.yml up -d mysql qucheng-dev

ps: run ## 运行状态
Expand Down
4 changes: 3 additions & 1 deletion frontend/README.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
业务层也称之为前台,承接功能的展现与业务层功能的实现,如用户管理、团队管理、平台管理、服务管理等,通过调用平台层接口实现对后端资源的控制与分配。
业务层使用PHP语言开发,通过zentaoPHP框架来实现,用户不需要关注如何安装业务层,平台命令行自动为您安装该服务。

源码目录:[frontend](./frontend)

### 命令行

负责渠成平台命令行下快速安装、组件维护、状态查询。
Expand All @@ -36,7 +38,7 @@

平台层负责资源的抽象与整合、应用管理、监控告警、安全审计等功能,使用Golang语言开发。

项目源码:[qucheng_api](https://github.com/easysoft/qucheng_api)
源码目录:[backend](./backend)

### 调度层

Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.2
Binary file added backend/.Makefile.swp
Binary file not shown.
77 changes: 0 additions & 77 deletions backend/.drone-ci.yml

This file was deleted.

58 changes: 0 additions & 58 deletions backend/.gitlab-ci.yml

This file was deleted.

6 changes: 0 additions & 6 deletions backend/COPYING

This file was deleted.

27 changes: 0 additions & 27 deletions backend/Dockerfile

This file was deleted.

3 changes: 1 addition & 2 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ GOSUMDB = sum.golang.google.cn

BUILD_RELEASE ?= $(shell cat VERSION || echo "0.0.1")
BUILD_DATE := $(shell date "+%Y%m%d")
GIT_COMMIT := $(shell git rev-parse --short HEAD || echo "abcdefgh")
APP_VERSION := ${BUILD_RELEASE}-${BUILD_DATE}-${GIT_COMMIT}
APP_VERSION := $(BUILD_RELEASE)-${BUILD_DATE}-$(GIT_COMMIT)

LDFLAGS := "-w \
-X $(VERSION_PKG).release=$(APP_VERSION) \
Expand Down
1 change: 0 additions & 1 deletion backend/VERSION

This file was deleted.

2 changes: 2 additions & 0 deletions frontend/docker-compose.yml → docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ services:
- CNE_API_HOST=http://cne.internal-pre.chandao.net
- CLOUD_API_HOST=http://cne-market.internal-pre.chandao.net
- CLOUD_DEFAULT_CHANNEL=test
- DEBUG=1
- ENABLE_BACKEND=true

qucheng-dev:
image: hub.qucheng.com/platform/qucheng:${TAG}
Expand Down
97 changes: 97 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Copyright (c) 2022 北京渠成软件有限公司 All rights reserved.
# Use of this source code is governed by Z PUBLIC LICENSE 1.2 (ZPL 1.2)
# license that can be found in the LICENSE file.

# Compile the backend API service
FROM hub.qucheng.com/library/god AS builder

RUN sed -i -r 's/(deb|security).debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \
&& apt-get update \
&& apt-get install upx -y

WORKDIR /go/src

ARG GIT_COMMIT
ARG GIT_BRANCH

ENV GOPROXY=https://goproxy.cn,direct

COPY VERSION .

COPY backend/go.mod go.mod

COPY backend/go.sum go.sum

RUN go mod download

COPY backend .

RUN make build && upx -9 /go/src/_output/bin/cne-api


# Build qucheng image
FROM hub.qucheng.com/library/debian:11.3-slim

LABEL maintainer "zhouyueqiu <zhouyueqiu@easycorp.ltd>"

ENV OS_ARCH="amd64" \
OS_NAME="debian-11" \
HOME_PAGE="www.qucheng.com"

COPY docker/prebuildfs /

ENV TZ=Asia/Shanghai \
DEBIAN_FRONTEND=noninteractive

RUN sed -i -r 's/(deb|security).debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \
&& install_packages curl wget tzdata zip unzip s6 pwgen cron \
&& ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata

# Install internal php
RUN . /opt/easysoft/scripts/libcomponent.sh && component_unpack "php" "7.4.28" -c 934dd0320ee217465f6a8496b0858d120c3fd45b413f1c9ff833731a848cefa7

# Install php-ext-ioncube
RUN . /opt/easysoft/scripts/libcomponent.sh && component_unpack "php-ext-ioncube" "11.0.1" -c 9a6ee08aa864f2b937b9a108d3ec8679ae3a5f08f92a36caf5280520432315ad

# Install apache
RUN . /opt/easysoft/scripts/libcomponent.sh && component_unpack "apache" "2.4.53-02" -c 0df3a5e53ef078b75dd43facd6e1473d9ff3c4c5e5b865c4dc066e4e2ece6b07

# Install su-exec
RUN . /opt/easysoft/scripts/libcomponent.sh && component_unpack "su-exec" "0.2" --checksum 687d29fd97482f493efec73a9103da232ef093b2936a341d85969bc9b9498910

# Install render-template
RUN . /opt/easysoft/scripts/libcomponent.sh && component_unpack "render-template" "1.0.1-10" --checksum 5e410e55497aa79a6a0c5408b69ad4247d31098bdb0853449f96197180ed65a4

# Install mysql-client
RUN . /opt/easysoft/scripts/libcomponent.sh && component_unpack "mysql-client" "10.5.15" -c 31182985daa1a2a959b5197b570961cdaacf3d4e58e59a192c610f8c8f1968a8

# Install wait-for-port
RUN . /opt/easysoft/scripts/libcomponent.sh && component_unpack "wait-for-port" "1.01" -c 2ad97310f0ecfbfac13480cabf3691238fdb3759289380262eb95f8660ebb8d1

# Clear apahce vhost config
RUN rm -rf /etc/apache2/sites-available/* /etc/apache2/sites-enabled/*

# qucheng envs
ARG VERSION
ENV EASYSOFT_APP_NAME="QuCheng $VERSION"

# Copy qucheng source code
WORKDIR /apps/qucheng
COPY --chown=www-data frontend .

# Copy qucheng backend
COPY --from=builder /go/src/_output/bin/cne-api /apps/qucheng/bin/backend

# Copy apache,php and qucheng config files
COPY docker/rootfs /

RUN chmod +x /usr/bin/entrypoint.sh /apps/qucheng/bin/backend \
&& chmod 777 /apps/qucheng/tmp

EXPOSE 80

VOLUME ["/data"]

ENTRYPOINT ["/usr/bin/entrypoint.sh"]
Loading

0 comments on commit e13bedf

Please sign in to comment.