Skip to content

v2 of the Azure Stack #6

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

Merged
merged 20 commits into from
Jan 19, 2023
Merged

v2 of the Azure Stack #6

merged 20 commits into from
Jan 19, 2023

Conversation

aaronpowell
Copy link
Owner

Major overhaul of the Azure Stack:

  • Migrated to PostgreSQL as the DB rather than Azure SQL
  • New devcontainer that sets up the PostgreSQL db for you
  • Introduced azd for infra management
  • Full set of Bicep templates for deploying with azd

@joelhellman
Copy link

I'm learning remix (and Azure) and trying out your v2 template. Thanks for creating this!

In the .devcontainer/docker-compose.yaml there is a default password:

version: '3'

services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: '$AzureR0cks!'

For me (on Windows/WSL2), if I ports the postgres image so I can connect to it from local tool (DataGrip), the value of POSTGRES_PASSWORD becomes !. I had a little trouble before I found the issue.

Removing the quotes from the pg password ('$AzureR0cks!') fixed the issue for me.

@aaronpowell
Copy link
Owner Author

I haven't had problems with wsl2 (it's my primary Dev environment, but I haven't tried connecting from an external DB tool (I just is vscode).

I'll double check the yaml encoding

@mex20
Copy link

mex20 commented Jan 2, 2023

When I try to run the v2 container on Windows 10 with the latest VS Code, the container fails at some point in the process of building this container with the relevant error output below as well as the entire log file. I have only run into this issue on Windows. On MacOS I am able to build the container, but there is only text showing up when I open the app in the browser that says "Upgrade Required" after executing "npm run dev". I have not tried Linux yet.

 > [dev_container_auto_added_stage_label 3/3] RUN apt-get update     && /bin/bas
h /tmp/library-scripts/common-debian.sh "true" "automatic" "1000" "1000" "false"
 "true" "true"     && /bin/bash /tmp/library-scripts/docker-debian.sh "true" "/v
ar/run/docker-host.sock" "/var/run/docker.sock" "automatic"     && curl -fsSL ht
tps://aka.ms/install-azd.sh | bash     && apt-get autoremove -y && apt-get clean
 -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/:
#0 0.596 Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
#0 0.639 Get:2 http://deb.debian.org/debian-security bullseye-security InRelease
 [48.4 kB]
#0 0.661 Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
#0 0.804 Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 k
B]
#0 2.202 Get:5 http://deb.debian.org/debian-security bullseye-security/main amd6
4 Packages [210 kB]
#0 2.235 Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages
 [14.6 kB]
