Migrating uploads from one site to another


(Matthew Gaudet) #1

So, the tool below

Worked wonders for my original question, migrating threads.

Now I seem to be having some issues with migrating uploads

From the original server, I tar'd up /var/discourse/shared/standalone/uploads. Then I hand merged the old uploads folder with the new install’s uploads folder.

Now, if I visit an archived thread, and try to get to an attachment, I see the following:

  1. 404 in the NGINX logs.

    [02/Dec/2016:15:59:53 +0000] 9.26.154.228 "GET /uploads/default/original/1X/ea3407bf7edcfec409c0363d0035ff57019ce0e9.odp HTTP/1.1" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0" "uploads/show" 404 1059 
    
  2. The file appearing to exist on the new server

    (new) # find . -name ea3407bf7edcfec409c0363d0035ff57019ce0e9.odp 
    ./shared/standalone/uploads/default/original/1X/ea3407bf7edcfec409c0363d0035ff57019ce0e9.odp
    
  3. The file existing on the old server in the same directory:

    (old) # find . -name ea3407bf7edcfec409c0363d0035ff57019ce0e9.odp
    ./shared/standalone/uploads/default/original/1X/ea3407bf7edcfec409c0363d0035ff57019ce0e9.odp
    
  4. Access to the original file via the original install works:

    [02/Dec/2016:16:09:14 +0000] 9.26.154.228 "GET /uploads/default/original/1X/ea3407bf7edcfec409c0363d0035ff57019ce0e9.odp HTTP/1.1" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0" "-" 200 1440294 
    
  5. Identical permissions and users (from inside container) on the file:

    (new/old) # ls -la /shared/uploads/default/original/1X/ea3407bf7edcfec409c0363d0035ff57019ce0e9.odp 
    -rw-r--r-- 1 discourse www-data 1439352 Aug  4 13:15 /shared/uploads/default/original/1X/ea3407bf7edcfec409c0363d0035ff57019ce0e9.odp
    

Any suggestions on where to look next?


(Rafael dos Santos Silva) #2

Problably they don’t exist in the uploads table?


(Matthew Gaudet) #3

Is there a way I should be rebuilding the uploads table?

Also, should i have transferred the uploads before importing a category perhaps?


(Jeff Atwood) #4

Good question, any ideas @tgxworld or @zogstrip?


Topic and Category Export/Import
(Alan Tan) #5

@Matthew_Gaudet oops sorry for the late reply here. Hmm the path looks correct to me so the uploads should be served by nginx. Are you still facing this problem?


(Matthew Gaudet) #6

Unfortunately, as a result of this issue, we abandoned the partial-category migration approach, and switched to just migrating an entire backup.

So, I never resolved it, but it’s no longer causing us issues.