Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL2 - Issue with upgrading #220

Closed
ihor-sviziev opened this issue Aug 26, 2020 · 37 comments
Closed

WSL2 - Issue with upgrading #220

ihor-sviziev opened this issue Aug 26, 2020 · 37 comments
Labels
bug Something isn't working
Milestone

Comments

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Aug 26, 2020

After running brew upgrade davidalger/warden/warden (upgrade from 0.9.0 to 0.9.1) and warden svc up I got the following message:
image

Everything else works fine

Here is end of the output of bash -x warden install

+ [[ -f /home/linuxbrew/.linuxbrew/Cellar/warden/0.9.1/commands/install.cmd ]]
+ WARDEN_CMD_VERB=install
+ WARDEN_CMD_EXEC=/home/linuxbrew/.linuxbrew/Cellar/warden/0.9.1/commands/install.cmd
+ WARDEN_CMD_HELP=/home/linuxbrew/.linuxbrew/Cellar/warden/0.9.1/commands/install.help
+ shift
+ ((  0  ))
+ [[ -n '' ]]
+ source /home/linuxbrew/.linuxbrew/Cellar/warden/0.9.1/commands/install.cmd
++ [[ ! -n /home/linuxbrew/.linuxbrew/Cellar/warden/0.9.1 ]]
++ source /home/linuxbrew/.linuxbrew/Cellar/warden/0.9.1/utils/install.sh
+++ [[ ! -n /home/linuxbrew/.linuxbrew/Cellar/warden/0.9.1 ]]
++ [[ ! -d /home/ihor/.warden/ssl/rootca ]]
++ [[ ! -f /home/ihor/.warden/ssl/rootca/private/ca.key.pem ]]
++ [[ ! -f /home/ihor/.warden/ssl/rootca/certs/ca.cert.pem ]]
++ [[ linux-gnu =~ ^linux ]]
++ [[ -d /etc/pki/ca-trust/source/anchors ]]
++ [[ linux-gnu =~ ^linux ]]
++ [[ -d /usr/local/share/ca-certificates ]]
++ [[ ! -f /usr/local/share/ca-certificates/warden-proxy-local-ca.crt ]]
++ [[ linux-gnu == \d\a\r\w\i\n* ]]
++ [[ linux-gnu =~ ^linux ]]
++ [[ ! -f /home/ihor/.warden/nodnsconfig ]]
++ systemctl status NetworkManager
++ grep 'active (running)'
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
++ [[ ! -f /home/ihor/.warden/tunnel/ssh_key ]]
++ [[ ! -d /home/ihor/.composer ]]
++ [[ linux-gnu =~ ^linux ]]
+++ stat -c %U /home/ihor/.warden/tunnel/ssh_key.pub
++ [[ root != \r\o\o\t ]]
++ installSshConfig
++ grep '## WARDEN START ##' /etc/ssh/ssh_config
@lbajsarowicz
Copy link
Contributor

lbajsarowicz commented Aug 26, 2020

This is related to the fact that Warden tries to use systemctl which is not available in WSL2.
You need to put flag in warden home directory nodnsconfig or something like that and the it'll run.

https://github.com/davidalger/warden/blob/1791c855cac100f76acb45b228ca62b55a620f1f/commands/install.cmd#L57

What is more - with the latest updates of either Warden, Docker or WSL2 - you can no longer use /c/ as Home directory for Warden, as it fails on ownership mounted with docker-compose (all the files have 0777 permissions)

@ihor-sviziev
Copy link
Contributor Author

ihor-sviziev commented Aug 26, 2020

@lbajsarowicz basically you shouldn't use /c/ as a home directory for warden, it should be stored on the linux filesystem as on wsl2 disk performance on the linux fs is much better.

I would say in case of WSL2 and windows 10 we have to configure DNS server and import root dns cert manually. Maybe in case of WSL2 it's better to write some article and show the link here

@lbajsarowicz
Copy link
Contributor

