Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Deploy front-end #1162

Closed
chenyong0923 opened this issue Nov 3, 2024 · 18 comments
Closed

How to Deploy front-end #1162

chenyong0923 opened this issue Nov 3, 2024 · 18 comments
Labels
bug Something isn't working

Comments

@chenyong0923
Copy link

Building a new image from the official Dockerfile creates a back-end service, right? Does the front-end service need to be deployed separately? When accessing the container's port through a browser, it keeps loading.

image image
@chenyong0923 chenyong0923 added the enhancement Enhancement request label Nov 3, 2024
@chenyong0923 chenyong0923 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2024
@chenyong0923 chenyong0923 reopened this Nov 4, 2024
@chenyong0923
Copy link
Author

When deploying to the production environment, you would first package the image, then deploy the backend, and then deploy the frontend via nginx, right?

@LinkinStars
Copy link
Member

@chenyong0923 First of all, for the whole project, the frontend doesn't need to be deployed separately. Just compile the frontend and then the backend, and finally package it into a docker image to start. Then just use the nginx proxy you mentioned to access the port of the container.

@chenyong0923
Copy link
Author

@chenyong0923 First of all, for the whole project, the frontend doesn't need to be deployed separately. Just compile the frontend and then the backend, and finally package it into a docker image to start. Then just use the nginx proxy you mentioned to access the port of the container.

Now the mirrored boot has started, and the browser is trying to access the boot port, but it is not able to enter the install page normally. Why is that?

@LinkinStars
Copy link
Member

@chenyong0923 If you are rebuilding the image, could you give the command and dockerfile that you built it with? If there are any other modifications please include them as well.

@chenyong0923
Copy link
Author

chenyong0923 commented Nov 4, 2024

@chenyong0923 If you are rebuilding the image, could you give the command and dockerfile that you built it with? If there are any other modifications please include them as well.

I just supported uploading videos, changed the local storage of images and videos to OSS, and kept the Dockerfile the same as the official one.

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

FROM golang:1.22-alpine AS golang-builder
LABEL maintainer="linkinstar@apache.org"

ARG GOPROXY
# ENV GOPROXY ${GOPROXY:-direct}
# ENV GOPROXY=https://proxy.golang.com.cn,direct
ENV GOPROXY=https://goproxy.cn,direct

ENV GOPATH /go
ENV GOROOT /usr/local/go
ENV PACKAGE github.com/apache/incubator-answer
ENV BUILD_DIR ${GOPATH}/src/${PACKAGE}
ENV ANSWER_MODULE ${BUILD_DIR}

ARG TAGS="sqlite sqlite_unlock_notify"
ENV TAGS "bindata timetzdata $TAGS"
ARG CGO_EXTRA_CFLAGS

COPY . ${BUILD_DIR}
WORKDIR ${BUILD_DIR}
RUN apk --no-cache add build-base git bash nodejs npm && npm install -g pnpm@8.9.2 \
    && make clean build

RUN chmod 755 answer
RUN ["/bin/bash","-c","script/build_plugin.sh"]
RUN cp answer /usr/bin/answer