#0 3.907 Fetched 8616 kB in 3s (2499 kB/s)
#0 3.907 Reading package lists...
#0 4.697 /tmp/library-scripts/common-debian.sh: line 11: $'\r': command not foun
d
: invalid optionbrary-scripts/common-debian.sh: line 12: set: -
#0 4.697 set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
#0 4.697 /tmp/library-scripts/common-debian.sh: line 13: $'\r': command not foun
d
#0 4.701 /tmp/library-scripts/common-debian.sh: line 23: $'\r': command not foun
d
#0 4.701 /tmp/library-scripts/common-debian.sh: line 38: syntax error near unexp
ected token `$'do\r''
#0 4.701 /tmp/library-scripts/common-debian.sh: line 38: `    for CURRENT_USER i
' ${POSSIBLE_USERS[@]}; do
------
failed to solve: executor failed running [/bin/sh -c apt-get update     && /bin/
bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USE
R_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true"     && /bin/bash /tmp/
library-scripts/docker-debian.sh "${ENABLE_NONROOT_DOCKER}" "/var/run/docker-hos
t.sock" "/var/run/docker.sock" "${USERNAME}"     && curl -fsSL https://aka.ms/in
stall-azd.sh | bash     && apt-get autoremove -y && apt-get clean -y && rm -rf /
var/lib/apt/lists/* /tmp/library-scripts/]: exit code: 2
[2023-01-02T01:13:43.500Z] Stop (6287 ms): Run: docker-compose --project-name azure-remix-stack_devcontainer -f c:\Users\Zelda\Downloads\azure-remix-stack\.devcontainer\docker-compose.yml -f c:\Users\Zelda\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data\docker-compose\docker-compose.devcontainer.build-1672622017211.yml build
[2023-01-02T01:13:43.501Z] Error: Command failed: docker-compose --project-name azure-remix-stack_devcontainer -f c:\Users\Zelda\Downloads\azure-remix-stack\.devcontainer\docker-compose.yml -f c:\Users\Zelda\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data\docker-compose\docker-compose.devcontainer.build-1672622017211.yml build
[2023-01-02T01:13:43.502Z]     at pF (c:\Users\Zelda\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1850:431)
[2023-01-02T01:13:43.502Z]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2023-01-02T01:13:43.502Z]     at async foe (c:\Users\Zelda\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1850:2457)
[2023-01-02T01:13:43.503Z]     at async loe (c:\Users\Zelda\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1832:2396)
[2023-01-02T01:13:43.503Z]     at async Poe (c:\Users\Zelda\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:2301)
[2023-01-02T01:13:43.503Z]     at async Zf (c:\Users\Zelda\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:3278)
[2023-01-02T01:13:43.504Z]     at async aue (c:\Users\Zelda\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:2020:15276)
[2023-01-02T01:13:43.504Z]     at async oue (c:\Users\Zelda\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:2020:15030)
[2023-01-02T01:13:43.519Z] Stop (14416 ms): Run: C:\Users\Zelda\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\Zelda\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\Zelda\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Users\Zelda\Downloads\azure-remix-stack --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\Zelda\Downloads\azure-remix-stack --log-level debug --log-format json --config c:\Users\Zelda\Downloads\azure-remix-stack\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-01-02T01:13:43.519Z] Exit code 1
[2023-01-02T01:13:43.524Z] Command failed: C:\Users\Zelda\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\Zelda\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\Zelda\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Users\Zelda\Downloads\azure-remix-stack --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\Zelda\Downloads\azure-remix-stack --log-level debug --log-format json --config c:\Users\Zelda\Downloads\azure-remix-stack\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-01-02T01:13:43.524Z] Exit code 1

remoteContainers-2023-01-02T01-13-27.660Z.log

@aaronpowell
Copy link
Owner Author

It looks like a line endings problem @mex20 - the shell scripts that are run are being converted to CRLF and that causes problems when Docker executes them in Linux. I'll add a gitattributes to hopefully fix that.

For MacOS, are you on a M1 or M2 chipset?

@mex20
Copy link

mex20 commented Jan 2, 2023

It looks like a line endings problem @mex20 - the shell scripts that are run are being converted to CRLF and that causes problems when Docker executes them in Linux. I'll add a gitattributes to hopefully fix that.

For MacOS, are you on a M1 or M2 chipset?

Thanks for the quick issue identification @aaronpowell! I was having a tough time figuring out why the 'CURRENT_USER in....; do" code was leaking into the arguments.

For the 'Upgrade Required" issue on MacOS, I was not running it on an M1 or M2 chipset Mac. I was running it on an Intel Mac, Model A1707.

When I attempt to run on an M1 chipset Mac, I get an Unhandled 'install-azd' error. seen below. I am also attaching the full log for you.

Error

#0 23.84 install-azd: ERROR: Architecture not supported: aarch64 on platform: linux
#0 23.84 install-azd: ERROR: Unhandled error

m1Chipset_remoteContainers-2023-01-02T22-37-15.375Z.log

@aaronpowell
Copy link
Owner Author

Is the "Upgrade Required" error in the browser? I don't have a MacOS device so I'm not able to test that scenario myself.

For the M1 issue, that's reported here: Azure/azure-dev#952

I'll follow their guidance to rectify.

@mex20
Copy link

mex20 commented Jan 3, 2023

Is the "Upgrade Required" error in the browser? I don't have a MacOS device so I'm not able to test that scenario myself.

For the M1 issue, that's reported here: Azure/azure-dev#952

I'll follow their guidance to rectify.

Yes the "Upgrade Required" error happens in the browser. I can provide assistance with testing on MacOS on this. What would be helpful for me to test/gather for you on the Intel MacOS device?

Also thank you very much for the link to the issue with a short term workaround! It appears to be working on my M1 Mac with the "--platform=amd64" precluding the FROM image in the Dockerfile.

I am seeing the "Upgrade Required" issue on the M1 Mac as well. I am still digging into it, and will report back when I have some more concrete details that will help.

@mex20
Copy link

mex20 commented Jan 3, 2023

After some digging around, I was able to find out some more information about this MacOS "Require Upgrade issue. The "Upgrade Required" page does not seem to be coming from the Remix stack as I am not seeing any incoming requests from the browser in the dev container console. I can see the Remix stack receiving a request from the browser when I go to http://localhost:3000 in the dev container console, but I get a whole set of different issues.

I have figured out what my several issues were caused by and I am now fully able to run the azure-remix-stack example app! I had corrupted my clone from running npm install in my MacOS terminal using the NodeJS.pkg I downloaded from the official site, which will cause the esbuild-linux-$ARCH package to NOT be installed into the node_modules folder, the MacOS esbuild package was installed into the node_modules folder. That caused the azure-remix-stack app to only be partially built and fail with a different error than the one seen in Step 10. b.; That error was some sort of prisma error that I cannot remember the details of. The error seen in Step 10. b. is because I did not rename .env.example to .env. before running the dev container.
Screenshot 2023-01-02 at 10 26 40 PM
Screenshot 2023-01-02 at 10 26 23 PM

Thank you so much for your quick responses @aaronpowell!

Here are the steps I took to get to this issue:

  1. git clone https://github.com/aaronpowell/azure-remix-stack

  2. Change to the azure-remix-stack directory

  3. Run npm install in the MacOS terminal

  4. Start the dev container

  5. When the dev container is fully started I run npm setup

  6. After that finishes I run npm run dev

  7. Server starts and I click the "Open in Browser" button on the pop-up in VS Code.
    Screenshot 2023-01-02 at 6 07 53 PM

  8. The browser opens with the "Upgrade Required" screen. and opens to: http://localhost:8002

Screenshot 2023-01-02 at 6 08 48 PM

  1. The dev container console does not show any connections to the remix stack. However it does show: Remix App Server started at http://localhost:3000 (http://172.19.0.3:3000)

  2. a. In the browser navigate to: http://localhost:3000 and the page that is displayed shows this:

Screenshot 2023-01-02 at 6 09 14 PM

  1. b. The dev container console will show this error when the browser loaded http://localhost:3000 Screenshot 2023-01-02 at 6 34 20 PM

Workarounds:

Dev container serving port 8002 on MacOS when clicking "Open in Browser" button in VS Code

  • Do not use the button to access the app. When it pops up in VS Code, it directs the browser to http://localhost:8002 and that port is being taken up on the MacOS host by Docker Desktop (on both Intel and M1 chipsets). Instead navigate to http://localhost:3000 if using the default configuration or whatever address you customized your Remix App Server to run on.

@mex20
Copy link

mex20 commented Jan 19, 2023

I have been trying to deploy v2 using the azd commands in the README, but I am unable to run azd login and successfully login and deploy to Azure because the browser fails to open. The same error seen in the below images occurs on MacOS (M1/Intel) and Windows. I am able to use the command az login to launch the browser and log into that tool, but it does not carry over to azd.

It also looks like this is kind of a known issue in the devcontainers/features repo: devcontainers/features#177

Error:
Screenshot 2023-01-18 172014

@aaronpowell
Copy link
Owner Author

@mex20 what's the version output by azd version?

@mex20
Copy link

mex20 commented Jan 19, 2023

@mex20 what's the version output by azd version?

azd version 0.5.0-beta.3 (commit 1c23678aade587d5b9685a256a3c1d2d7f4b42e0) Is the output I get from running azd version in the dev container on Windows and on MacOS.

@aaronpowell
Copy link
Owner Author

Can you try the --use-device-code flag when trying to trigger a login:

azd login --use-device-code

That should avoid the browser being launched, instead give you a URL to follow and the auth code to give the login screen.

@mex20
Copy link

mex20 commented Jan 19, 2023

Can you try the --use-device-code flag when trying to trigger a login:

azd login --use-device-code

That should avoid the browser being launched, instead give you a URL to follow and the auth code to give the login screen.

Thanks @aaronpowell that was the trick to getting azd associated with the Azure account. I was able to successfully log in with that command.

@aaronpowell aaronpowell merged commit 708d252 into main Jan 19, 2023
@aaronpowell aaronpowell deleted the v2 branch January 19, 2023 03:29
@aaronpowell
Copy link
Owner Author

I've been meaning to merge this for a while, figured it's about time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants