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

Local only posting does not seem to work after migration from Mastodon #1159

Closed
flavio2018 opened this issue Apr 23, 2022 · 22 comments
Closed
Labels
bug Something isn't working

Comments

@flavio2018
Copy link

flavio2018 commented Apr 23, 2022

Hi all! I just migrated from Mastodon to Hometown following the guide in the Wiki. The migration seems to have happened successfully, since the name of the homepage of my instance is now 'Hometown', and in the public page I can see Hometown-related messages. However, I cannot seem to create local only posts (main feature I wish to migrate for). I have very little experience with Ruby on Rails and/or website hosting in general, however I think I could follow steps or provide additional information. Any suggestion is very much appreciated!

Expected behaviour

I should be able to create local only posts.

Actual behaviour

The local-only post icon in the post creation box does not appear. Even using the :local_only: emoji does not seem to work. In my Preferences > Other tab I can see the Allow my posts to reach other instances by default option.

Steps to reproduce the problem

I followed the steps listed in the Wiki. A couple of things that diverged from what was written there are:

  • the last commit before merging was 642528f45513acb823a7291f32fb07377bd2b621 and not ee513a6a3bc9f144a4d85132da898964987e5059 as written in the Wiki (however, the output of git describe --tags was correct)
  • I did not substitute the value production in the last two lines in the instructions, as they seemed to me the correct ones based on the output of declare | grep -i rails, which was just RAILS_ENV=production
  • when executing RAILS_ENV=production bundle exec rails db:migrate, an error was printed stating that I didn't have the correct version of bundle installed. I installed it using gem. Then, another error said that rails was not installed, so I installed it using bundle. Then I was able to execute the last two lines in the instructions.
@flavio2018 flavio2018 added the bug Something isn't working label Apr 23, 2022
@hughrun
Copy link

hughrun commented Apr 27, 2022

@flavio2018 can you confirm how you're trying to select local-only? It's a little tricky because it's an additional posting type you can use in combination with the other types, so it's not in the dropdown list. That is, you could conceivably post a local-only post that is also followers-only (i.e. "local followers only").

Click on the chain image next to the CW button:
local

Does this work?

@flavio2018
Copy link
Author

flavio2018 commented Apr 28, 2022

Thanks for the reply.

What I see is this:

image
I cannot select the additional posting type, not even including :local_only: in the post text.

@hughrun
Copy link

hughrun commented Apr 30, 2022

hmm yeah that definitely doesn't look right.

@flavio2018
Copy link
Author

flavio2018 commented Apr 30, 2022

@hughrun do you have any suggestions on how I can better understand what is going on?

@hughrun
Copy link

hughrun commented May 1, 2022

I also don't know much about Ruby but I notice that your "latest commit" is this one which was created for v3.5.1, not 3.4.6. I expect this may be the source of the problem. However if git describe --tags is showing you 3.4.6 then I'm a bit stumped. Assuming you've got a clean backup, I'd maybe confirm you have checked out the mastodon code at exactly 3.4.6 and try again.

@dariusk
Copy link

dariusk commented May 6, 2022

Just wanted to check in and see how this is going, @flavio2018 . Did you manage to figure it out?

@flavio2018
Copy link
Author

Hi @dariusk, thanks for stopping by :)
Unfortunately I don't have a clean backup (silly me), so I tried checking back out to the main Mastodon branch, then to the correct commit, and finally to do the fetching, merging and DB configuration steps again. But it didn't change anything :/
Currently I have a working version of Mastodon with some bits of Hometown here and there, but I still don't see the option for local only posting. If you have any suggestion other than restarting from scratch - even just for troubleshooting and understanding what's going on - let me know!

@dariusk
Copy link

dariusk commented May 8, 2022

Okay so I believe the bundler errors are fixed in #1163.

As for the lack of local-only posting UI, I am puzzled. My thought is that maybe the asset compilation step isn't finishing all the way so you're getting plain Mastodon UI. Going to look into this more.

@biglifedecision
Copy link

hi. i am also a novice ruby/git person.
i have the same issue. as OP.
my last commit was the same indicated in the docs, but i also got the error about bundler,

/home/mastodon/.rbenv/versions/3.0.3/lib/ruby/3.0.0/rubygems.rb:278:in` `find_spec_for_exe': Could not find 'bundler' (1.17.2) required by your /home/mastodon/live/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.17.2`
	from /home/mastodon/.rbenv/versions/3.0.3/lib/ruby/3.0.0/rubygems.rb:297:in `activate_bin_path'
	from /home/mastodon/.rbenv/versions/3.0.3/bin/bundle:23:in `<main>'

