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 serve statics ? #767

Closed
valentin2105 opened this Issue Apr 3, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@valentin2105
Contributor

valentin2105 commented Apr 3, 2017

Hi,

I tried to deploy Mastodon using Docker-compose, exposed via a Nginx container who act as a reverse-proxy. ( I mount mastodon/public as a volume in this container).

I use the same nginx.conf from the Production Wiki.

When I load my instance (in HTTPS with Let's encrypt), I got problems with statics (css/js) who give me few 404 errors.

My folder ../mastodon/public/assets is empty, is that normal ?

Thanks for your help.

@rhaamo

This comment has been minimized.

Show comment
Hide comment
@rhaamo

rhaamo Apr 3, 2017

Statics should be built using RAILS_ENV=production bundle exec rails assets:precompile this should also be executed any time you updates mastodon and there is assets changes (js, images.), but I don't have used Docker so I can't say if it's executed properly or not for this specific point.

I have the same kind of setup (except docker) and I just rsync the whole public directory to one in the proxy server each update and use root /srv/http/whatever.tld/public; in the vhost.

rhaamo commented Apr 3, 2017

Statics should be built using RAILS_ENV=production bundle exec rails assets:precompile this should also be executed any time you updates mastodon and there is assets changes (js, images.), but I don't have used Docker so I can't say if it's executed properly or not for this specific point.

I have the same kind of setup (except docker) and I just rsync the whole public directory to one in the proxy server each update and use root /srv/http/whatever.tld/public; in the vhost.

@Gargron

This comment has been minimized.

Show comment
Hide comment
@Gargron

Gargron Apr 3, 2017

Member

Above comment is correct. Let us know if that solves it!

Member

Gargron commented Apr 3, 2017

Above comment is correct. Let us know if that solves it!

@valentin2105

This comment has been minimized.

Show comment
Hide comment
@valentin2105

valentin2105 Apr 3, 2017

Contributor

@Gargron @rhaamo Thanks for your answer.

After generate assets, the folder ./mastodon/public/assets is provided with assets (like application-3543534634....css) but when I load the homepage with this directive in my Nginx.conf ( root /srv/mastodon/public;) I got few 404's too (no CSS).

For example :

...xyz/images/logo.png 404 (Not Found)

And in the public folder, I got :

assets/logo-5701d8d94bca66668f49a2803c984e960dfe0bf93a71f2d86be9455e66505cee.png

And for images/logo.png, the folder image doesn't exist in Public folder.

I don't understand where I go wrong.
Thanks for helping.

Contributor

valentin2105 commented Apr 3, 2017

@Gargron @rhaamo Thanks for your answer.

After generate assets, the folder ./mastodon/public/assets is provided with assets (like application-3543534634....css) but when I load the homepage with this directive in my Nginx.conf ( root /srv/mastodon/public;) I got few 404's too (no CSS).

For example :

...xyz/images/logo.png 404 (Not Found)

And in the public folder, I got :

assets/logo-5701d8d94bca66668f49a2803c984e960dfe0bf93a71f2d86be9455e66505cee.png

And for images/logo.png, the folder image doesn't exist in Public folder.

I don't understand where I go wrong.
Thanks for helping.

@Gargron

This comment has been minimized.

Show comment
Hide comment
@Gargron

Gargron Apr 4, 2017

Member

Restart rails server and it should start linking to the hashed files.

Member

Gargron commented Apr 4, 2017

Restart rails server and it should start linking to the hashed files.

@valentin2105

This comment has been minimized.

Show comment
Hide comment
@valentin2105

valentin2105 Apr 4, 2017

Contributor

The restart doesn't work for me. But with some symlinks, I can make it work clean.

Contributor

valentin2105 commented Apr 4, 2017

The restart doesn't work for me. But with some symlinks, I can make it work clean.

abcang added a commit to pixiv/mastodon that referenced this issue Jan 22, 2018

Merge pull request tootsuite#767 from pixiv/revert_account_media_stat…
…us_ids

Revert "Fix account_media_status_ids"

abcang added a commit to pixiv/mastodon that referenced this issue Jan 25, 2018

Merge pull request tootsuite#767 from pixiv/path
Shorten a relative path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment