john3
(Johnny)
2019 年 6 月 20 日午後 1:50
1
Discourse が、5 月 15 日頃に自動アップグレードページでコマンドラインからのアップグレードを求められた後に「git pull」を実行し、その後「rebuild」を行ったところ、アセットファイル(css/js など)で 404 エラーが発生するようになってから、ちょうど 1 ヶ月が経過しました。
それから数日後の今日、再度再インストールを試みましたが、数日経っても状況は変わっていません。私の app.yml ファイルの内容は以下の通りです。
##
## このファイルに変更を加えた後、ライブの Discourse インスタンスに変更を反映させるには、
## 必ず rebuild を実行する必要があります:
##
## /var/discourse/launcher rebuild app
##
## YAML 構文に従ってください。確認にはこのサイトが役立ちます:
## http://www.yamllint.com/
## これはオールインワンのスタンドアロン Discourse Docker コンテナテンプレートです
# web.ratelimited テンプレートのコメントアウトを外すことで、レート制限を追加できます。
# デフォルトでは IP 当たり秒間 12 リクエスト、IP 当たり分間 100 リクエストが許可されます。
# このファイルのパラメータを変更することで設定可能です。
templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/web.ratelimited.template.yml"
expose:
- "25654:80"
# - "80:80"
# - "2222:22"
params:
db_default_text_search_config: "pg_catalog.english"
version: tests-passed
env:
LANG: en_US.UTF-8
# DISCOURSE_DEFAULT_LOCALE: en
UNICORN_WORKERS: 2
DISCOURSE_DEVELOPER_EMAILS: ''
DISCOURSE_HOSTNAME: ''
DISCOURSE_RELATIVE_URL_ROOT: /community
## TODO: この Discourse インスタンスが使用するメールサーバー
DISCOURSE_SMTP_ADDRESS:
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME:
DISCOURSE_SMTP_PASSWORD:
DISCOURSE_SMTP_ENABLE_START_TLS: true
DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none
DISCOURSE_SMTP_AUTHENTICATION: login
## この Discourse インスタンスの CDN アドレス(プル用に設定)
#DISCOURSE_CDN_URL: //discourse-cdn.example.com
## これらのコンテナはステートレスであり、すべてのデータは /shared に保存されます
volumes:
- volume:
host: /var/discourse/shared/standalone
guest: /shared
- volume:
host: /var/discourse/shared/standalone/log/var-log
guest: /var/log
## docker manager プラグインを使用すると、ワンクリックで Discourse をアップグレードできます
## http://discourse.example.com/admin/docker
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- mkdir -p plugins
- git clone https://github.com/discourse/docker_manager.git
# - git clone https://github.com/discourse/discourse-chat-integration.git
# - git clone https://github.com/gdpelican/babble.git
# - git clone https://github.com/discourse/discourse-solved.git
# - git clone https://github.com/discourse/discourse-adplugin.git
# - git clone https://github.com/communiteq/discourse-sitemap.git
# - git clone https://github.com/discourse/discourse-bbcode-color.git
## 覚えておいてください、これは YAML 構文です。同じ名前のブロックは 1 つしか持てません
run:
- exec:
cd: $home
cmd:
- rm -fr public/assets
- sudo -E -u discourse bundle exec rake assets:precompile
- mkdir -p public/community
- cd public/community && ln -s ../uploads && ln -s ../backups
- replace:
global: true
filename: /etc/nginx/conf.d/discourse.conf
from: proxy_pass http://discourse;
to: |
rewrite ^/(.*)$ /community/$1 break;
proxy_pass http://discourse;
- replace:
filename: /etc/nginx/conf.d/discourse.conf
from: etag off;
to: |
etag off;
location /community {
rewrite ^/community/?(.*)$ /$1;
}
- replace:
filename: /etc/nginx/conf.d/discourse.conf
from: $proxy_add_x_forwarded_for
to: $http_fastly_client_ip
global: true
- exec: echo "End of custom commands"
ブラウザ上では以下のようになります:
YML 設定ですべてのプラグインを無効にしましたが、アセットで 404 エラーが発生します。app コンテナ内では、すでに「community」フォルダが作成されています。
何か良い案はありませんか?
john3
(Johnny)
2019 年 6 月 22 日午前 8:42
2
I made the below changes to the config but did not help.
run:
- exec:
cd: $home
cmd:
- mkdir -p public/community
- cd public/community && ln -s ../uploads && ln -s ../backups
- replace:
global: true
filename: /etc/nginx/conf.d/discourse.conf
from: proxy_pass http://discourse;
to: |
rewrite ^/(.*)$ /forum/$1 break;
proxy_pass http://discourse;
- replace:
filename: /etc/nginx/conf.d/discourse.conf
from: etag off;
to: |
etag off;
location /community {
rewrite ^/community/?(.*)$ /$1;
}
- replace:
filename: /etc/nginx/conf.d/discourse.conf
from: $proxy_add_x_forwarded_for
to: $http_your_original_ip_header
global: true
john3
(Johnny)
2019 年 6 月 26 日午前 3:51
3
update:
there are 2 folders in /public/community i.e. “backup” and “uploads”. I tried changing the version from tests-passed to stable again but the issue remains the same i.e. no javascript or CSS files and giving 404 error… I also tried to change the permission for the “uploads” folder in community and symlinked assets folder in community but did not help.
Stephen
(Stephen)
2019 年 6 月 26 日午前 4:50
4
Downgrading isn’t possible, if you’re on tests-passed you can’t rebuild on a lower version (beta/stable).
You would need to stay on the current tests-passed release until Stable or Beta catches up.
Subfolder installs are considered an advanced topic and we really can’t support them here because of all the problems which arise. There are pages and pages of topics detailing the types of problems found when installing against a subfolder. In 2019 there’s really no good reason to use a subfolder install, all of the SEO claims have been debunked, and the added complexity really adds nothing of value.
Even on CDCK hosting, subfolder installs are only available to enterprise customers, with an additional fee.
I would suggest reverting to a subdomain, or opening a topic on marketplace to engage with a consultant.
「いいね!」 1
john3
(Johnny)
2019 年 6 月 26 日午後 12:29
5
I destroyed the container and then rebuild it with the stable release, the problem is with the assets i.e. CSS or javascript files which are not being found. This error happened probably in the update of May. Is there a way I install the previous versions?
Stephen
(Stephen)
2019 年 6 月 26 日午後 12:58
6
Destroying the container doesn’t help, your database was migrated, and as I’ve already said above there’s no way to migrate back. If you didn’t take a backup prior to upgrade you’re stuck at tests-passed until beta or stable reaches the same level.
pfaffman
(Jay Pfaffman)
2019 年 6 月 26 日午後 1:42
7
If you have a backup from then you might be able to do a new build and put the Verdun you want in the version line.
You might try entering the container and doing a
rake assets:precompile
My current subfolder solution is with traefik as the reverse proxy. I offer that installation as a service if you’re interested.
「いいね!」 1
john3
(Johnny)
2019 年 6 月 27 日午後 6:19
8
Currently, I am trying a fresh installation first, as you can see in the first post even the registration page is not working fine. I have tried assets:precompile but its same no effect. Is there a way I can try to install an older version of discourse docker?
pfaffman
(Jay Pfaffman)
2019 年 6 月 27 日午後 6:33
9
Unless you want to use this forum for a week or two and then delete it, you really, really, really don’t want to do that.
My guess is that you missed some tiny step somewhere that’s causing the problem, probably in the external Nginx config. You want to figure it out with the latest version.
Falco
(Falco)
2019 年 6 月 27 日午後 6:43
10
「いいね!」 1
john3
(Johnny)
2019 年 6 月 27 日午後 8:35
11
Yes, it’s not working, that is why I am stuck at 404 errors, javascript files are not being loaded and giving 404 error as shown in the first post.
john3
(Johnny)
2019 年 6 月 27 日午後 8:36
12
this is my external config for the Nginx reverse proxy.
location /community {
pagespeed off;
rewrite /(.*) /$1 break;
proxy_pass http://127.0.0.1:25654/;
proxy_read_timeout 90;
proxy_redirect http://127.0.0.1:25654/ https://www.domain.com/community;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
pfaffman
(Jay Pfaffman)
2019 年 6 月 27 日午後 9:07
13
But the yml file you have above doesn’t look like the one in Subfolder support with Docker .
john3
(Johnny)
2019 年 6 月 27 日午後 9:20
14
That’s because that config file didn’t work in the past, so the one I am using now was suggested by @neil here and it worked in the past. Currently, I also tried the config file uploaded there, but that didn’t work too.
Falco
(Falco)
2019 年 6 月 27 日午後 9:46
15
john3:
Yes, it’s not working, that is why I am stuck at 404 errors, javascript files are not being loaded and giving 404 error as shown in the first post.
Well, I just bought a brand new droplet and set it up here: https://subfolder.muito.ninja/forum , following the Serve Discourse from a subfolder (path prefix) instead of a subdomain
It is working fine for me.
So I’m afraid your reverse proxy is breaking it up…
「いいね!」 1
Hi @john3 , subfolder installation is painful
I compared my config (left) and yours (right), take a look at line 12, probably you forgot to change word forum. Next, I have extra block replace, lines 22-29:
The end:
External proxy:
location /discuss {
## This is ProxyPassReverse for Nginx
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 3600;
proxy_connect_timeout 240;
proxy_set_header Host $host;
proxy_set_header X-RealIP $remote_addr; #Important line for our logging objective
## End This is ProxyPassReverse for Nginx
proxy_pass http://192.168.1.2$request_uri;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
「いいね!」 2
john3
(Johnny)
2019 年 6 月 28 日午後 7:36
17
Could you please share with me your reverse proxy config?
john3
(Johnny)
2019 年 6 月 28 日午後 7:49
18
I have made the changes and it’s still the same. My configs are given below. I am using Centos 7 with overlay2 as device storage driver.
Nginx reverse proxy:
location /community {
pagespeed off;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 3600;
proxy_connect_timeout 240;
proxy_set_header Host $host;
proxy_set_header X-RealIP $remote_addr; #Important line for our logging objective
## End This is ProxyPassReverse for Nginx
proxy_pass http://127.0.0.1:25654$request_uri;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
app.yml
run:
- exec:
cd: $home
cmd:
- mkdir -p public/community
- cd public/community && ln -s ../uploads && ln -s ../backups
- replace:
global: true
filename: /etc/nginx/conf.d/discourse.conf
from: proxy_pass http://discourse;
to: |
rewrite ^/(.*)$ /community/$1 break;
proxy_pass http://discourse;
- replace:
filename: /etc/nginx/conf.d/discourse.conf
from: etag off;
to: |
etag off;
location /community/ {
rewrite ^/community/?(.*)$ /$1;
}
- replace:
filename: /etc/nginx/conf.d/discourse.conf
from: etag off;
to: |
etag off;
location /community {
rewrite ^/community/?(.*)$ /$1;
}
- replace:
filename: /etc/nginx/conf.d/discourse.conf
from: $proxy_add_x_forwarded_for
to: $http_fastly_client_ip
global: true
- exec: echo "End of custom commands"
Could you please send me the last part of your YML config i.e. -exec…
Falco
(Falco)
2019 年 6 月 28 日午後 7:49
19
This depends on what software you are using to reverse proxy.
I’m using Caddy and following Running Discourse with Caddy Server
Only change from the guide is adding the folder in the Caddyfile:
subfolder.muito.ninja
proxy /forum unix:/sock/nginx.http.sock {
transparent
}
「いいね!」 2
john3
(Johnny)
2019 年 6 月 28 日午後 8:00
20
I see… I am using a digital ocean droplet with Centos 7 and overlay2 storage driver. Nginx as the web server and let’s encrypt’s SSL.