RUN mkdir -p /data/uploads && chmod 777 /data/uploads \
    && mkdir -p /data/i18n && cp -r i18n/*.yaml /data/i18n

FROM alpine
LABEL maintainer="linkinstar@apache.org"

ARG TIMEZONE
ENV TIMEZONE=${TIMEZONE:-"Asia/Shanghai"}

RUN apk update \
    && apk --no-cache add \
        bash \
        ca-certificates \
        curl \
        dumb-init \
        gettext \
        openssh \
        sqlite \
        gnupg \
        tzdata \
    && ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
    && echo "${TIMEZONE}" > /etc/timezone

COPY --from=golang-builder /usr/bin/answer /usr/bin/answer
COPY --from=golang-builder /data /data
COPY /script/entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh

VOLUME /data
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]

@sosyz
Copy link
Member

sosyz commented Nov 4, 2024

@chenyong0923 Maybe you can use storage-aliyunoss if you want to save files on OSS ?

@chenyong0923
Copy link
Author

@chenyong0923 Maybe you can use storage-aliyunoss if you want to save files on OSS ?

Thanks,I mainly want to upload videos, does this plugin support video uploads? Or is it only for storing images on Oss? I have already implemented the local function, but the problem is that the rebuilt image service keeps loading.

@LinkinStars
Copy link
Member

@chenyong0923 If you haven't modified the dockerfile, then maybe the build should have a problem. First, you can try to build the frontend locally by make ui command. If there is no problem, then keep the output log when executing the docker build command to see if there are any error messages during the frontend build process.

@chenyong0923
Copy link
Author

@chenyong0923 If you haven't modified the dockerfile, then maybe the build should have a problem. First, you can try to build the frontend locally by make ui command. If there is no problem, then keep the output log when executing the docker build command to see if there are any error messages during the frontend build process.

I am currently doing it like this: first, I build the front-end make ui, then the back-end make build, both of which are working fine. Finally, I build the image.

image

@LinkinStars
Copy link
Member

@chenyong0923 OK. Then it's very likely that there's a problem with the docker image build process.

@chenyong0923
Copy link
Author

@chenyong0923 OK. Then it's very likely that there's a problem with the docker image build process.

Sometimes building an image may result in errors due to installation dependency issues, but even if an image is successfully built, there may still be issues.
image
image

image

@LinkinStars
Copy link
Member

@chenyong0923 Well, it looks like a network issue. 🤔

@chenyong0923
Copy link
Author

@chenyong0923 Well, it looks like a network issue. 🤔

Yes, just keep trying, and you'll be able to build it successfully. However, when I build a successful image, the browser keeps loading the page, and this has been bothering me for a long time. I don't know what the cause is. Even when I build an image using the official main branch code, it also keeps loading.

@LinkinStars
Copy link
Member

Even when I build an image using the official main branch code, it also keeps loading.

@chenyong0923 That's kind of weird. But you can try using the official image first. docker pull apache/answer:latest. If there is no problem, then there must be something wrong with the docker build process. Because the official image is built from the dockerfile in the code repository. The whole process is built using GitHub action with no human intervention.

@chenyong0923
Copy link
Author

Even when I build an image using the official main branch code, it also keeps loading.

@chenyong0923 That's kind of weird. But you can try using the official image first. docker pull apache/answer:latest. If there is no problem, then there must be something wrong with the docker build process. Because the official image is built from the dockerfile in the code repository. The whole process is built using GitHub action with no human intervention.

It's normal to pull the official image directly from the Docker Hub, and cloning the official source code and building the image also results in a loading status. I will try it on another computer.

@chenyong0923
Copy link
Author

Even when I build an image using the official main branch code, it also keeps loading.

@chenyong0923 That's kind of weird. But you can try using the official image first. docker pull apache/answer:latest. If there is no problem, then there must be something wrong with the docker build process. Because the official image is built from the dockerfile in the code repository. The whole process is built using GitHub action with no human intervention.

When will the official mirror image support the last video? This is a necessary requirement, so I have made a secondary development.

@chenyong0923
Copy link
Author

Even when I build an image using the official main branch code, it also keeps loading.

@chenyong0923 That's kind of weird. But you can try using the official image first. docker pull apache/answer:latest. If there is no problem, then there must be something wrong with the docker build process. Because the official image is built from the dockerfile in the code repository. The whole process is built using GitHub action with no human intervention.

I found the problem, start the plug-in, the front-end route is lost, get the plug-in state, return undefined, need to add a backstory logic,return undefined, assign an empty array

image image image image

@shuashuai
Copy link
Member

I found the problem, start the plug-in, the front-end route is lost, get the plug-in state, return undefined, need to add a backstory logic,return undefined, assign an empty array

@chenyong0923

I tested it, and it is indeed like this. It should be related to the adjustment of the routing logic of the last load of the socket. The number of interfaces allowed to be accessed when ignoring /install is limited, so there is a problem here during initialization. I will fix it, thanks for the feedback.

@shuashuai shuashuai added bug Something isn't working and removed enhancement Enhancement request labels Nov 6, 2024
shuashuai added a commit that referenced this issue Nov 6, 2024
…interface, causing the page to continue loading #1162
shuashuai added a commit that referenced this issue Nov 6, 2024
…interface, causing the page to continue loading #1162
LinkinStars added a commit to sunshineg/incubator-answer that referenced this issue Dec 9, 2024
* docs(ui): add Apache license header to InitialLoadingPlaceholder components

* # Conflicts:
#	i18n/da_DK.yaml
#	i18n/de_DE.yaml
#	i18n/es_ES.yaml
#	i18n/fa_IR.yaml
#	i18n/fr_FR.yaml
#	i18n/it_IT.yaml
#	i18n/ko_KR.yaml
#	i18n/pl_PL.yaml
#	i18n/pt_PT.yaml
#	i18n/ro_RO.yaml
#	i18n/ru_RU.yaml
#	i18n/sv_SE.yaml
#	i18n/uk_UA.yaml
#	i18n/vi_VN.yaml
#	i18n/zh_CN.yaml

* docs(i18n): update translation progress

* docs(i18n): update translation

* docs(i18n): update translation progress

* docs(i18n): update translation

* ci(gorelease): Upgrade Goreleaser version to 2 and update snapshot version template

* ci(gorelease): Upgrade Goreleaser version to 2 and update snapshot version template

* ci(plugin): make default plugin list

* fix: missing js-sha256 license

* docs: update license files

* docs: rename codemirror license file name

* fix: fixed project initialization not allowing access to the plug-in interface, causing the page to continue loading apache#1162

* fix: delete unused log

* perf: optimize tag has new tag check

* fix: add status filter when update tag rel

* fix: wrong status when enable tag rel

* fix: resolve 404 error on Tags static page

* feat: update template files

* fix: display timezone on Dashboard when set to UTC

* fix: update useRenderHtmlPlugin to target specific HTML element

Related issue: apache/answer-plugins#245

* fix: Tag summary display is not as expected on tag detail page

* refactor(gomock): update gomock dependence and docs

* feat(file): update the max image size

* fix(review): reject the review when delete question

* fix: Markdown parsing without incrementing ordered list numbers

* feat: actions add toast tips

* perf: add note to email body

* feat: Add key metrics to the dashboard

* fix(search): fix the wrong offset when searching

* feat(question): add linked count feature to question

* feat(question): sort questions by update time for frequent tab

* feat(upload): add support for file attachments and enhance image upload

* feat: The editor has added support for uploading attachments, and the management background has added file upload configuration information.

* fix: Add file upload error handling

* feat(upload): add support for file attachments and enhance image upload

* fix: length error

* fix: Optimize the mobile style of QueryGroup component

* fix: Optimize the mobile style of QueryGroup component dropdown btns

* fix: The pre tag sets the maximum height apache#1168

* test: fix TestGetAvatarURL

* feat(storage): add upload file condition to plugin upload

* feat(user): add top questions and answers to user homepage

* fix: administrator add user failure

* fix: Attachment accept type adjustment, editor plug-in insertion position added conditional restrictions

* refactor: remove unused heading options and clean up icon styles

* refactor(i18n): update formatting instructions to mention post IDs

* feat(file): implement file download functionality

* refactor(uploader): improve file upload and download functionality subpath constants
- Adjust file download

* feat(upload): add support for attachment uploads and improve image handling

* feat: Add delete external user login info by user ID

* docs(Makefile): upgrade version to 1.4.2

---------

Co-authored-by: LinkinStars <linkinstar@foxmail.com>
Co-authored-by: sy-records <52o@qq52o.cn>
Co-authored-by: shuai <lishuailing@sifou.com>
Co-authored-by: Sonui <me@sonui.cn>
Co-authored-by: robin <robin@rnode.me>
Co-authored-by: wxt <3264117476@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants