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

support win dev by moving environment config #778

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ionous
Copy link
Contributor

@ionous ionous commented Jul 9, 2024

windows can't run bash scripts without linux for windows ( which imposes some extra headaches for shift development; setup of wsl, permission issues, etc. )

the bash script sets up the environment needed for docker compose to work ( which is why we can't use "docker compose" directly at the command line; but after this, we can. )

docker does, however, support a ".env" file next to the compose file just for this purpose.

changes:

  • moved envvars from ./shift to .env
  • for letsencrypt and eventimages, put the required production paths in shift.overrides.production ( because these two had/need special handling )
  • moved local event images from /backend/eventimages to /app/eventimages . the latter is what "npm run dev" uses and makes fake event creation work inside docker ( really, dev should probably be using /bin/eventimages; and docker should be using a volume.... but that's a whole different can of tomatoes )
  • added a new placeholder directory ./services/nginx/letsencrypt/. this placeholder is only used for development. previously mac/linux dev would use /tmp/letsencrypt just like production does; but windows can't use /tmp folders.
  • removed unused envvars from thesecrets.example
  • for windows users: added npm scripts for up, down, watch, and emails to mimic those commands from ./shift; and tweaked the npm build script to output hugo files into the expected docker location. ( npm run up and npm run down now work, and match shift up and shift down )
  • updated the readme to describe the windows steps; and moved the old, probably inaccurate local netlify development steps from the readme to a separate doc file with notes
  • new command: npm run docker-create-events -- which if docker is running, will create a handful of fake events inside mysql

fixed:

the node container in docker-compose.yml should have been using the EVENTIMAGES envvar just like nginx does:

- "${EVENTIMAGES}:/opt/backend/eventimages"

^ the ngnix container conf. vs, the current, not quite correct, node container conf:
- ./backend/eventimages/:/opt/backend/eventimages/

windows can't run bash scripts without linux for windows ( which imposes some extra headaches for shift development; setup of wsl, permission issues, etc. )

but, the bash script sets up the environment needed for docker compose to work ( which is why we can't use "docker compose" directly at the command line )

docker does, however, support a ".env" file next to the compose file just for this purpose.

changes:
- moved envvars from ./shift to .env
- for letsencrypt and eventimages, put the required production paths in shift.overrides.production ( because these two had/need special handling )
- moved local event images from "/backend/eventimages" to "/app/eventimages" . the latter is what "npm run dev" uses and makes fake event creation work inside docker ( granted both should probably be using /bin/eventimages or something )
- added a new placeholder directory "./services/nginx/letsencrypt/". this placeholder is only used for development. previously mac/linux dev would use "/tmp/letsencrypt" just like production does; but windows can't use "/tmp" folders.
- removed unused envvars from the 'secrets.example'
- for windows users: added npm scripts for up, down, watch, and emails to mimic those commands from ./shift; and tweaked the npm build script to build hugo into the expected docker location.
- updated the readme to describe the windows steps
- moved the old, probably inaccurate local netlify development steps from the readme to a separate doc file with notes

fixed:
- fixed: the node container in docker-compose.yml should have been using the EVENTIMAGES envvar just like nginx does  ( at the top of the file )
@ionous
Copy link
Contributor Author

ionous commented Jul 9, 2024

leaving this as a draft for now.
i still need to do some more testing on my windows and mac machines. and we will want to ensure that the docker version on production actually supports env files(!) before using this there.

@ionous ionous requested review from carrythebanner and fool July 9, 2024 18:12
@ionous ionous marked this pull request as draft July 9, 2024 18:12
@fool
Copy link
Member

fool commented Dec 13, 2024

Maybe we can work with @aaronminnick since he's got the windows. I feel like we want to finish up the work in #772 and then #774 before we continue down this path, though - does that make sense to you @ionous ?

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.

2 participants