To access a particular agent add a _host query param with the .agent url for the agent domain.
Eg. site
http://localhost:3000?_host=rampton-baseley.agent.homeflow.co.uk
Previously admin was accessed via a different _host param - please note that for standalone themes you should use the same host but visit /admin.
This query param is then stored in the _host cookie. You may need to refresh the page a few times or manually update the _host cookie when switching between the site and admin.
If working across multiple different sites at the same time, relying solely on the _host cookie can be frustrating due to the time taken for the cookie to update in the browser. In this case it can be helpful to set a new host to work in the site in /etc/hosts.
Eg. /etc/hosts
127.0.0.1 my-agency.agent.v4.homeflow.co.uk
Then visit http://my-agency.agent.v4.homeflow.co.uk:3000/
This avoids having to rely on the _host cookie to switch between different sites.
To Connect to the v4 staging MongoDB, you will need to run an SSH tunnel.
You can do that with the following command (replace user with your username):
ssh -N -L 8650:docdb.websites-v4.staging.route53.homeflow:27017 user@18.169.225.1 -o ServerAliveInterval=5 -o ServerAliveCountMax=1
You can also use the SSH Tunnels program. See the Confluence docs for further information about SSH tunnels.
Once connected to the staging MongoDB, you have two options to manage it:
To install either of the database management tools, first you will need to copy the value of .homeflow.yaml.authentication.user_secret
Once you have the user_secret, update the following command and copy it:
mongosh 'mongodb://docdb_staging_websites_v4:your_user_secret@localhost:8650?directConnection=true&retryWrites=false
And connect to the database the way you normally do first.
To install and run Compass, just follow the steps from their documentation and simply use the command you copied to open a new connection.
To install mongosh follow the steps from their documentation. Once successfully installed, run:
mongosh 'mongodb://docdb_staging_websites_v4:your_user_secret@localhost:8650?directConnection=true&retryWrites=false
use websites_v4
Similarly, if you need to connect to the Homeflow Feature Toggles Redis server, you will need to run an SSH tunnel.
You can do that with the following command (replace user with your username):
ssh -N -L 63793:feature-toggles-redis.aboarl.ng.0001.euw2.cache.amazonaws.com:6379 user@18.169.225.1 -o ServerAliveInterval=5 -o ServerAliveCountMax=1
or using SSH Tunnels linked above.
After that you can set HOMEFLOW_FEATURE_TOGGLES_REDIS_URL=redis://127.0.0.1:63793 in your .env.local to connect to the remote server.
Adding breakpoints to client side code is as simple as adding a debugger; statement, which should open the debugger in your browser's DevTools. To add breakpoints in server side code, some extra steps are required. For full details see the Next.js Guide on debugging.
In order to enable breakpoints in server side code using the Node.js Inspector, you must run the Next.js dev server with NODE_OPTIONS='--inspect'. A convience script, yarn dev:debug, has been added to the package.json to make this simpler and allow you to still run the dev server without the Inspector if preferable.
chrome://inspect/, if you are working on the Chrome browser (there are guides online for how to set up the Node debugger on other browsers, like Firefox)Configure and add both localhost:9229 and localhost:9230 if they're not already presentRemote Target section/websites_v4/node_modules/next/dist/server/lib/start-server.jsInspect to open the DevTools in a separate window and visit Sourcesyarn dev:debug but before visiting a page on localhost:3000 as the Inspector needs to be attached before hitting a debugger; breakpointlocalhost:3000debugger; statement to some server side code and you should hit your breakpoint in the DevTools