All the project files are kept in WSL storage, however the configuration files for some reason were recommended to be put in /c/ by @erikhansen but it no longer works ( https://gist.github.com/erikhansen/63c2d2fa88fa2102dc43c89ff1d980fa )

@davidalger
Copy link
Collaborator

the configuration files for some reason were recommended to be put in /c/ by @erikhansen but it no longer works

So that note on the above Gist was a very first attempt to get stuff running on WSL1. I've been told by @LeeSaferite that the only reason it should have failed without moving the home directory is due to the home directory at ~/ in the WSL environment not having been shared with Docker Desktop. Haven't tested that myself; only tested WSL2 myself which does NOT require moving the home directory using WARDEN_HOME_DIR setting.

@lbajsarowicz is correct about where these come from:

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

I posted something here about this: #185 (comment)

The TL:DR is I'm planning on stripping that part of the install procedure out entirely in 0.10.0 due to it both causing erroneous messages on WSL, not always working right on Linux (depends on how the network is setup), and concluding that having the install procedure modify network settings on Linux which ends up on pushing all DNS traffic through this dnsmasq container likely without the user knowing it in many cases is a bit too heavy handed. On MacOS (thanks to it's BSD roots) the auto-configuration simply drops a file at /etc/resolver/test which sends only the DNS reqs for the .test TLD to dnsmasq; if there is a way to configure Linxu to send only a specific TLD to the dnsmasq container I'm unaware of it.

I'll leave this open until it's been addressed, but these warnings / errors should simply be able to be ignored since they're coming from the conditional checks in the install procedure.

@davidalger davidalger added the bug Something isn't working label Aug 26, 2020
@davidalger davidalger added this to the Warden 0.10.0 milestone Aug 26, 2020
@erikhansen
Copy link
Contributor

Does anyone have documented steps for installing Warden on WSL2? Something similar to this Gist for WSL1.

I have a client who has a frontend developer joining their team, and it seems like WSL2 is the way to go (over WSL1).

@lbajsarowicz
Copy link
Contributor

I have such documentation, I need to translate it to English.

@davidalger
Copy link
Collaborator

@erikhansen Don't have anything written myself personally, but when I ran through the process using Win 10 running via Bootcamp on my MBP it was pretty smooth. Installed it on Ubuntu 20 if I recall correctly. There are some warnings to ignore when Warden installs, and dnsmasq isn't going to be automatically configured, so I set 127.0.0.1 as the DNS server with 1.1.1.1 as a fallback on the WiFi network interface and it just worked for me. There's some written info on setting DNS resolution in another project's docs here: https://devilbox.readthedocs.io/en/latest/howto/dns/add-custom-dns-server-on-win.html#howto-add-custom-dns-server-on-win

@lbajsarowicz I know based on our chats that you have more info in your writeup since you've helped others get past some common hypervisor issues (I think?) — Any chance you could share it as-is, and maybe myself or Erik could run it through Google Translate and then clean it up a bit?

@davidalger
Copy link
Collaborator

Oh, one other thin on the topic of the root CA used to sign SSL certificates… It needs to make it into the Warden docs, but taken from the README of my M2 project template:

Note: If you are using Firefox and it warns you the SSL certificate is invalid/untrusted, go to Preferences -> Privacy & Security -> View Certificates (bottom of page) -> Authorities -> Import and select ~/.warden/ssl/rootca/certs/ca.cert.pem for import, then reload the page.

Note: If you are using Chrome on Linux and it warns you the SSL certificate is invalid/untrusted, go to Chrome Settings -> Privacy And Security -> Manage Certificates (see more) -> Authorities -> Import and select ~/.warden/ssl/rootca/certs/ca.cert.pem for import, then reload the page.

@erikhansen
Copy link
Contributor

@davidalger Thanks!

@lbajsarowicz Think you could share your documentation, even if it's in Polish? :)

@erikhansen
Copy link
Contributor

@lbajsarowicz I'm working with a developer running Windows—he's trying to get setup on WSL 2 and he's running into issues. Any chance you could share that documentation?

@hardyjohnson
Copy link
Contributor

hardyjohnson commented Nov 20, 2020

@erikhansen I have run through the process on Windows 10 using https://github.com/davidalger/warden-env-magento2 recently.

