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

Dockerise to make it nice #296

Open
bizmate opened this issue Dec 26, 2024 · 4 comments
Open

Dockerise to make it nice #296

bizmate opened this issue Dec 26, 2024 · 4 comments

Comments

@bizmate
Copy link

bizmate commented Dec 26, 2024

As per title, it might make it much easier for devs to get it up with docker locally, I ll create an informal PR and link it to this from my fork. I hope it is welcome

@carmelc
Copy link
Collaborator

carmelc commented Dec 30, 2024

Hi @bizmate, first of all, thank you for the contribution,
I am not sure I understand why a local docker is required, it is a plain NextJS application which runs using dev command, so what added value does the docker provide?
Also, the implementation is OS specific (Unix) and it is intended to be used also on Win machines, which is problematic

@bizmate
Copy link
Author

bizmate commented Dec 30, 2024

  • I am not sure I understand why a local docker is required, it is a plain NextJS application which runs using dev command, so what added value does the docker provide? -> Docker standardises development providing parity, ie the ability to run everything consistently through heterogeneous environments regardless of the underlying architecture. It removes the need to manually install, configure and troubleshoot any node installation and it is unlikely it will yield a different result for tests or when running the application when deployed in separate machines. In this specific instance the LTS version is requested but if this changes it could be pinpointed to a more restrictive requirement . It is ultimately up to Wix how you run things locally. This approach would indeed add an extra requirement for docker but relive several other problems cause by lack of a consistent environment plus a more CI/CD mindset.
  • the implementation is OS specific (Unix) and it is intended to be used also on Win machines, which is problematic . - Docker is native on linux but this does not stop both docker or make to run on Windows machine where anyway usually a linux emulation is used by Docker or similar tooling like git bash

Also as a separate feedback, the steps used in the README do not necessarily seem to fully work and there is a lot of manual parts, ie it is great that the Netlify or other hosting solutions are mentioned but this is neither local nor it does work (based on what i tried) by just cloning the template.

However if you have docker you can just copy the template, get the environment variables and deploy with just make up. Anyhow feel free to discard it in case you think it is an overhead

@carmelc
Copy link
Collaborator

carmelc commented Dec 30, 2024

Sorry if the steps were not working properly for you, did you try the quick setup option? it basically sets everything up for you and provides you with a ready .env file to be used,
The manual steps in the README is for users to be able to run everything manually and understand what is happening,
I am just afraid that supporting docker mode the way that you suggest would mislead users into thinking that they need to deploy as docker.
Also, nextjs recommandation is to include a Dockerfile file, as shown here, the thing is that the only started templates which include docker support are the ones dedicated for docker examples, and the common practice in Nextjs base templates is not to include it by default.

@bizmate
Copy link
Author

bizmate commented Dec 30, 2024

Sorry if the steps were not working properly for you, did you try the quick setup option? it basically sets everything up for you and provides you with a ready .env file to be used,

I appreciate your reply and no need to be sorry, it is a learning process but I think some of its focus could be on the Wix side rather than the tooling itself and if you and Wix think that docker is not a good choice you should not embrace it. The part that did not work is actually to get node running on the localhost consistently and get a version that would be compatible/support. With docker you do not have that problem but i admin this specific implementation is not tested on Windows, I run both Linux and Mac and works on both. Also the manual part of Netlify does not work, I think you actually need to have an account there and deploy somehow the app... I did not troubleshoot it. It takes me far less time to run it locally with Docker

The manual steps in the README is for users to be able to run everything manually and understand what is happening, I am just afraid that supporting docker mode the way that you suggest would mislead users into thinking that they need to deploy as docker.

I included the steps actually as extra as carefully mentioned in the README, none of the manual steps are actually removed. If the extra lines of docker make you think it is taking over then you should not embrace as mentioned in the previous comment but simply it makes the process of running npm install/run and the mapping of a domain to its local environment much quicker with the help of ngrok. The ngrok part is also quite important as I think the app URLs with HTTPS pointing to localhost might not work. See this on Discord https://discord.com/channels/1114269395317968906/1321409153385758772/1321490912760692849

Also, nextjs recommandation is to include a Dockerfile file, as shown here, the thing is that the only started templates which include docker support are the ones dedicated for docker examples, and the common practice in Nextjs base templates is not to include it by default.

I think you are getting a bit confused there with the docker example in the NextJS document. That example builds an image on the basis of the use of a Dockerfile as mentioned in that repo. That file will not allow to develop locally as there is no volume. Once that image is build it will run on your machine or you can indeed deploy it on a solution but the code will be built in the image and if you make a change locally it will not reflect on the image as there is no volume mount. The use of docker compose in the PR is usually more suited for local development but also it can easily be customised with multiple docker compose files, or k8s deployment files, to also easily deploy on a UAT up to prod.

BTW again no stress if you are not familiar with Docker or if the Wix team is not happy with it but if you have any questions also feel free to msg me on discord.

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

No branches or pull requests

2 participants