You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.9 KiB

  1. Example Web Server/Site Template
  2. ================================
  3. -------------------------------------------------
  4. Project Layout
  5. -------------------------------------------------
  6. ## Project Working Copy
  7. ```
  8. ~/Projects/Web/example.com/ # git repo (git ignore www)
  9. |
  10. |- docker-compose.yml
  11. |
  12. |- service/
  13. | |
  14. | |- docker-compose.yml
  15. |
  16. |- www/ # git repo (git ignore build)
  17. | |
  18. | |- Makefile
  19. | |
  20. | |- index.pug
  21. | |
  22. | |- build/ # git repo (if not building target on server, e.g. static GitHub pages)
  23. | | |
  24. | | |- index.html
  25. | |
  26. | |- config/
  27. ```
  28. ## Project Collaboration
  29. ```
  30. git@examplecodehost.com:organization/example.com.git
  31. git@examplecodehost.com:organization/www.example.com.git
  32. ```
  33. ## Server Deployment
  34. ```
  35. /usr/local/src/web/example.com/
  36. |
  37. |- server/ # bare git repo
  38. |
  39. |- www/ # bare git repo
  40. ```
  41. ```
  42. /srv/dev/example.com/
  43. /srv/beta/example.com/
  44. /srv/prod/example.com/
  45. ```
  46. In build upstream bare repo (webserver:/usr/local/src/web/example.com/www/), run:
  47. # chown root:srv .
  48. # chmod g+ws .
  49. # setfacl -d -m g::rwx .
  50. # git init --bare --shared=group
  51. # git config receive.denyCurrentBranch updateInstead
  52. # git config receive.denyNonFastForwards false
  53. ?(# git config core.sharedRepository true) # if needed because of missing init option
  54. Set upstream and push branches to new bare repo, then run:
  55. # git worktree add /srv/prod/example.com/www master
  56. # git worktree add /srv/beta/example.com/www release
  57. # git worktree add /srv/dev/example.com/www dev
  58. # chmod -R g+w .
  59. # chmod g+w /srv/*/example.com/www
  60. # chown -R root:srv .
  61. # chmod -R g+swX .
  62. # chown root:srv /srv/prod/example.com/www
  63. # chmod g+swX /srv/prod/example.com/www
  64. # chown root:srv /srv/beta/example.com/www
  65. # chmod g+swX /srv/beta/example.com/www
  66. # chown root:srv /srv/dev/example.com/www
  67. # chmod g+swX /srv/dev/example.com/www
  68. and add your user (on the server) to the srv group.