The process in a nutshell

  1. Install / enable WSL2 in Windows 10 using the instructions here: https://docs.microsoft.com/en-us/windows/wsl/install-win10
  2. Install Ubuntu 20.04 from the Windows store
  3. Install Docker for Windows
  4. Launch Docker for WIndows, make sure that the option for WSL2 integration is set.
  5. Launch wsl from your terminal of choice (the following commands are run from WSL Ubuntu env)
    1. Install Warden prerequisites in the WSL Ubuntu environment (Linux homebrew , mutagen)
    2. Install home brew package manager: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    3. Install Mutagen: brew install mutagen-io/mutagen/mutagen
    4. Install Warden brew install davidalger/warden/warden
    5. In your project directory set the environment values you need for your project in the .env file.
    6. Bring up the warden global services warden svc up
    7. Bring up your project warden environment warden env up
  6. In order for DNS entries to be resolved either add them to your Windows hosts file or add 127.0.0.1 as the first DNS server in your current network adapter in Windows.
  7. In order for TLS security warnings to go away you will need to follow the recommendations in WSL2 - Issue with upgrading #220 (comment)

@erikhansen
Copy link
Contributor

@hardyjohnson Thanks so much! I'll direct the developer to your comment.

@hardyjohnson
Copy link
Contributor

An important performance addendum, make sure to run the code from the local Linux file system and not the/mnt mapped path you are logged into by default when using wsl.

i.e. use the home or other wsl local path ~/code/projectname in the wsl environment and not the default /mnt/c path.

I am not sure yet how that affects development workflow on a day to day basis but performance is not realistic w/out doing that as of now.

@davidalger
Copy link
Collaborator

Install Mutagen: brew install mutagen-io/mutagen/mutagen

Quick note here: Mutagen is not used on any Linux like environment, including WSL, so this step should not be necessary as it's only leveraged on Darwin/MacOS

@erikhansen
Copy link
Contributor

@hardyjohnson (and anyone else using WSL 2) - I recently upgraded my test Windows environment from WSL 1 > WSL 2 using your helpful instructions above.

However everything inside Warden seems to be running painfully slowly. Any suggestions for me? For example, a time bin/magento cache:enable command takes ~36 seconds to run. However on my Mac running the same Warden project, it only takes ~1.2 seconds to run. And another Windows machine running WSL 1 is getting a ~5 second response time.

Here are some details about the setup:

  • Windows 10 Home (OS Build 19043.1052)
  • I didn't change any of the resource configuration settings (.wslconfig) as the defaults result in 8GB of memory and the full processors being available to Docker
  • Ubuntu 18.04
  • System specs:
Processor	Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz   2.60 GHz
Installed RAM	16.0 GB (15.8 GB usable)
Device ID	77FB9D0B-57FC-4B92-B97D-451DEC00026C
Product ID	00325-81572-13387-AAOEM
System type	64-bit operating system, x64-based processor

@hardyjohnson
Copy link
Contributor

@erikhansen when logged into the WSL terminal if you use pwd from your current code directory what path is that? Relevant to the discussion of the one biggest performance issue I saw: #220 (comment)

@erikhansen
Copy link
Contributor

@hardyjohnson Oh, I had missed that comment! Right now the code for the M2 project is in /c/sites/<client website>.test. I'm not sure whether that is using the /mnt path or is the more performant approach you mentioned. Would you recommend moving the project to ~/sites/<client website>.test to see if that fixes it?

@hardyjohnson
Copy link
Contributor

Yes give that a shot. I believe you should see a big improvement.

@hanhpv
Copy link

hanhpv commented Jun 30, 2021

I'm running Docker and WSL2 on my Windows 11 machine and it is really fast, almost as good as running on native Linux. Code is in WSL2 storage, but it is possible to browse them in Windows Explorer or open in PHPStorm.
image
The only issue I got for now is SSH tunnel doesn't seem to work. When I tried adding database connection in PHPStorm, it's showing error:
image
I added the domain to Windows hosts.

@ihor-sviziev
Copy link
Contributor Author

ihor-sviziev commented Jun 30, 2021

@hanhpv for ssh tunnel you can do configuration like this:

\\wsl$\Ubuntu-20.04\home\<username>\.warden\tunnel\ssh_key

image
image

Also, if you wish to have a full DNS support - you can add dns configuration to your ethernet/wifi interface:
image

@ihor-sviziev
Copy link
Contributor Author

@hanhpv, maybe, you could send a PR with full instruction on installing Warden on WSL2 once you finish configuring?

@erikhansen
Copy link
Contributor

@hardyjohnson Oh boy! That did the trick. Running a time bin/magento cache:enable command now only takes a second.

Thanks so much for your responsiveness in helping me get this sorted!

@erikhansen
Copy link
Contributor

Do any of you use a Git GUI on Windows with WSL 2? The Windows frontend developer I'm assisting installed SourceTree, but it's running painfully slowly as he's using a path like \\wsl$\Ubuntu-18.04\home\erikhansen\sites\example.test.

I'm looking at going through the "Update April 2021" steps on this article, but am curious what you all are using: https://chuckdries.medium.com/installing-gitkraken-in-wsl-2-15bf6459f823

@hardyjohnson @ihor-sviziev

@ihor-sviziev
Copy link
Contributor Author

@erikhansen, you have to use an application that has integration with wsl2 and will use the git command from Linux. For instance, PhpStorm Beta for windows does h such integration, and works almost fine there. I’m using phpstorm and sometimes command line for working with git.

Unfortunately, AFAIK, SourceTree doesn’t support it.

the other option, as you said, installing X server on windows, and running native Linux apps. I’m using it for gitk command, works pretty good

@erikhansen
Copy link
Contributor

I'm working with one of our clients to get a new developer setup with Warden on Windows 10. We've followed the steps in @hardyjohnson's comment above but are getting this error:

erikhansen@DESKTOP-3KM0K9I:~$ brew install davidalger/warden/warden
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).

==> Downloading https://github.com/davidalger/warden/archive/0.12.0.tar.gz
Already downloaded: /home/erikhansen/.cache/Homebrew/downloads/121a3abbdb12660fcbefefca1db17f781f4864123d684f1f84310c69331fbcde--warden-0.12.0.tar.gz
==> Installing warden from davidalger/warden
Error: The following formula cannot be installed from bottle and must be
built from source.
  warden
Install Clang or run `brew install gcc`.

Does anyone have a suggestion for how to get around this issue? Running the brew install gcc command does not result in any different outcomes.

We've tried the setup on my and their Windows machines, using WSL 2, trying both Ubuntu 18.04 and 20.04, to no avail.

@erikhansen
Copy link
Contributor

For the record, I worked around the issue above by doing the following:

sudo mkdir /opt/warden
sudo chown $(whoami) /opt/warden
git clone https://github.com/davidalger/warden.git /opt/warden
echo 'export PATH="/opt/warden/bin:$PATH"' >> ~/.bashrc
PATH="/opt/warden/bin:$PATH"

@RakeshJesadiya
Copy link

@erikhansen @davidalger How to upgrade Warden in Ubuntu 20.04 Version?
I have already Warden installed in /opt/warden folder with the older version 0.12.0.

I want to upgrade the version to 0.13.1 which will be compactible with the OpenSearch with the warden.

Which command I have to run to get specific warden version?

@navarr
Copy link
Member

navarr commented Apr 25, 2023

@RakeshJesadiya If you installed via brew, you should be able to run brew upgrade wardenenv/warden/warden. If you installed via git, you'll have to change into its directory and run git pull

@RakeshJesadiya
Copy link

@navarr I have installed it in Ubuntu,

sudo mkdir /opt/warden
sudo chown $(whoami) /opt/warden
git clone -b main https://github.com/wardenenv/warden.git /opt/warden
echo 'export PATH="/opt/warden/bin:$PATH"' >> ~/.bashrc
PATH="/opt/warden/bin:$PATH"
warden svc up

I have got the error while, git pull,

/opt/warden$ git pull
Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched.

@AnimNyan
Copy link

AnimNyan commented Jul 6, 2023

@erikhansen I have run through the process on Windows 10 using https://github.com/davidalger/warden-env-magento2 recently.

The process in a nutshell

1. Install / enable WSL2 in Windows 10 using the instructions here: https://docs.microsoft.com/en-us/windows/wsl/install-win10

2. Install Ubuntu 20.04 from the Windows store

3. Install Docker for Windows

4. Launch Docker for WIndows, make sure that the option for WSL2 integration is set.

5. Launch wsl from your terminal of choice (the following commands are run from WSL Ubuntu env)
   
   1. Install Warden prerequisites in the WSL Ubuntu environment (Linux homebrew ~, mutagen~)
   2. Install home brew package manager: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"`
   3. ~Install Mutagen: `brew install mutagen-io/mutagen/mutagen`~
   4. Install Warden `brew install davidalger/warden/warden`
   5. In your project directory set the environment values you need for your project in the .env file.
   6. Bring up the warden global services `warden svc up`
   7. Bring up your project warden environment `warden env up`

6. In order for DNS entries to be resolved either add them to your Windows hosts file or add 127.0.0.1 as the first DNS server in your current network adapter in Windows.

7. In order for TLS security warnings to go away  you will need to follow the recommendations in [WSL2 - Issue with upgrading #220 (comment)](https://github.com/wardenenv/warden/issues/220#issuecomment-713663923)

Hi so I've been able to follow all the steps to install Warden and Docker for windows in windows, but I don't understand step 6. which is the same as in the documentation here: https://docs.warden.dev/installing.html

It seems to be very unclear, as in you add DNS entries to your Windows hosts file but what entries specifically? And how do you add 127.0.0.1 as the first DNS server in your current network adapter in Windows?

The problem that is happening is when I try to access app.exampleproject.test or app.exampleproject.test/backend from Google Chrome I get a 404 page not found.

So I'm trying to understand what entries exactly need to be entered into the windows hosts file.

Edit: I've tried adding in 127.0.0.1 app.exampleproject.test in the hosts file and it seems to do the trick when I go to app.exampleproject.test. Actually nevermind, it seemed to work for a small amount of time giving me the nginx 502 error page when I accessed app.exampleproject.test which is what was supposed to happen for installing Magento 2, but now no longer works for some reason.

However, towards adding 127.0.0.1 to the network adapter I have no clue whatsoever what that means or how to do it.

Is it possible to also be more specific in the Warden documentation page? As it is extremely unclear as to what to put in for windows users using wsl.

@AnimNyan
Copy link

AnimNyan commented Jul 6, 2023

Update on this: seems like adding 127.0.0.1 app.exampleproject.test into the hosts file where exampleproject is the name of the magento2 folder worked consistently when trying to access app.exampleproject.test in Google Chrome after I installed magento 2.

So even though the url isn't working, just keep going and install magento 2 first before trying to access the app.exampleproject.test url.

So what I had to do is just proceed even though the url wasn't working with these steps here: https://docs.warden.dev/environments/magento2.html

Mainly the warden shell bin/magento setup:install and then :
bin/magento indexer:reindex
bin/magento cache:flush

But just follow all the above steps in the installing magento 2 documentation and it will bring you the default luma magento 2 page consistently with the Not secure url on google chrome.

Anyway, if anybody needs help installing magento 2 on windows through warden, send me a message or a ping here and I'll help you do it from scratch, since I found this process quite difficult.

@navarr
Copy link
Member

navarr commented Jul 6, 2023

@navarr I have installed it in Ubuntu,

sudo mkdir /opt/warden
sudo chown $(whoami) /opt/warden
git clone -b main https://github.com/wardenenv/warden.git /opt/warden
echo 'export PATH="/opt/warden/bin:$PATH"' >> ~/.bashrc
PATH="/opt/warden/bin:$PATH"
warden svc up

I have got the error while, git pull,

/opt/warden$ git pull
Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched.

You'll want to git checkout main as the branch has been changed.

Update on this: seems like adding 127.0.0.1 app.exampleproject.test into the hosts file where exampleproject is the name of the magento2 folder worked consistently when trying to access app.exampleproject.test in Google Chrome after I installed magento 2.

So even though the url isn't working, just keep going and install magento 2 first before trying to access the app.exampleproject.test url.

So what I had to do is just proceed even though the url wasn't working with these steps here: https://docs.warden.dev/environments/magento2.html

Mainly the warden shell bin/magento setup:install and then : bin/magento indexer:reindex bin/magento cache:flush

But just follow all the above steps in the installing magento 2 documentation and it will bring you the default luma magento 2 page consistently with the Not secure url on google chrome.

Anyway, if anybody needs help installing magento 2 on windows through warden, send me a message or a ping here and I'll help you do it from scratch, since I found this process quite difficult.

I'm glad you figured this out! It's still early morning for me, so I just saw these posts. You are correct in that you'll want to add any URLs pointing to Warden to your HOSTS file with 127.0.0.1.

As for changing your name resolver, I am not currently testing this so I'm not sure how well it will work, however Google has pretty decent instructions:

https://developers.google.com/speed/public-dns/docs/using#windows

In the place where you'd typically put 8.8.8.8 you'd want instead 127.0.0.1 and that would theoretically let Warden have first dibs at resolving domain names

@hardyjohnson
Copy link
Contributor

hardyjohnson commented Jul 6, 2023

@AnimNyan

Based on what I am reading there is some clarification that could help new users.

  1. Explain the separation between global services setup and project setup.

My instructions above which are now part of the main documentation are aimed at setting up the global services and not a particular project: https://docs.warden.dev/installing.html#windows-installation-via-wsl2

In the example I gave, I did originally give the commands for running an existing project warden env up, but those were edited out of the official documentation for global service installation. You are correct that you will still need to run through the Magento 2 installation in order to have a working Magento 2 project environment if you are starting from scratch.

  1. Explain the DNS configuration in finer detail.

It seems to be very unclear, as in you add DNS entries to your Windows hosts file but what entries specifically? And how do you add 127.0.0.1 as the first DNS server in your current network adapter in Windows?

An important bit about step 6 is deciding which method of DNS resolution you will be using, you should only need to ever configure one or the other on Windows.

With Windows hosts file resolution, all global services and project domains are manually added to the hosts file including


# Warden Global Services (run with warden svc up)
127.0.0.1 traefik.warden.test
127.0.0.1 portainer.warden.test
127.0.0.1 dnsmasq.warden.test
127.0.0.1 mailhog.warden.test

# Project environments (run with warden env up)
127.0.0.1 app.exampleproject.test

Setting the network adapter's preference for DNS resolver to Warden's built in global dnsmasq DNS service (127.0.0.1). Note this service is only available after running warden svc up.

The advantage of the global DNS service is that it will allow for wildcard resolution of *.test domains and you will not need to manually configure each project or any of the top level service domains. They should work automagically if you are using a .test top level domain.

  1. Magento 2 environment initialization and installation.

There is an example Magento 2 project repo which can help ease first time Magento 2 installation, though I am not sure if it is up to date at this point @AnimNyan.

@navarr is https://github.com/wardenenv/warden-env-magento2 still relevant here? It has been an age since I tried installing Magento 2 from scratch.

Hopefully this helps to clarify some things, happy to add another PR to the docs if it does. Also I will update my previous entry on this issue for future users who end up here.

@ihor-sviziev
Copy link
Contributor Author

@hardyjohnson

Setting the network adapter's preference for DNS resolver to Warden's built in global dnsmasq DNS service (127.0.0.1). Note this service is only available after running warden svc up.

You can use a secondary DNS server, for instance, 1.1.1.1 or 8.8.8.8, so if your local DNS isn't available, it will automatically resolve DNS from the secondary one.

@AnimNyan
Copy link

AnimNyan commented Jul 9, 2023

@hardyjohnson @navarr
Thank you so much for that explanation, that makes a lot more sense.

I understand you wanted the instructions to be general, but I think it just makes it unclear not listing an example of what to enter in to the hosts file.

At the very least, I think your example host file above should be added to the Warden Installation instructions for Magento 2 here: https://docs.warden.dev/environments/magento2.html

Otherwise, a lot of users on Windows will encounter 404 errors when attempting to run their local dev environment from a browser.

I didn't try that github since it hasn't been updated for 3 years. Markshurt has one here: https://github.com/markshust/docker-magento that is more up to date with Magento 2.4.6, however haven't checked if it works for Windows, since he was using Mac OS to install Magento.

Two other pieces of feedback on the Magento 2 Warden documentation here: https://docs.warden.dev/environments/magento2.html . I don't know where to put this, if I need to create a new issue I will:

  1. For step 6 here:
    6, Configure global Magento Marketplace credentials
    composer global config http-basic.repo.magento.com

This is very confusing to put and as placeholders, I think Magento does that too in their docs, but and would make so much more sense.

Furthermore, pretty sure the html under the same step is broken here: reference DevDocs https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html

I would also suggest adding a link to the adobe marketplace like this: https://commercemarketplace.adobe.com/

  1. For step 9 here:
  2. Generate an admin user and configure 2FA for OTP
    OTPAUTH_QRI=
    TFA_SECRET=$(python -c "import base64; print base64.b32encode('$(pwgen -A1 128)')" | sed 's/=*$//')
    OTPAUTH_URL=$(printf "otpauth://totp/%s%%3Alocaladmin%%40example.com?issuer=%s&secret=%s"
    "${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}" "${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}" "${TFA_SECRET}"
    )

This command does not work for Python 3.0+ and returns an error. From python 3.0 print works differently. See this https://www.datacamp.com/blog/python-2-vs-3-everything-you-need-to-know#the-new-print()-function

So the above should be really:
OTPAUTH_QRI=
TFA_SECRET=$(python -c "import base64; print (base64.b32encode('$(pwgen -A1 128)'.encode()).decode('utf8'))" | sed 's/=*$//')
OTPAUTH_URL=$(printf "otpauth://totp/%s%%3Alocaladmin%%40example.com?issuer=%s&secret=%s"
"${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}" "${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}" "${TFA_SECRET}"
)

For python 3.0+.

This is a problem because the warden container doesn't come preinstalled with python and when someone installs python with sudo yum install python they install python 3.9 by default causing the above command to fail.

Either that or they need to install and build any version of python below 3.0 like I did like so:
wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
tar -xvzf Python-2.7.15.tgz
cd Python-2.7.15
./configure
sudo make altinstall
sudo make install

Then you can use the above command successfully. I made it super safe by changing python to python2
OTPAUTH_QRI=
TFA_SECRET=$(python2 -c "import base64; print base64.b32encode('$(pwgen -A1 128)')" | sed 's/=*$//')
OTPAUTH_URL=$(printf "otpauth://totp/%s%%3Alocaladmin%%40example.com?issuer=%s&secret=%s"
"${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}" "${TRAEFIK_SUBDOMAIN}.${TRAEFIK_DOMAIN}" "${TFA_SECRET}"
)

@AnimNyan
Copy link

AnimNyan commented Jul 9, 2023

Furthermore, for anyone reading this struggling to install Magento 2.4.6 to windows using Warden I made this video here to follow after my successful setup of the dev environment: https://www.youtube.com/watch?v=sQLUbQOBYv0

@bap14
Copy link
Member

bap14 commented Jul 13, 2023

@navarr I recently had issues with DNS in Windows as well. I have a patch I need to test on MacOS to make sure it's okay, but the crux of it is this: DNSMasq doesn't bind to the Windows port 53, so using 127.0.0.1 as a DNS server didn't work. Adding some checks for WSL during core services start, and some additional configuration details, gets it working. Then all you need to do is add 127.0.0.1 as a DNS server before an external server (e.g. Cloudflare).

This is ... just wrong. I don't know what led me down that rabbit hole, but 0.14.1 under WSL2 works fine if you add 127.0.0.1 as the first DNS host. At most we should add some screenshots for Windows 11 and their new "simplified" UI. I've created wardenenv/docs#15 to help address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants