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

Missing part of Production-guide #512

Closed
scroom opened this issue Jan 5, 2018 · 12 comments
Closed

Missing part of Production-guide #512

scroom opened this issue Jan 5, 2018 · 12 comments

Comments

@scroom
Copy link

scroom commented Jan 5, 2018

Hi,

I've tried to install Mastodon following the production-guide and discovered some problems:

  • You should check your locales before beginning. They should be set to an UTF-8 encoding. Mine has been set to en_US which caused problems when creating the database.

  • You have to run RAILS_ENV=production bundle exec rails db:migrate. Otherwise the installation won't work.

  • Would be fine to have some links to other tutorials: (howto create the about page ...)

@nightpool
Copy link
Member

  1. this guide was written for Ubuntu Server 16.04, as mentioned in the beginning of the document. As far as I know, by default all ubuntu server 16.04 distributions have UTF8 locales. So I think those kind of issues are somewhat out of scope for the document. What distribution/OS version were you trying to install on?

  2. did you see/successfully run this command?

    We now need to set up the PostgreSQL database for the first time:

    RAILS_ENV=production bundle exec rails db:setup
    

    this command automatically runs all migrations. I'm suspecting that your initial database problems were the reason you needed to run db:mirgate separately.

@scroom
Copy link
Author

scroom commented Jan 9, 2018

@nightpool

  1. Yes I've used Ubuntu Server 16.04 (which could be a patched version by my hoster Contabo.de? I've just chosen the automatic install on the VPS, so I don't know if they use patches)).

  2. Of course I ran this command. But in my case it just created the database and then showed an error message (which I did not copy - sorry for this).

the db:migrate solved my problems and created the missing tables.

@jmwright
Copy link

jmwright commented Jan 10, 2018

@scroom Was this the error/message you were getting when trying to run db:setup? It's what I'm seeing.

Set SAFETY_ASSURED=1 to run this task in production

Update
BTW - I ran the command as SAFETY_ASSURED=1 RAILS_ENV=production bundle exec rails db:setup to get it working.

@scroom
Copy link
Author

scroom commented Jan 11, 2018

@jmwright Yes, I've got the error message when trying to run db:setup. As mentioned, running db:migrate solved the problem for me.

Anyway the guide doesn't seem to be correct at this point.

@wxcafe
Copy link

wxcafe commented Jan 13, 2018

the first issue isn't one, your hoster is probably customizing the ubuntu image. Mastodon works only on UTF-8, as should everything since like 2005.

the second issue is caused by the error you got, which you didn't copy. I'll try to reproduce that tomorrow by installing a new mastodon VM.

@jwynn6
Copy link

jwynn6 commented Jan 17, 2018

@wxcafe Im having the same issue and my hosting provider is my laptop in the corner, no customized image there. and running the command @jmwright put in his update fixed it.

@nightpool
Copy link
Member

nightpool commented Jan 17, 2018

@jwynn6 you were having the local encoding error? or the SAFTEY_ASSURED error? this ticket has discussed multiple issues at this point.

@jwynn6
Copy link

jwynn6 commented Jan 17, 2018 via email

@joshuatj
Copy link

I've gotten this same SAFETY_ASSURED error. With 2.3.0, the setup wizard would go to the next task even though db:setup gave an error. The only way to fix it would be to run @jmwright updated command
SAFETY_ASSURED=1 RAILS_ENV=production bundle exec rails db:setup

But this way the subsequent command assets:precompile has to be entered manually. We won't be able to take advantage of the convenience of the setup wizard in creating the admin user.

The aforementioned error:
`This configuration will be written to .env.production
Save configuration? Yes

Now that configuration is saved, the database schema must be loaded.
If the database already exists, this will erase its contents.
Prepare the database now? Yes
Running RAILS_ENV=production rails db:setup ...

Database 'mastodon_production' already exists
rails aborted!
Set SAFETY_ASSURED=1 to run this task in production
/home/mastodon/live/vendor/bundle/ruby/2.5.0/gems/strong_migrations-0.1.9/lib/tasks/strong_migrations.rake:5:in block (2 levels) in <top (required)>' /home/mastodon/live/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:252:in block (3 levels) in <top (required)>'
/home/mastodon/live/vendor/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:21:in block in perform' /home/mastodon/live/vendor/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:18:in perform'
/home/mastodon/live/vendor/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/command.rb:46:in invoke' /home/mastodon/live/vendor/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in <top (required)>'
/home/mastodon/live/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in require' /home/mastodon/live/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in require'
/home/mastodon/live/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in block in require' /home/mastodon/live/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in load_dependency'
/home/mastodon/live/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in require' bin/rails:4:in

'
Tasks: TOP => db:schema:load => strong_migrations:safety_assured
(See full trace by running task with --trace)

That failed! Perhaps your configuration is not right

The final step is compiling CSS/JS assets.
This may take a while and consume a lot of RAM.
Compile the assets now? no
`

@MayhemBill
Copy link

So now since I have no Admin account during creation, how do I set one up?

@Gargron Gargron closed this as completed Oct 21, 2018
@rickersilva
Copy link

I'm having problems during mstodon setup when it says
Running RAILS_ENV=production rails db:setup ...

I understand I have to run the same command with the environment variable:
DISABLE_DATABASE_ENVIRONMENT_CHECK=1

However I'm not typing that command, it is part of the command
RAILS_ENV=production bundle exec rake mastodon:setup
that I run according to some tutorials.

My question is how can Irun that command or modified envirnemnt variables. I tried this, without different results:

mastodon@instance-1:~/live$ DISABLE_DATABASE_ENVIRONMENT_CHECK=1
mastodon@instance-1:~/live$ RAILS_ENV=production bundle exec rake mastodon:setup

Any guidance will be appreciated.

@MasterSmurf
Copy link

You have to run the command with export.
So it looks like this:

mastodon@instance-1:~/live$ export DISABLE_DATABASE_ENVIRONMENT_CHECK=1
mastodon@instance-1:~/live$ RAILS_ENV=production bundle exec rake mastodon:setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants