Lost files after upgrade, got them back, and don't really know why


(James Hahn II) #1

Can y’all help me grasp what went down here? Went to log into Docker and got a notice about an upgrade. Couldn’t tell if it was a Digital Ocean or Discourse situation, so against my better judgement I decided to run the upgrade. When it finished, my files were gone from /var/discourse. Had a backup, so I wasn’t too worried, but it was still disconcerting what with me not really knowing what I’m doing over here. Especially regretted the “37 files will be removed. Are you sure you would like to continue?” Y response.

You can see me freaking out jumping between directories trying every command I knew. Decided to go with @sam’s rails c solution here. After I did that I had no idea what to do with [1] pry(main)>, so I threw Upload.first at it and it all worked out.

Would anyone be kind enough to help me understand why?

root@bitkcor:~/var/discourse# nano containers/app.yml
root@bitkcor:~/var/discourse# ./launcher rebuild app
-bash: ./launcher: No such file or directory
root@bitkcor:~/var/discourse# ls
plss
root@bitkcor:~/var/discourse# nano /etc/nginx/conf.d/discourse.conf
root@bitkcor:~/var/discourse# open plss
root@bitkcor:~/var/discourse# cd /var/discourse/shared
root@bitkcor:/var/discourse/shared# ls
standalone
root@bitkcor:/var/discourse/shared# cd standalone
root@bitkcor:/var/discourse/shared/standalone# ls
backups      log              postgres_data  redis_data  state
letsencrypt  postgres_backup  postgres_run   ssl         uploads
root@bitkcor:/var/discourse/shared/standalone# cd ..
root@bitkcor:/var/discourse/shared# cd ..
root@bitkcor:/var/discourse# sudo ./launcher enter app
root@bitkcor-app:/var/www/discourse# ls
adminjs		 COPYRIGHT.txt		    Gemfile.lock  packaging  spec
app		 d			    images	  plugins    test
bin		 Dangerfile		    jsapp	  Procfile   tmp
Brewfile	 db			    lib		  public     vendor
config		 discourse.sublime-project  LICENSE.txt   Rakefile   yarn.lock
config.ru	 docs			    log		  README.md
CONTRIBUTING.md  Gemfile		    package.json  script
root@bitkcor-app:/var/www/discourse# cd ..
root@bitkcor-app:/var/www# cd ..
root@bitkcor-app:/var# cd /var/discourse
bash: cd: /var/discourse: No such file or directory
root@bitkcor-app:/var# cd ..
root@bitkcor-app:/# % rails c
bash: fg: %: no such job
root@bitkcor-app:/# rails c
[1] pry(main)> Upload.first
=> #<Upload:0x0000557e9b155bc0
 id: 1,
 user_id: -2,
 original_filename: "external-avatar.png",
 filesize: 19043,
 width: nil,
 height: nil,
 url:
  "/uploads/default/original/1X/ea17a258eff7a95045bda914c10bac5a2de02c62.png",
 created_at: Wed, 29 Aug 2018 03:51:05 UTC +00:00,
 updated_at: Wed, 29 Aug 2018 03:51:05 UTC +00:00,
 sha1: "ea17a258eff7a95045bda914c10bac5a2de02c62",
 origin:
  "https://cdn.discourse.org/dev/uploads/default/original/2X/e/edb63d57a720838a7ce6a68f02ba4618787f2299.png",
 retain_hours: nil,
 extension: "png",
 thumbnail_width: 360,
 thumbnail_height: 360>
[2] pry(main)> exit
root@bitkcor-app:/# exit
logout
root@bitkcor:/var/discourse# cd /var/discourse
root@bitkcor:/var/discourse# ./launcher rebuild app
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 10 app
app
cd /pups && git pull && /pups/bin/pups --stdin
Already up-to-date.
I, [2018-08-31T22:08:23.959889 #17]  INFO -- : Loading --stdin
I, [2018-08-31T22:08:23.966472 #17]  INFO -- : > locale-gen $LANG && update-locale
I, [2018-08-31T22:08:24.862684 #17]  INFO -- : Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.

(Matt Palmer) #2

/var/discourse and ~/var/discourse are not the same directory.


(James Hahn II) #3

Well, that explains a lot. Thanks @mpalmer!