Developer portal life cycle

anton
New Member

Hello,

I have five questions.

Question number zero is - how can auto redirect HTTP to HTTPS when someone goes to http://myportal. ?

The other 4 questions are about the dev portal life cycle.

I seems that there are three versions: DEV, TEST and PROD.

I work on the DEV version and almost have it ready at http://dev-freightosdp.devportal.apigee.io

What happens when it's ready? Would it be:

  1. Release to test-freightosdp.devportal.apigee.io and QA
  2. Release to prod-freightosdp.devportal.apigee.io
  3. CNAME prod-freightosdp.devportal.apigee.io to developer.freightos.com

This is the first question.

The second question is how do I promote DEV to TEST and TEST to PROD?

The third question is should we CNAME the API domain - any reason not to do it?

The fourth question is can I then continue to work on DEV version and rest assured that TEST and PROD aren't changing until I release the DEV?

Solved Solved
1 6 468
1 ACCEPTED SOLUTION

@Anton+Bar , Find answers below.

How can auto redirect HTTP to HTTPS when someone goes to http://myportal. ?

  • It's explained in detail here.
  • Checkout codebase using git into your local machine
  • Edit settings.php
  • Paste below code at the end of the file,
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) && php_sapi_name() != 'cli') {
  // Redirect to https://$primary_domain in the Live environment
  if ($_ENV['PANTHEON_ENVIRONMENT'] === 'live') {
    /** Replace www.example.com with your registered domain name */
    $primary_domain = 'www.example.com';
  }
  else {
    // Redirect to HTTPS on every Pantheon environment.
    $primary_domain = $_SERVER['HTTP_HOST'];
  }

  if ($_SERVER['HTTP_HOST'] != $primary_domain
      || !isset($_SERVER['HTTP_X_SSL'])
      || $_SERVER['HTTP_X_SSL'] != 'ON' ) {

    # Name transaction "redirect" in New Relic for improved reporting (optional)
    if (extension_loaded('newrelic')) {
      newrelic_name_transaction("redirect");
    }

    header('HTTP/1.0 301 Moved Permanently');
    header('Location: https://'. $primary_domain . $_SERVER['REQUEST_URI']);
    exit();
  }
}
  • Git add , commit , push

Regarding migrating changes between environments,

  • Yes, Dev is for development. Test is for QA & Live is for production.
  • You will move code & database first time from Dev -> Test -> Live
  • Subsequent releases, You will move only code from Dev -> Test -> Live. Config (Admin Screen) changes need to be redone / migrate as code using module like features that comes out of the box with Apigee Developer Portal. You might not do config changes frequently.
  • See the workflow process as explained in Pantheon here.
  • Note : Do not overwrite Dev or Test database with live after initial promotion. Doing so, You might loose content generated in live portal like users registered, forum posts etc. See the workflow process as explained in Pantheon here & configuration migration options.
  • Take backups before each migration. Automatic backups can be configured. See more about same here.

The third question is should we CNAME the API domain - any reason not to do it?

The fourth question is can I then continue to work on DEV version and rest assured that TEST and PROD aren't changing until I release the DEV?

  • Yes, Absolutely.

Hope it helps. Keep us posted if you see any issues while setting up same.

View solution in original post

6 REPLIES 6

anton
New Member

I already found how to promote to Test and Live but it's not clear to me - should we CNAME it on our end or use Pantheon to do it. Pantheon documentation is written as though we're running our main site on their system, but we're not. We just want to cname developer.freightos.com to live-freightosdp.devportal.apigee.io.

@Anton+Bar , Find answers below.

How can auto redirect HTTP to HTTPS when someone goes to http://myportal. ?

  • It's explained in detail here.
  • Checkout codebase using git into your local machine
  • Edit settings.php
  • Paste below code at the end of the file,
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) && php_sapi_name() != 'cli') {
  // Redirect to https://$primary_domain in the Live environment
  if ($_ENV['PANTHEON_ENVIRONMENT'] === 'live') {
    /** Replace www.example.com with your registered domain name */
    $primary_domain = 'www.example.com';
  }
  else {
    // Redirect to HTTPS on every Pantheon environment.
    $primary_domain = $_SERVER['HTTP_HOST'];
  }

  if ($_SERVER['HTTP_HOST'] != $primary_domain
      || !isset($_SERVER['HTTP_X_SSL'])
      || $_SERVER['HTTP_X_SSL'] != 'ON' ) {

    # Name transaction "redirect" in New Relic for improved reporting (optional)
    if (extension_loaded('newrelic')) {
      newrelic_name_transaction("redirect");
    }

    header('HTTP/1.0 301 Moved Permanently');
    header('Location: https://'. $primary_domain . $_SERVER['REQUEST_URI']);
    exit();
  }
}
  • Git add , commit , push

Regarding migrating changes between environments,

  • Yes, Dev is for development. Test is for QA & Live is for production.
  • You will move code & database first time from Dev -> Test -> Live
  • Subsequent releases, You will move only code from Dev -> Test -> Live. Config (Admin Screen) changes need to be redone / migrate as code using module like features that comes out of the box with Apigee Developer Portal. You might not do config changes frequently.
  • See the workflow process as explained in Pantheon here.
  • Note : Do not overwrite Dev or Test database with live after initial promotion. Doing so, You might loose content generated in live portal like users registered, forum posts etc. See the workflow process as explained in Pantheon here & configuration migration options.
  • Take backups before each migration. Automatic backups can be configured. See more about same here.

The third question is should we CNAME the API domain - any reason not to do it?

The fourth question is can I then continue to work on DEV version and rest assured that TEST and PROD aren't changing until I release the DEV?

  • Yes, Absolutely.

Hope it helps. Keep us posted if you see any issues while setting up same.

@Anil Sagar - Re the CNAME - should we CNAME It in our own DNS provider or just can add developer.freightos.com under the Pantheon manager?

@Anton+Bar , You need to add developer.freightos.com under pantheon live instance domains settings as explained here & then update CNAME in your DNS provider. You can find the CNAME details in domain name details button in Pantheon. See screenshots below.

https://pantheon.io/docs/godaddy/

5607-pap1.png

5608-pap2.png

5609-pap3.png

Hope it helps. Keep us posted.

@Anton+Bar , Feel free to accept the answer if your query is resolved so that it will be helpful for others too.

Keep us posted moving forward if any.

sorry was abroad, thanks for all the very valuable help!