which i fixed by running `gem install bundler:1.17.2

during the db migrate step i was hit with this warning repeatedly:

/home/mastodon/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-1.17.2/lib/bundler/shared_helpers.rb:44: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.

running the precompile step RAILS_ENV=production bundle exec rails assets:precompile ended with 'Compilation Failed:' followed by the same error as above numerous times.
i ran RAILS_ENV=production bundle exec rails assets:precompile again and got the same error numerous times again but ending with Everything's up-to-date. Nothing to do so i assumed it had worked? not a ruby person.

so have the same issues as the OP, no local-only posting in the compose toot menu but all the other HomeTown features appear to be present in the admin panel.
other quirks are in the admin panel there are few places where things dont seem to be rendering CSS properly. for example the top left corner just has the name of my instance in default blue text. the admin dashboard the rendering of 0 pending reports > 0 pending users > 0 pending hashtags > 0 pending appeals just looks a little off, like the CSS isn't loaded.

i went through Mastodon upgrade from 3.4.6 -> 3.5.2 then the migration, so I am wondering if I should abandon ship and go back to the snapshot I took before starting, or try to fix in place.

@dariusk
Copy link

dariusk commented May 8, 2022

I suspect this is fixed in the new version. I haven't tagged it yet but could you possibly do the following:

git pull hometown hometown-dev
RAILS_ENV=production bundle exec rails assets:precompile

and then restart Mastodon services?

@biglifedecision
Copy link

output is:
Compilation failed:
without any errors. is there a log somewhere to find out why the compilation failed?
Should I still restart Mastodon services?

@biglifedecision
Copy link

after the first git pull hometown hometown-dev, here is the rest of what i've got:

mastodon@localhost:~/live$ RAILS_ENV=production bundle exec rails assets:precompile
yarn install v1.22.18
[1/6] Validating package.json...
[2/6] Resolving packages...
success Already up-to-date.
Done in 1.64s.
Compiling...
Compilation failed:

mastodon@localhost:~/live$ git pull hometown hometown-dev
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Total 2 (delta 1), reused 2 (delta 1), pack-reused 0
Unpacking objects: 100% (2/2), 240 bytes | 120.00 KiB/s, done.
From https://github.com/hometown-fork/hometown
 * branch                hometown-dev -> FETCH_HEAD
   390635e92..9fb28f425  hometown-dev -> hometown/hometown-dev
Updating 390635e92..9fb28f425
Fast-forward
 db/migrate/20190715164535_add_instance_actor.rb | 3 ---
 1 file changed, 3 deletions(-)
mastodon@localhost:~/live$ RAILS_ENV=production bundle exec rails assets:precompile
yarn install v1.22.18
[1/6] Validating package.json...
[2/6] Resolving packages...
success Already up-to-date.
Done in 2.21s.
Everything's up-to-date. Nothing to do
mastodon@localhost:~/live$ systemctl restart mastodon*

and then the services restarting

seems to not have worked. another thing i noticed is the error page (while trying to refresh my instance before the services are fully back up) just says 'Hometown' in unformatted blue and it links to example.org. so seems like something is up there.

willing to accept that the issue might be me having screwed up a step during the upgrades, or migration and now my whole environment is just messed up.

@dariusk
Copy link

dariusk commented May 8, 2022

Oh! How much RAM do you have? Sometimes a silent "Compilation failed" occurs because you have run out of memory. Usually what I do is try to stop all Mastodon processes, then run the compilation step, then bring it back up.

Eventually I got tired of my server being down and upgraded the RAM.

@biglifedecision
Copy link

2GB. I'll try to stop mastodon and then try again.

@dariusk
Copy link

dariusk commented May 8, 2022 via email

@biglifedecision
Copy link

i am worried that this happened during upgrade from 3.4.6-3.5.2 which i did today immediately preceding this. which would mean the mastodon upgrades may not have compiled properly, meaning maybe everything is toast.

running again with services stopped:

yarn install v1.22.18
[1/6] Validating package.json...
[2/6] Resolving packages...
success Already up-to-date.
Done in 1.61s.
Everything's up-to-date. Nothing to do

which looks good (success is in green!) but doesn't suggest to me that it's actually compiled again? how to i force it to compile again?

@dariusk
Copy link

dariusk commented May 8, 2022 via email

@dariusk
Copy link

dariusk commented May 8, 2022

@biglifedecision From your ~/live/ directory for the Hometown install, run:

echo "" >> app/javascript/styles/macaron.scss

This will add a blank line to the end of one of the CSS files. Then run

RAILS_ENV=production bundle exec rails assets:precompile

And it should do a compile step. Then do

git checkout app/javascript/styles/macaron.scss

which reverts the file to its original state.

@biglifedecision
Copy link

wow that is a cruel workaround. thanks rails i guess? or bundle?

i followed this: rails/webpacker#955 and modified my webpacker.yml just so i would get output from a failed compilation. seems like this low memory thing is common. so now i get:

RAILS_ENV=production bundle exec rails assets:precompile
yarn install v1.22.18
[1/6] Validating package.json...
[2/6] Resolving packages...
success Already up-to-date.
Done in 1.58s.
Compiling...
Compiled all packs in /home/mastodon/live/public/packs
Hash: 041297a3771f69f1681d
Version: webpack 4.46.0
Time: 122453ms
Built at: 05/08/2022 8:55:48 PM

followed by a very very lengthy output of i assume the compilation process(because of the mod to my webpacker config) in which i see a few warnings but seems normal?

restarting the services and our instance looks like Hometown proper. so i think it worked?

is it a coincidence that the OP hit the same combination of bundler version error + low memory? 2GB has actually been more than enough for our small but multi-user instace and all the upgrades i've gone though upgrading mainline mastodon so far. maybe the current 3.5.2 version and it's compilation has crossed some threshold for your average 2GB VPS running out of memory, and this will happen to others? or maybe it's just a coincidence?

@dariusk
Copy link

dariusk commented May 8, 2022

Yes I am 99% sure that the OP also had this low memory problem. It's actually quite common. As far back as v2 I found that you needed to stop all processes, compile, and then start, if you have 2GB of memory. Gonna close this, very very glad to hear it worked. @flavio2018 please see the above thread, I think what you need to do is:

  • stop all mastodon services
  • git pull hometown hometown-dev
  • RAILS_ENV=production bundle exec rails assets:precompile
  • start all mastodon services

@flavio2018
Copy link
Author

Hi, just writing here again to confirm that the issue was indeed the lack of memory and the bundler version error. Today I upgraded to Mastodon 3.5.2 and then migrated to Hometown and everything seems to be working fine.
Thanks a lot for the support to you all! 💖

@dariusk
Copy link

dariusk commented May 14, 2022

Great to hear it!

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