Can't restore from backup

Hello there,

I have a backup from a hosted discourse instance that I’m trying to move to a privately-hosted instance, and I’m running into errors while attempting to restore the backed up configuration from the original hosted site. I followed the instructions for creating a standalone docker-based install, and everything worked until I uploaded my backup and hit “restore”. After waiting a few minutes with nothing being output to the console and my CPUs being rather quiet, I tried refreshing the page, and got an HTTP 500. Looking at the console logs when I tried to view them, I get the following:

2017-03-14 00:25:02 UTC [5774-1] discourse@discourse ERROR:  column topics.bookmark_count does not exist at character 1730
2017-03-14 00:25:02 UTC [5774-2] discourse@discourse STATEMENT:  SELECT  "topics"."id" AS t0_r0, "topics"."title" AS t0_r1, "topics"."last_posted_at" AS t0_r2, "topics"."created_at" AS t0_r3, "topics"."updated_at" AS t0_r4, "topics"."views" AS t0_r5, "topics"."posts_count" AS t0_r6, "topics"."user_id" AS t0_r7, "topics"."last_post_user_id" AS t0_r8, "topics"."reply_count" AS t0_r9, "topics"."featured_user1_id" AS t0_r10, "topics"."featured_user2_id" AS t0_r11, "topics"."featured_user3_id" AS t0_r12, "topics"."avg_time" AS t0_r13, "topics"."deleted_at" AS t0_r14, "topics"."highest_post_number" AS t0_r15, "topics"."image_url" AS t0_r16, "topics"."like_count" AS t0_r17, "topics"."incoming_link_count" AS t0_r18, "topics"."category_id" AS t0_r19, "topics"."visible" AS t0_r20, "topics"."moderator_posts_count" AS t0_r21, "topics"."closed" AS t0_r22, "topics"."archived" AS t0_r23, "topics"."bumped_at" AS t0_r24, "topics"."has_summary" AS t0_r25, "topics"."vote_count" AS t0_r26, "topics"."archetype" AS t0_r27, "topics"."featured_user4_id" AS t0_r28, "topics"."notify_moderators_count" AS t0_r29, "topics"."spam_count" AS t0_r30, "topics"."pinned_at" AS t0_r31, "topics"."score" AS t0_r32, "topics"."percent_rank" AS t0_r33, "topics"."subtype" AS t0_r34, "topics"."slug" AS t0_r35, "topics"."auto_close_at" AS t0_r36, "topics"."auto_close_user_id" AS t0_r37, "topics"."auto_close_started_at" AS t0_r38, "topics"."deleted_by_id" AS t0_r39, "topics"."participant_count" AS t0_r40, "topics"."word_count" AS t0_r41, "topics"."excerpt" AS t0_r42, "topics"."pinned_globally" AS t0_r43, "topics"."auto_close_based_on_last_post" AS t0_r44, "topics"."auto_close_hours" AS t0_r45, "topics"."pinned_until" AS t0_r46, "topics"."fancy_title" AS t0_r47, "topics"."highest_staff_post_number" AS t0_r48, "topics"."bookmark_count" AS t0_r49, "topics"."off_topic_count" AS t0_r50, "topics"."illegal_count" AS t0_r51, "topics"."inappropriate_count" AS t0_r52, "topics"."notify_user_count" AS t0_r53, "topics"."featured_link" AS t0_r54, "categories"."id" AS t1_r0, "categories"."name" AS t1_r1, "categories"."color" AS t1_r2, "categories"."topic_id" AS t1_r3, "categories"."topic_count" AS t1_r4, "categories"."created_at" AS t1_r5, "categories"."updated_at" AS t1_r6, "categories"."user_id" AS t1_r7, "categories"."topics_year" AS t1_r8, "categories"."topics_month" AS t1_r9, "categories"."topics_week" AS t1_r10, "categories"."slug" AS t1_r11, "categories"."description" AS t1_r12, "categories"."text_color" AS t1_r13, "categories"."read_restricted" AS t1_r14, "categories"."auto_close_hours" AS t1_r15, "categories"."post_count" AS t1_r16, "categories"."latest_post_id" AS t1_r17, "categories"."latest_topic_id" AS t1_r18, "categories"."position" AS t1_r19, "categories"."parent_category_id" AS t1_r20, "categories"."posts_year" AS t1_r21, "categories"."posts_month" AS t1_r22, "categories"."posts_week" AS t1_r23, "categories"."email_in" AS t1_r24, "categories"."email_in_allow_strangers" AS t1_r25, "categories"."topics_day" AS t1_r26, "categories"."posts_day" AS t1_r27, "categories"."logo_url" AS t1_r28, "categories"."background_url" AS t1_r29, "categories"."allow_badges" AS t1_r30, "categories"."name_lower" AS t1_r31, "categories"."auto_close_based_on_last_post" AS t1_r32, "categories"."topic_template" AS t1_r33, "categories"."suppress_from_homepage" AS t1_r34, "categories"."contains_messages" AS t1_r35, "categories"."sort_order" AS t1_r36, "categories"."sort_ascending" AS t1_r37, "categories"."uploaded_logo_id" AS t1_r38, "categories"."uploaded_background_id" AS t1_r39, "categories"."topic_featured_link_allowed" AS t1_r40, "categories"."all_topics_wiki" AS t1_r41, "categories"."show_subcategory_list" AS t1_r42, "categories"."num_featured_topics" AS t1_r43, "categories"."default_view" AS t1_r44, "categories"."subcategory_list_style" AS t1_r45 FROM "topics" INNER JOIN "top_topics" ON "top_topics"."topic_id" = "topics"."id" LEFT OUTER JOIN "categories" ON "categories"."id" = "topics"."category_id" WHERE (topics.archetype <> 'private_message') AND "topics"."visible" = 't' AND ("topics"."id" NOT IN (21, 3, 114, 2049, 284, 314, 18, 2, 241, 1378, 384, 88, 86, 316, 315, 89, 13, 14, 90, 290, 283, 197, 129, 19)) AND (topics.deleted_at IS NULL) AND (topics.category_id IS NULL or topics.category_id IN (15,28,21,23,7,3,18,26,11,10,25,24,12,5,6,13,22,1,20,17,16,8)) AND (top_topics.monthly_score > 0)  ORDER BY COALESCE(top_topics.monthly_score, 0) DESC, topics.bumped_at DESC LIMIT 30

The site is now completely knackered, what do I need to do in order to get my site transfer to complete?

Are you sure the backup is from the same or older version of Discourse?

the lack of UI feedback on restores is a known bug at the moment cc @zogstrip

I’m not entirely sure how to tell what version of Discourse I’m running. The web interface is completely unresponsive, (all I can get are HTTP 500 errors) so I’ve tried entering the docker container and poking around to find a version number somewhere. It looks like I’m on the tests-pass git branch when I look at the code checkout within the docker container, which was last updated today, and my backup is from a few days ago, so I’m fairly certain that I’m not trying to load in backup from a newer version of Discourse.

Have you tried restoring the backup from the command line?

cd /var/discourse
./launcher enter app
discourse restore <backup.tar.gz>
5 Likes

As my first step of trying to do this, I ran ./launcher rebuild app and when it came up, it was populated the data from the restore. I didn’t trust this, as I was afraid that the backup might be half-baked, so I ran the restore again, and it seems to have gone through this time. Thanks!

2 Likes

Note that it takes a few minutes after the restore process reports being through before the database gets migrated over. I was totally freaked out. Posts were there, but not site settings, and users weren’t there so it thought I needed to run the wizard. After a couple minutes, it was fine.

To enable restore from the command line see this post.

The console method worked like a charm, just couple of minutes!!

Web Restore took more than 15 minutes with 500 error at last… (tried couple of times)

What I did was, removed the directory /var/discourse and re-setup the forum. Is there any other way to do this? If 500 error comes, we cannot access the forum console by ./launcher enter app.

Please advise @sam

Did it work like a charm or not?

If the forum took 15 minutes to restore, it’s either huge or your computer is very slow. If you’re getting 500 errors and you can’t access the machine from the console you are almost certainly out of ram. You should add ram and perhaps some swap.

How many posts? How much ram?

2 Likes

Backup file size: 100MB
RAM: 1GB
SWAP: 2GB, I suppose.

Posts I don’t remember exactly as of now.

The web UI did’nt continue after “Notifying ADMIN_USER…”

May I know why console method worked in couple of minutes?

How long did you wait after the restore? Have you restarted the container?

It sounds like your computer is to slow.

1 Like

Alright. Anyway, I was successful with Console restore. Will try web next time I get a chance.

2 Likes

Probably cause you are seriously memory constrained and you simply ran out of memory.

3 Likes

That sounds promising… will surely try out the web version with better RAM and see how it works. :slight_smile: