webplatform/ops

Discuss prepare migration and adjust settings

Closed this issue · 4 comments

This is the parent task about migrating Specifiction Discourse installation into WebPlatform infrastructure.

Estimated steps

  • Create Piwik tracking code, add in the notes below
  • Make a full install of Discourse, made via Salt Stack, configuring automatically Docker
  • Document how to migrate a backup
  • Have fully functional site, without broken images
  • Create key sets for connected OAuth reliers: [Facebook, GitHub, Twitter, Google, Yahoo]
  • Make discourse.specifiction.org redirects to equivalent on https://discuss.webplatform.org
  • Until migration is complete; Create sticky post warning that its not migrated yet

Please do not use this forum just yet. While we plan to migrate discourse.specifiction.org into discuss.webplatform.org, the migration isn’t completed yet. Any content you write here WILL be overwritten.

Dependencies

  • Sub tasks
    • #161 so when a user sends an email to reply to a thred, email gets converted into a reply
    • #154 setup backups into DreamObjects S3 bucket
    • #163 get real IP Address behind Fastly

Time estimate

  • Spent: 16h (so far)

Work notes

This should complete what’s noted in commit webplatform/www.webplatform.org@a548a5f

In Preferences -> Admin -> Settings:

In Preferences -> Admin -> Customize:

  • Colors (create one Color scheme entry), use:
    • primary: 333
    • tertiary: 30B4C5
    • header background: 58595B
    • header primary: F0EBDD
    • highlight: FFC621
    • danger: D02E27
    • success: 75C9B3
    • love: EE677E
    • wiki: 30B4C5
  • CSS/HTML
    • in Migrated from Site Text, copy what’s in body
    • Delete Migrated from Site Text, check first if there’s something elsewhere than body
    • Create new, let’s call it Discuss, add:
      • CSS

        @font-face{
          font-family: 'Bitter';
          font-weight: normal;
          src: url('//www.webplatform.org/assets/fonts/bitter-regular-webfont.eot');
          src: url('//www.webplatform.org/assets/fonts/bitter-regular-webfont.eot?#iefix') format('embedded-opentype'),
               url('//www.webplatform.org/assets/fonts/bitter-regular-webfont.woff') format('woff'),
               url('//www.webplatform.org/assets/fonts/bitter-regular-webfont.ttf') format('truetype'),
               url('//www.webplatform.org/assets/fonts/bitter-regular-webfont.svg#BitterRegular') format('svg');
        }
        #main .extra-info h1 {
          font-size: 1.3em;
          font-family: Bitter;
          font-weight: normal;
        } 
      • body (what was in "Migrated from Site Text" at body);

        <footer id='custom-bottom' class='container'>
          <p>
            You can follow <a href='https://twitter.com/WebPlatform'>@WebPlatform</a>, or
            send feedback to <a href='https://twitter.com/robinberjon'>@robinberjon</a>.
          </p>
        </footer>
        <!-- Piwik -->
        <script type="text/javascript">
          var _paq = _paq || [];
          _paq.push(['trackPageView']);
          _paq.push(['enableLinkTracking']);
          (function() {
            var u="//stats.webplatform.org/";
            _paq.push(['setTrackerUrl', u+'piwik.php']);
            _paq.push(['setSiteId', 11]);
            var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
            g.type='text/javascript'; g.async=true; g.defer=true;g.src=u+'piwik.js';s.parentNode.insertBefore(g,s);
          })();
        </script>
        <noscript><p><img src="//stats.webplatform.org/piwik.php?idsite=11" style="border:0;" alt="" /></p></noscript>
        <!-- End Piwik Code -->
    • Click "Enabled?" checkbox at the bottom right

In states

  • Edit code/files/discuss/app.yml.jinja, replace this block;

    -  DISCOURSE_SMTP_ADDRESS: localhost
    +  DISCOURSE_SMTP_ADDRESS: {{ smtp }}
  • Ensure that Docker PostgreSQL VM (dbpostgres) has its private IP updated in private/pillar/accounts/production.sls private pillars. In contrast to MySQL config, this is where the Discourse config will get which PostgreSQL database server to connect to.

    accounts:
      discourse:
        db:
          hostname: 10.10.10.192

Here is some preliminary notes on how one can restore a Discourse instance and change the domain name. Notes will be cleaned up later.

Roughly based on Move your Discourse instance to a different server post. But without using the web UI. Because sysadmins prefers terminal.

IMPORTANT: Make SURE the backup dump was generated from the same Discourse version the one you’ll import it into.

Copy from host backup into shared folder. Imagine you uploaded via SSH in your host home directory.

cp ~/snapshot.tar.gz /srv/webplatform/shared/backups/

Note that the folder /srv/webplatform/discuss/shared/standalone/backups/ from the docker host would end up to be in /shared/backups/ inside the container.

Enter the VM, make sure enable_restore is run from discourse cli utility

./launcher enter app
discourse enable_restore

Find the mounted backup file from within the container

ll /shared/backups/default/

Make sure /shared/backups/foo.tar.gz is readable by can read

chmod o+r /shared/backups/default/foo.tar.gz
discourse restore foo.tar.gz
discourse disable_restore

Remap domain name

discourse remap discourse.specifiction.org discuss.webplatform.org

Then, work on user uploads and regenerate assets. That’ll make sure ;

rake uploads:clean_up
rake posts:rebake

Refer to

@darobin here are the notes on how to make the customizations.

I wonder, at the footer, should we change the @specifiction Twitter handle to @WebPlatform?

CC @shepazu

Sorry for double post; update I created accounts using WebPlatform accounts, where it was possible.

What’s missing:

  • Create Google OAuth secrets
  • #161 Make Discourse have automatic database backup
  • #154 Setup a mailbox w/ POP3 access for Discourse to use

"Apps" account owner relationships;

/cc @shepazu @darobin

Dropping the ball, discourse.wicg.io has been put in place.