YunoHost-Apps / mastodon_ynh

Free, open-source social network for YunoHost
https://joinmastodon.org/
GNU Affero General Public License v3.0
84 stars 36 forks source link

Upgrade failed : 502 error #63

Closed anmol26s closed 6 years ago

anmol26s commented 6 years ago

Upgrade failed and mastodon stopped working.

Upgrading apps mastodon
Downloading...
Extracting...
Done
Checking required packages...
Executing script '/var/cache/yunohost/from_file/mastodon_ynh-master/scripts/upgrade'...
+ set -eu
+ source .fonctions
++ ynh_version=2.4
+ source /usr/share/yunohost/helpers
+++ run-parts --list /usr/share/yunohost/helpers.d
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/backend ']'
++ . /usr/share/yunohost/helpers.d/backend
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/filesystem ']'
++ . /usr/share/yunohost/helpers.d/filesystem
+++ CAN_BIND=1
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/ip ']'
++ . /usr/share/yunohost/helpers.d/ip
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/mysql ']'
++ . /usr/share/yunohost/helpers.d/mysql
+++ MYSQL_ROOT_PWD_FILE=/etc/yunohost/mysql
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/network ']'
++ . /usr/share/yunohost/helpers.d/network
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/package ']'
++ . /usr/share/yunohost/helpers.d/package
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/print ']'
++ . /usr/share/yunohost/helpers.d/print
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/setting ']'
++ . /usr/share/yunohost/helpers.d/setting
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/string ']'
++ . /usr/share/yunohost/helpers.d/string
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/system ']'
++ . /usr/share/yunohost/helpers.d/system
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/user ']'
++ . /usr/share/yunohost/helpers.d/user
++ for helper in '$(run-parts --list /usr/share/yunohost/helpers.d 2>/dev/null)'
++ '[' -r /usr/share/yunohost/helpers.d/utils ']'
++ . /usr/share/yunohost/helpers.d/utils
+ app=mastodon
++ ynh_app_setting_get mastodon domain
++ sudo yunohost app setting mastodon domain --output-as plain --quiet
+ domain=mast.domain.tld
++ ynh_app_setting_get mastodon path
++ sudo yunohost app setting mastodon path --output-as plain --quiet
+ path=/
++ ynh_app_setting_get mastodon admin
++ sudo yunohost app setting mastodon admin --output-as plain --quiet
+ admin=admin
++ ynh_app_setting_get mastodon language
++ sudo yunohost app setting mastodon language --output-as plain --quiet
+ language=en_EN
+ CHECK_PATH
+ '[' / '!=' / ']'
+ '[' / == / ']'
+ '[' 1 -gt 1 ']'
+ [[ admin = '' ]]
+ [[ en_EN = '' ]]
+ final_path=/opt/mastodon
+ db_name=mastodon
+ sudo sed -i s@__PATH__@mastodon@g ../conf/nginx.conf
+ sudo sed -i s@__FINALPATH__@/opt/mastodon@g ../conf/nginx.conf
+ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/mast.domain.tld.d/mastodon.conf
+ sudo systemctl stop 'mastodon-*.service'
+ sudo chown -R mastodon: /opt/mastodon/live
+ sudo su - mastodon
~/live ~
HEAD is now at 7d376e4 Adding Serbian translation (#6133)
Warning: From https://github.com/tootsuite/mastodon
Warning:  * branch            master     -> FETCH_HEAD
Already up-to-date.
+ cd /opt/mastodon/live
++ grep tag_name
++ cut '-d"' -f4
++ curl -s https://api.github.com/repos/tootsuite/mastodon/releases/latest
+ version=v2.1.0
+ sudo su - mastodon
~/live ~
Warning: Previous HEAD position was 7d376e4... Adding Serbian translation (#6133)
Warning: HEAD is now at a29432f... Bump version to 2.1.0 🎆
++ nodejs --version
+ node_version=v8.9.3
+ [[ v8.9.3 =~ ^v4.*$ ]]
+ ynh_package_install pkg-config libprotobuf-dev protobuf-compiler libicu-dev libidn11-dev postgresql-server-dev-9.4
+ ynh_apt --no-remove -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold install pkg-config libprotobuf-dev protobuf-compiler libicu-dev libidn11-dev postgresql-server-dev-9.4
+ DEBIAN_FRONTEND=noninteractive
+ sudo apt-get -y -qq --no-remove -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold install pkg-config libprotobuf-dev protobuf-compiler libicu-dev libidn11-dev postgresql-server-dev-9.4
+ sudo su - mastodon
Already up-to-date.
/opt/mastodon
Already up-to-date.
/opt/mastodon
Warning: rbenv: /opt/mastodon/.rbenv/versions/2.4.2 already exists
+ sudo ln -s /opt/mastodon/.rbenv/versions/2.4.2/bin/ruby /usr/bin/ruby
Warning: ln: failed to create symbolic link '/usr/bin/ruby': File exists
+ true
+ sudo su - mastodon
~/live ~
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Done installing documentation for bundler after 7 seconds
1 gem installed
Using rake 12.3.0
Using concurrent-ruby 1.0.5
Using i18n 0.9.1
Using minitest 5.10.3
Using thread_safe 0.3.6
Using tzinfo 1.2.4
Using activesupport 5.1.4
Using builder 3.2.3
Using erubi 1.7.0
Using mini_portile2 2.3.0
Using nokogiri 1.8.1
Using rails-dom-testing 2.0.3
Using crass 1.0.3
Using loofah 2.1.1
Using rails-html-sanitizer 1.0.3
Using actionview 5.1.4
Using rack 2.0.3
Using rack-test 0.8.2
Using actionpack 5.1.4
Using nio4r 2.1.0
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Using actioncable 5.1.4
Using globalid 0.4.1
Using activejob 5.1.4
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 5.1.4
Using activemodel 5.1.4
Using case_transform 0.2
Using jsonapi-renderer 0.2.0
Using active_model_serializers 0.10.7
Using arel 8.0.0
Using activerecord 5.1.4
Using public_suffix 3.0.1
Using addressable 2.5.2
Using encryptor 3.0.0
Using attr_encrypted 3.0.3
Using climate_control 0.2.0
Using cocaine 0.5.8
Using av 0.9.0
Using aws-sigv4 1.0.2
Using jmespath 1.3.1
Using aws-sdk-core 2.10.100
Using aws-sdk-resources 2.10.100
Using aws-sdk 2.10.100
Using bcrypt 3.1.11
Using msgpack 1.1.0
Using bootsnap 1.1.5
Using browser 2.5.2
Using bundler 1.16.1
Using charlock_holmes 0.7.5
Using chunky_png 1.3.8
Using ffi 1.9.18
Using cld3 3.2.1
Using colorize 0.8.1
Using connection_pool 2.2.1
Using orm_adapter 0.5.0
Using method_source 0.9.0
Using thor 0.20.0
Using railties 5.1.4
Using responders 2.4.0
Using warden 1.2.7
Using devise 4.3.0
Using rotp 2.1.2
Using devise-two-factor 3.0.2
Using unf_ext 0.0.7.4
Using unf 0.1.4
Using domain_name 0.5.20170404
Using doorkeeper 4.2.6
Using dotenv 2.2.1
Using dotenv-rails 2.2.1
Using et-orbi 1.0.8
Using excon 0.59.0
Using execjs 2.7.0
Using fast_blank 1.0.0
Using formatador 0.2.5
Using fog-core 1.45.0
Using multi_json 1.12.2
Using fog-json 1.0.2
Using fog-local 0.4.0
Using ipaddress 0.8.3
Using fog-openstack 0.1.22
Using http-cookie 1.0.3
Using http-form_data 1.0.3
Using http_parser.rb 0.6.0
Using http 2.2.2
Using oj 3.3.9
Using goldfinger 2.0.1
Using temple 0.8.0
Using tilt 2.0.8
Using hamlit 2.8.5
Using hamlit-rails 0.2.0
Using hamster 3.0.0
Using hiredis 0.6.1
Using hkdf 0.3.0
Using htmlentities 4.3.4
Using http_accept_language 2.1.1
Using httplog 0.99.7
Using idn-ruby 0.1.0
Using iso-639 0.2.8
Using link_header 0.0.8
Using rdf 2.2.12
Using json-ld 2.1.7
Using json-ld-preloaded 2.2.2
Using jwt 2.1.0
Using kaminari-core 1.1.1
Using kaminari-actionview 1.1.1
Using kaminari-activerecord 1.1.1
Using kaminari 1.1.1
Using request_store 1.3.2
Using lograge 0.7.1
Using redis 3.3.5
Using mario-redis-lock 1.2.0
Using mime-types-data 3.2016.0521
Using mime-types 3.1
Using mimemagic 0.3.2
Using nokogumbo 1.4.13
Using rack-protection 2.0.0
Using sidekiq 5.0.5
Using statsd-ruby 1.2.1
Using nsa 0.2.4
Using openssl 2.0.6
Using ostatus2 2.0.1
Using ox 2.8.2
Using paperclip 5.1.0
Using paperclip-av-transcoder 0.6.4
Using pg 0.21.0
Using pghero 1.7.0
Using pkg-config 1.2.8
Using puma 3.11.0
Using pundit 1.1.0
Using rack-attack 5.0.1
Using rack-cors 0.4.1
Using rack-proxy 0.6.2
Using rack-timeout 0.4.2
Using sprockets 3.7.1
Using sprockets-rails 3.2.1
Using rails 5.1.4
Using rails-i18n 5.0.4
Using rails-settings-cached 0.6.6
Using rdf-normalize 0.3.2
Using redis-store 1.4.1
Using redis-rack 2.0.3
Using redis-actionpack 5.0.2
Using redis-activesupport 5.0.4
Using redis-namespace 1.6.0
Using redis-rails 5.0.2
Using rqrcode 0.10.1
Using ruby-oembed 0.12.0
Using rufus-scheduler 3.4.2
Using sanitize 4.5.0
Using sidekiq-bulk 0.1.1
Using sidekiq-scheduler 2.1.10
Using sidekiq-unique-jobs 5.0.10
Using simple-navigation 4.0.5
Using simple_form 3.5.0
Using strong_migrations 0.1.9
Using twitter-text 1.14.7
Using tzinfo-data 1.2017.3
Using uglifier 3.2.0
Using webpacker 3.0.2
Using webpush 0.3.3
Bundle complete! 97 Gemfile dependencies, 163 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into `./vendor/bundle`
yarn install v1.3.2
[1/5] Resolving packages...
[2/5] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/5] Linking dependencies...
[4/5] Building fresh packages...
[5/5] Cleaning modules...
$ npm rebuild node-sass

> node-sass@4.7.2 install /opt/mastodon/live/node_modules/node-sass
> node scripts/install.js

node-sass build Binary found at /opt/mastodon/live/node_modules/node-sass/vendor/linux-x64-57/binding.node

> node-sass@4.7.2 postinstall /opt/mastodon/live/node_modules/node-sass
> node scripts/build.js

Binary found at /opt/mastodon/live/node_modules/node-sass/vendor/linux-x64-57/binding.node
Testing binary
Binary is fine
node-sass@4.7.2 /opt/mastodon/live/node_modules/node-sass
Done in 83.29s.
+ sudo su - mastodon
~/live ~
Webpacker is installed 🎉 🍰
Using /opt/mastodon/live/config/webpacker.yml file for setting up webpack paths
Compiling…
Compiled all packs in /opt/mastodon/live/public/packs
Warning: rails aborted!
Warning: PG::ConnectionBad: fe_sendauth: no password supplied
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/pg-0.21.0/lib/pg.rb:56:in `initialize'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/pg-0.21.0/lib/pg.rb:56:in `new'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/pg-0.21.0/lib/pg.rb:56:in `connect'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:695:in `connect'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:220:in `initialize'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/schema_migration.rb:20:in `table_exists?'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/schema_migration.rb:24:in `create_table'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1125:in `initialize'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1007:in `new'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1007:in `up'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:985:in `migrate'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:171:in `migrate'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:18:in `perform'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:46:in `invoke'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.1.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
Warning: /opt/mastodon/live/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
Warning: bin/rails:4:in `<main>'
Warning: Tasks: TOP => db:migrate
Warning: (See full trace by running task with --trace)
Error: Unable to upgrade mastodon
Error: No app to upgrade
nemsia commented 6 years ago

PG password ... strange You can try to re-launch the upgrade ? sudo yunohost app upgrade --verbose mastodon -u https://github.com/YunoHost-Apps/mastodon_ynh.git

anmol26s commented 6 years ago

Same error with same log.

anmol26s commented 6 years ago

Why the PostgreSQL don't have any password?

nemsia commented 6 years ago

All pgsql operation as made by 'postgres' user with su After many try, I can't reproduce your problem on my test server.

If you have backup of the app you can remove and restore it. Or if you not have backup you can try to make one with this command: yunohost backup create --ignore-system --apps mastodon --verbose

anmol26s commented 6 years ago

All pgsql operation as made by 'postgres' user with su

Using su as user is not a good idea.

For now,I have kind of temporary solved the issue. But I would like to play around with the setting when I get time to have a dedicated user for postgres.