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

Dockerized the project #3

Merged
merged 2 commits into from
Oct 24, 2024
Merged

Conversation

relaxgameing
Copy link
Contributor

issue:[Feature Request]: Dockerize Golang-To-Do-App #1

dockerized the project ,

changes made

created a docker compose to easily manage the project
changed the project file structure -> moved the backend to it's own server folder

moved the server to its own folder
@vigneshs-dev
Copy link
Owner

Hi @relaxgameing , I tried to run the docker-compose file. But, I got the error. Have you checked this in your local system. There are three lines in main.go file related to cors, which are commented. If you uncomment that and run, the project will run in your local system. You have to give MongoDB URI.

image

Please check that.

@relaxgameing
Copy link
Contributor Author

relaxgameing commented Oct 23, 2024

Yes I have checked , it run as expected.

What I think happen with you is that you ran it with development and you code looks for .env file which is not there so try by making a .env file in server

And as per the cors problem that I didn't touch because I didn't wanted to change code and tried to kept it as original as possible, so patch and delete methods are blocked , apply the cors should solve the problem, I will change these and get back to you later.

Thank you for replying

@vigneshs-dev
Copy link
Owner

I will check today and confirm the same.

@relaxgameing
Copy link
Contributor Author

i have done the required changes and tested them in my local env now you can make all the requests and removed the requirement for .env file during development mode ,
please check and let me know if there is still some revision required

@vigneshs-dev
Copy link
Owner

Hi @relaxgameing ,
The cors configuration has to be commented in production. During development stage only, it has to be uncommented. You have changed some important steps which required for deployment. ENV has to be production only. Please remove all the changes. As you have changed the project structure, I don't know whether the deployment is possible or not. There is a new folder called server. I have to check on that.

Please try to deploy the project in railway app by yourself. It's free only. If you get any error please let me know.

@relaxgameing
Copy link
Contributor Author

relaxgameing commented Oct 23, 2024

You addressed three problems:
1.cors
2.development
3.server folder

So for cors we can just use an conditional to add cors only in development

And for the environment variables I think having one place for all the env variables is better , we can just add or remove the variables in the compose file ( which would work for both production and development as for development we need our own values and for production you can adjust it while deploying) ( correct me if I am wrong)

And regarding the server folder i think seperating the backend and frontend makes sense rather than having backend code in the parent folder of client ( originally)

If you accept these solution then I would change the code and I will look into deploying them in railway app and let you know about the results

Thank you for replying @vigneshs-dev

@relaxgameing
Copy link
Contributor Author

@vigneshs-dev hey i have deployed my updated code in railway and it deployed nicely here is the link https://golang-to-do-app-production-ff7f.up.railway.app/

@vigneshs-dev
Copy link
Owner

@vigneshs-dev hey i have deployed my updated code in railway and it deployed nicely here is the link https://golang-to-do-app-production-ff7f.up.railway.app/

Nice @relaxgameing . Then there will be no problem in merging also. I will merge your code with the main branch. Thank you for your great work and contribution. You have given full effort on this issue. Sooperub dedication. Keep contributing.

@vigneshs-dev vigneshs-dev merged commit 5f06a5f into vigneshs-dev:main Oct 24, 2024
3 of 6 checks passed
@relaxgameing relaxgameing deleted the issue/#1 branch October 25, 2024 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants