neos / neos-development-collection

The unified repository containing the Neos core packages, used for Neos development.
https://www.neos.io/
GNU General Public License v3.0
260 stars 220 forks source link

Running Neos on homestead/virtualbox with port 8000 #1818

Open simonschaufi opened 6 years ago

simonschaufi commented 6 years ago

Description

I use Laravel Homestead for all my projects as virtualbox. Neos 3.1 was the latest version that was running well with it. To access the box, I need to tunnel my requests into the box via the port 8000.

Steps to Reproduce

  1. Go to http://neosio.app:8000/neos/
  2. Login
  3. Wait until Loading... is finished (which never happens)

Expected behavior

  1. The brand new react backend is loaded.
  2. http://neosio.app/neos/schema/node-type?version=1513815843 is loaded with port 8000
  3. I would also expect that the baseUri setting in Configuration/Settings.yaml is used.

Actual behavior

Shows Loading... forever

Affected Versions

Neos: 3.3

Flow: 4.3

My windows hosts file:

127.0.0.1   neosio.app

Configuration/Settings.yaml

Neos:
  Flow:
    persistence:
      backendOptions:
        host: 127.0.0.1
        driver: pdo_mysql
        dbname: neosio
        user: homestead
        password: secret
    http:
      baseUri: http://neosio.app:8000/
    resource:
      targets:
        localWebDirectoryStaticResourcesTarget:
          targetOptions:
            relativeSymlinks: true
        localWebDirectoryPersistentResourcesTarget:
          targetOptions:
            relativeSymlinks: true
    session:
      inactivityTimeout: 0
  Imagine:
    driver: Gd

If it would help, I can prepare a box that I can share so that you don't have to setup everything by yourself.

robertlemke commented 6 years ago

I can confirm this behavior, we also have problems running Neos 3.3 in our Docker development environment with custom ports.

The frontend works fine and does use the http:baseUri setting, however, the Neos login and UI don't. For example, when I run http://my-project.localhost:8080/neos! I'll be redirected to http://my-project.localhost/neos/login (note the missing port).

The base URI settings using the port did work on Neos 3.2 with the latest dev-master of the UI and compiled UI.

kdambekalns commented 6 years ago

So it seems as if @bwaidelich might be interested to have a look - could this be related to the routing changes?

bwaidelich commented 6 years ago

It's quite possible a bug related to the routing change o.O I'll try to reproduce this and look into it.

Weird thought, that this only seems to affect the neos login!? Did you guys already debug the BackendRedirectionService?

bwaidelich commented 6 years ago

Sorry folks, I can't reproduce this in my local dev environment: I've set up a fresh Neos 3.3, configured the baseUri to be http://neos33.localhost:8000 and started the server via ./flow server:run --port 8000 and everything seems to work as expected.

Is this maybe related to some proxy?

simonschaufi commented 6 years ago

Since the url in Windows is with a port (8000) but in the vm without (80), I guess it catches the header information instead of the proxy url. It seams it only breaks when you have port mappings.

kitsunet commented 6 years ago

Could someone (@simonschaufi) maybe share a config for homestead? I have no clue how I setup neos with homestead in the easiest way?

simonschaufi commented 6 years ago

Sure.

  1. I installed homestead in C:/Users/[user]/Homestead and to start the box I run vagrant up
  2. I access the box with putty: vagrant@127.0.0.1:2222
  3. I shared the folder C:/Users/[user]/Code/neos.io so that I can access it on windows

Let's imagine i want to code on neos.io

C:\Users\[user]\Homestead\Homestead.yaml:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
ssl: true

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Code
      to: /home/vagrant/Code

sites:
  - map: neosio.app
    to: /home/vagrant/Code/neos.io/Web
    params:
      - key: FLOW_PATH_TEMPORARY_BASE
        value: /tmp/neos.io
      - key: FLOW_REWRITEURLS
        value: "1"

databases:
    - neosio

I patched the flow file to keep the temporary folder out of the windows mapping as neos was not working properly otherwise:

#!/usr/bin/env php
<?php
putenv('FLOW_PATH_TEMPORARY_BASE=/tmp/neos.io');

require(__DIR__ . '/Packages/Framework/Neos.Flow/Scripts/flow.php');

Windows hosts file:

127.0.0.1   neosio.app

I actually figured out that by using a different ip in the windows hosts file, I can leave out the port in the url, then I don't have the mentioned problem any more. Still neos should support port forwarding:

192.168.10.10   neosio.app