Git Product home page Git Product logo

Comments (10)

rfay avatar rfay commented on July 18, 2024

This is a result of the environment variables being missing, so will be fixed with populating PLATFORM_* environment variables.

PLATFORM_APPLICATION_NAME
PLATFORM_ENVIRONMENT
PLATFORM_PROJECT
PLATFORM_ROUTES (not sure what its value could be)
PLATFORM_VARIABLES
USER

from ddev-platformsh.

rfay avatar rfay commented on July 18, 2024

Not sure the immediate OP is solvable though,
Platformsh\ConfigReader\NotValidPlatformException: No routes are defined. Are you sure you are running on Platform.sh? in /var/www/html/vendor/platformsh/config-reader/src/Config.php on line 299

No, I'm definitely not running on Platform.sh :)

from ddev-platformsh.

lolautruche avatar lolautruche commented on July 18, 2024

Mmm it's from the ConfigReader which is used in the Drupal template...

from ddev-platformsh.

lolautruche avatar lolautruche commented on July 18, 2024

Re $PLATFORM_ROUTES, here's what I have in my Symfony app on a PSH environment:

{
  "https://workshop-5ziq2gq-6j4ypl5iendqc.eu-3.platformsh.site/": {
    "primary": true,
    "id": null,
    "production_url": "https://workshop-5ziq2gq-6j4ypl5iendqc.eu-3.platformsh.site/",
    "attributes": {},
    "type": "upstream",
    "upstream": "app",
    "original_url": "https://{default}/"
  },
  "https://www.workshop-5ziq2gq-6j4ypl5iendqc.eu-3.platformsh.site/": {
    "primary": false,
    "id": null,
    "production_url": "https://www.workshop-5ziq2gq-6j4ypl5iendqc.eu-3.platformsh.site/",
    "attributes": {},
    "type": "redirect",
    "to": "https://workshop-5ziq2gq-6j4ypl5iendqc.eu-3.platformsh.site/",
    "original_url": "https://www.{default}/"
  },
  "http://workshop-5ziq2gq-6j4ypl5iendqc.eu-3.platformsh.site/": {
    "original_url": "http://{default}/",
    "id": null,
    "primary": false,
    "type": "redirect",
    "to": "https://workshop-5ziq2gq-6j4ypl5iendqc.eu-3.platformsh.site/",
    "production_url": "http://workshop-5ziq2gq-6j4ypl5iendqc.eu-3.platformsh.site/"
  },
  "http://www.workshop-5ziq2gq-6j4ypl5iendqc.eu-3.platformsh.site/": {
    "original_url": "http://www.{default}/",
    "id": null,
    "primary": false,
    "type": "redirect",
    "to": "https://www.workshop-5ziq2gq-6j4ypl5iendqc.eu-3.platformsh.site/",
    "production_url": "http://www.workshop-5ziq2gq-6j4ypl5iendqc.eu-3.platformsh.site/"
  }
}

from ddev-platformsh.

lolautruche avatar lolautruche commented on July 18, 2024

I guess it should be easy to populate this $PLATFORM_ROUTES env var based on the URL generated by DDEV:

{
  "https://bigfoot-symfony.ddev.site/": {
    "primary": true,
    "id": null,
    "production_url": "https://bigfoot-symfony.ddev.site/",
    "attributes": {},
    "type": "upstream",
    "upstream": "app",
    "original_url": "https://{default}/"
  }
}

This value would then be base64 encoded and assigned to $PLATFORM_ROUTES

Here is what I have in my .platform/routes.yaml:

# The routes of the project.
#
# Each route describes how an incoming URL is going
# to be processed by Platform.sh.

"https://{default}/":
    type: upstream
    upstream: "app:http"

"https://www.{default}/":
    type: redirect
    to: "https://{default}/"

from ddev-platformsh.

rfay avatar rfay commented on July 18, 2024

Remind me where you instructed me about all the oddball base64-encoded environment variables. I don't see it in the issues. Is it in google docs? Or just https://docs.platform.sh/development/variables/use-variables.html#use-platformsh-provided-variables I guess?

from ddev-platformsh.

lolautruche avatar lolautruche commented on July 18, 2024

PSH docs only explains that some variables like PLATFORM_ROUTES are base64-encoded JSON objects.
So assuming that you have the JSON example above in a routes.json file, you can obtain the base64 blob by doing:

cat routes.json | base64

from ddev-platformsh.

rfay avatar rfay commented on July 18, 2024

Of course... we can't assume that the base64 tool is available on the host, so there will be some issues here.

from ddev-platformsh.

lolautruche avatar lolautruche commented on July 18, 2024

Could this be done using Go somehow?

from ddev-platformsh.

rfay avatar rfay commented on July 18, 2024

Of course, but the go code doesn't know we're doing platformsh stuff. Will have to think how it could be informed or triggered.

This whole class of things is going to turn out to be fragile and not completely solvable.

from ddev-platformsh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.