platformsh / platformify

Get your project ready to be deployed in Platform.sh
MIT License
2 stars 8 forks source link

Relationship error running upsunify on a new Laravel app #136

Closed thomasdiluccio closed 1 year ago

thomasdiluccio commented 1 year ago

I tried to upsunify a new Laravel app. I picked mariadDB but couldn’t push as I got this error:

E: Error parsing configuration files:
      - config.yaml:laravel-upsun-from-scratch: Relationship ‘mariadb’ of application ‘laravel-upsun-from-scratch’ defined in ‘config.yaml:laravel-upsun-from-scratch’ targets invalid endpoint ‘mariadb’.

Here's the generated .upsun/config.yamlfile

 # Complete list of all available properties: https://docs.deployfriday.net/create-apps/app-reference.html
applications:
  laravel-upsun-from-scratch:
    # Application source code directory
    source:
      root: "/app"

    # The runtime the application uses.
    # Complete list of available runtimes: https://docs.deployfriday.net/create-apps/app-reference.html#types
    type: "php:8.2"

    # How many resources to devote to the app. Defaults to AUTO in production environments.
    # More information: https://docs.deployfriday.net/create-apps/app-reference.html#sizes
    # size:

    # The relationships of the application with services or other applications.
    # The left-hand side is the name of the relationship as it will be exposed
    # to the application in the UPSUN_RELATIONSHIPS variable. The right-hand
    # side is in the form `<service name>:<endpoint name>`.
    # More information: https://docs.deployfriday.net/create-apps/app-reference.html#relationships
    relationships:
      mariadb: "mariadb:mariadb"

    # Mounts define directories that are writable after the build is complete.
    # More information: https://docs.deployfriday.net/create-apps/app-reference.html#mounts
    mounts:
      "/.config":
        source: "local"
        source_path: "config"

      "bootstrap/cache":
        source: "local"
        source_path: "cache"

      "storage":
        source: "local"
        source_path: "storage"

    # The web key configures the web server running in front of your app.
    # More information: https://docs.deployfriday.net/create-apps/app-reference.html#web
    web:
      # Commands are run once after deployment to start the application process.
      # More information: https://docs.deployfriday.net/create-apps/app-reference.html#web-commands
      # commands:
        # The command to launch your app. If it terminates, it’s restarted immediately.
      #   You can use the $PORT or the $SOCKET environment variable depending on the socket family of your upstream
      #   PHP applications run PHP-fpm by default
      #   Read about alternative commands here: https://docs.deployfriday.net/languages/php.html#alternate-start-commands
      #   start: echo 'Put your start command here'
      # You can listen to a UNIX socket (unix) or a TCP port (tcp, default).
      # For PHP, the defaults are configured for PHP-FPM and shouldn't need adjustment.
      # Whether your app should speak to the webserver via TCP or Unix socket. Defaults to tcp
      # More information: https://docs.deployfriday.net/create-apps/app-reference.html#where-to-listen
      # upstream:
      #  socket_family: unix
      # Each key in locations is a path on your site with a leading /.
      # More information: https://docs.deployfriday.net/create-apps/app-reference.html#locations
      locations:
        "/":
          passthru: "/index.php"
          root: "app/public"

    # Alternate copies of the application to run as background processes.
    # More information: https://docs.deployfriday.net/create-apps/app-reference.html#workers
    # workers:

    # The timezone for crons to run. Format: a TZ database name. Defaults to UTC, which is the timezone used for all logs
    # no matter the value here. More information: https://docs.deployfriday.net/create-apps/timezone.html
    # timezone: <time-zone>

    # Access control for roles accessing app environments.
    # More information: https://docs.deployfriday.net/create-apps/app-reference.html#access
    # access:

    # Variables to control the environment. More information: https://docs.deployfriday.net/create-apps/app-reference.html#variables
    # variables:
    #   env:
    #     # Add environment variables here that are static.
    #     XDEBUG_MODE: off

    # Outbound firewall rules for the application. More information: https://docs.deployfriday.net/create-apps/app-reference.html#firewall
    # firewall:

    # Specifies a default set of build tasks to run. Flavors are language-specific.
    # More information: https://docs.deployfriday.net/create-apps/app-reference.html#build
    build:
      flavor: none

    # Installs global dependencies as part of the build process. They’re independent of your app’s dependencies and
    # are available in the PATH during the build process and in the runtime environment. They’re installed before
    # the build hook runs using a package manager for the language.
    # More information: https://docs.deployfriday.net/create-apps/app-reference.html#dependencies
    dependencies:
      php:
        composer/composer: "^2"

    # Hooks allow you to customize your code/environment as the project moves through the build and deploy stages
    # More information: https://docs.deployfriday.net/create-apps/app-reference.html#hooks
    hooks:
      # The build hook is run after any build flavor.
      # More information: https://docs.deployfriday.net/create-apps/hooks/hooks-comparison.html#build-hook
      build: |
        set -eux
        composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader --no-dev

      # The deploy hook is run after the app container has been started, but before it has started accepting requests.
      # More information: https://docs.deployfriday.net/create-apps/hooks/hooks-comparison.html#deploy-hook
      deploy: |
        set -eux
        php artisan optimize:clear
        php artisan migrate --force

      # The post_deploy hook is run after the app container has been started and after it has started accepting requests.
      # More information: https://docs.deployfriday.net/create-apps/hooks/hooks-comparison.html#deploy-hook
      # post_deploy: |

    # Scheduled tasks for the app.
    # More information: https://docs.deployfriday.net/create-apps/app-reference.html#crons
    # crons:

    # Customizations to your PHP or Lisp runtime. More information: https://docs.deployfriday.net/create-apps/app-reference.html#runtime
    # runtime:

    # More information: https://docs.deployfriday.net/create-apps/app-reference.html#additional-hosts
    # additional_hosts:

# The services of the project.
#
# Each service listed will be deployed
# to power your Upsun project.
# More information: https://docs.deployfriday.net/add-services.html
# Full list of available services: https://docs.deployfriday.net/add-services.html#available-services
services:
  mariadb:
    type: mariadb:10.6 # All available versions are: 10.6, 10.5, 10.4, 10.3

# The routes of the project.
#
# Each route describes how an incoming URL is going
# to be processed by Upsun.
# More information: https://docs.deployfriday.net/define-routes.html
routes:
  "https://{default}/":
    type: upstream
    upstream: "laravel-upsun-from-scratch:http"
  # A basic redirect definition
  # More information: https://docs.deployfriday.net/define-routes.html#basic-redirect-definition
  "https://www.{default}":
    type: redirect
    to: "https://{default}/"
lolautruche commented 1 year ago

Services don't always have straightforward endpoints:

akalipetis commented 1 year ago

Thanks @lolautruche - I have updated the PR with Chrome Headless as well. The others match their name.