LucienShui / PasteMe

PasteMe 是一个无需注册的文本分享平台(未登陆状态下只能使用阅后即焚),可以为文本设置密码和阅后即焚,支持二维码分享和各种一键复制,针对代码提供了额外的高亮功能。
https://pasteme.cn
GNU General Public License v3.0
1.19k stars 155 forks source link

更改端口后界面全白 #75

Closed justxuewei closed 4 years ago

justxuewei commented 4 years ago

具体是把frontend中的ports 改为10006:8080,但是无法访问 请问是什么原因呢

justxuewei commented 4 years ago

Nginx的报错

2019/11/20 12:51:56 [error] 6#6: *6 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.13:8000/?method=beat", host: "192.168.0.250:10006", referrer: "http://192.168.0.250:10006/"
2019/11/20 12:58:51 [error] 6#6: *33 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.14:8000/?method=beat", host: "192.168.0.250:10006", referrer: "http://192.168.0.250:10006/"
2019/11/20 12:59:51 [error] 6#6: *33 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.13:8000/?method=beat", host: "192.168.0.250:10006", referrer: "http://192.168.0.250:10006/"
2019/11/20 13:00:51 [error] 6#6: *33 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.15:8000/?method=beat", host: "192.168.0.250:10006", referrer: "http://192.168.0.250:10006/"
2019/11/20 13:01:51 [error] 6#6: *33 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.12:8000/?method=beat", host: "192.168.0.250:10006", referrer: "http://192.168.0.250:10006/"
2019/11/20 13:04:50 [error] 6#6: *42 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.12:8000/?method=beat", host: "192.168.0.250:10006", referrer: "http://192.168.0.250:10006/index.html"
2019/11/20 13:05:50 [error] 6#6: *42 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.15:8000/?method=beat", host: "192.168.0.250:10006", referrer: "http://192.168.0.250:10006/index.html"
2019/11/20 13:12:19 [error] 6#6: *52 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.13:8000/?method=beat", host: "192.168.0.250:10006", referrer: "http://192.168.0.250:10006/"
2019/11/20 13:13:06 [error] 6#6: *56 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.15:8000/?method=beat", host: "192.168.0.250:10006"
2019/11/20 13:14:06 [error] 6#6: *56 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.12:8000/?method=beat", host: "192.168.0.250:10006"
2019/11/20 13:15:06 [error] 6#6: *56 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.14:8000/?method=beat", host: "192.168.0.250:10006"
2019/11/20 13:16:06 [error] 6#6: *56 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.13:8000/?method=beat", host: "192.168.0.250:10006"
2019/11/20 13:29:00 [error] 6#6: *64 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.13:8000/?method=beat", host: "192.168.0.250:10006", referrer: "http://192.168.0.250:10006/"
2019/11/20 13:30:00 [error] 6#6: *64 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.14:8000/?method=beat", host: "192.168.0.250:10006", referrer: "http://192.168.0.250:10006/"
2019/11/20 13:31:00 [error] 6#6: *64 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.0.107, server: _, request: "GET /api/?method=beat HTTP/1.1", upstream: "http://123.129.254.15:8000/?method=beat", host: "192.168.0.250:10006", referrer: "http://192.168.0.250:10006/"
LucienShui commented 4 years ago

是使用 docker 部署的吗?

justxuewei commented 4 years ago

是的 一开始是unhealty 后来我查看了closed issues后改了一下docker compose文件 现在unhealthy解决了 但是打开有是白屏 过很久之后会显示这个错误 image

justxuewei commented 4 years ago

我除了修改了ports以外没有修改任何配置 而且我进去frontend看了nginx的配置 我觉得应该没有什么问题 如果需要我可以发给你更详细的logs

justxuewei commented 4 years ago

补充:看起来好像是后端的问题 如果我直接访问http://192.168.0.250:10006/api/?method=beat 在后端的logs中是有输出的

[GIN] 2019/11/20 - 13:41:43 | 200 |      28.883µs |       127.0.0.1 | GET      /?method=beat

但是在浏览器端会报错502 Bad Gateway

LucienShui commented 4 years ago

是的 一开始是unhealty 后来我查看了closed issues后改了一下docker compose文件 现在unhealthy解决了 但是打开有是白屏 过很久之后会显示这个错误 image

是参考了这个 issue 吗?https://github.com/LucienShui/PasteMe/issues/71 docker-compose.yml 里数据库的账号密码是不是做了变更?

justxuewei commented 4 years ago

是的 我直接复制的 没有仔细看 我在根据上面的issues重新部署一下

LucienShui commented 4 years ago

之前我做了一个比较傻的改动,所以说现在的数据库和密码只能维持原状,否则后端会连接不上数据库。 我正在修这个问题。

justxuewei commented 4 years ago

不 是端口的问题 我改成80后可以正常访问 但是改成10006就不行 但是最奇怪的是我在shareme-frontend的容器中执行 curl -i http://pasteme-backend:8000/api/?method=beat是可以显示301 redirect,但是在容器外就不行了

LucienShui commented 4 years ago

可以发一下现在的 docker-compose.yml 文件吗?

justxuewei commented 4 years ago
version: "3"

services:
  pasteme-frontend:
    image: registry.cn-hangzhou.aliyuncs.com/pasteme/frontend:3.1.0
    container_name: pasteme-frontend
    depends_on:
      - pasteme-backend
    healthcheck:
      test: ["CMD", "service", "nginx", "status"]
      interval: 45s
      timeout: 3s
      retries: 3
    restart: always
    ports:
      - 10006:8080
    volumes:
      - ./logs/:/var/lib/pasteme/
      - ./usr/:/www/pasteme/usr/

  pasteme-backend:
    image: registry.cn-hangzhou.aliyuncs.com/pasteme/backend:beta
    container_name: pasteme-backend
    depends_on:
      - pasteme-mysql
    healthcheck:
      test: ["CMD", "wget", "localhost:8000/?method=beat", "--output=/dev/null"]
      interval: 45s
      timeout: 3s
      retries: 3
    restart: always
    environment:
      PASTEMED_DB_USERNAME: username
      PASTEMED_DB_PASSWORD: password
      PASTEMED_DB_SERVER: pasteme-mysql
      PASTEMED_DB_PORT: 3306
      PASTEMED_DB_DATABASE: pasteme

  pasteme-mysql:
    image: mysql:5.5
    container_name: pasteme-mysql
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      interval: 45s
      timeout: 3s
      retries: 3
    restart: always
    command: [
      '--character-set-server=utf8mb4',
      '--collation-server=utf8mb4_unicode_ci'
    ]
    environment:
      MYSQL_USER: username
      MYSQL_PASSWORD: password
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: pasteme
      MYSQL_MAX_ALLOWED_PACKET: 128M
      MYSQL_INNODB_LOG_FILE_SIZE: 64M
    volumes:
      - ./mysql:/var/lib/mysql
LucienShui commented 4 years ago

非常抱歉,我在本地没有复现你的问题。

截屏2019-11-20下午10 25 20

我给你发了一封邮件,如果方便的话加一下我,我远程看一下。

LucienShui commented 4 years ago

没能复现问题,玄学解决了。