These are some guides for various use.
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.

178 lines
5.6 KiB

7 months ago
  1. # Git
  2. ## Setup Server
  3. ### Docker
  4. #### Bare (No webinterface)
  5. The official container and documentation was made by [jkarlos](https://hub.docker.com/r/jkarlos/git-server-docker).
  6. ##### Volumes
  7. Set the following volumes with the -v tag.
  8. | Volume-Name | Container mount | Description |
  9. | ---------------- | ----------------- | --------------------------- |
  10. | git-server-repos | /git-server/repos | storage for git repos |
  11. | git-server-keys | /git-server/keys | storage for user ssh keys |
  12. ##### Ports
  13. Set the following ports with the -p tag.
  14. | Container Port | Recommended outside port | Protocol | Description |
  15. | -------------- | ------------------------ | -------- | ------------------------------------- |
  16. | 22 | 2222 | TCP | ssh port for accessing the git server |
  17. ##### Rebuild
  18. ```
  19. #!/bin/sh
  20. docker stop git-server
  21. docker rm git-server
  22. docker pull jkarlos/git-server-docker:latest
  23. docker run --name git-server \
  24. --restart unless-stopped \
  25. -p 2222:22 \
  26. -v git-server_repos:/git-server/repos \
  27. -v git-server_keys:/git-server/keys \
  28. -d jkarlos/git-server-docker
  29. ```
  30. #### Gitea (Webinterface)
  31. The official container and documentation was made by [gitea](https://hub.docker.com/gitea/gitea).
  32. This docker-rebuild is made up by a `docker-compose.yml` file.
  33. The services in this files are explained seperately.
  34. ##### Gitea
  35. ###### Environment-variables
  36. Set the following environment-variables in the `environment:` section of the docker-compose file.
  37. | Name | Usage | Default |
  38. | ------------------- | ------------------------------ | ------- |
  39. | USER\_UID | User userid to run gitea | |
  40. | USER\_GID | User groupid to run gitea | |
  41. | DB\_TYPE | Specify database type | |
  42. | DB\_HOST | Specify database host and port | |
  43. | DB\_NAME | Specify Name of the database | |
  44. | DB\_USER | Username for the database | |
  45. | DB\_PASSWD | Password for the database | |
  46. ###### Volumes
  47. Set the following volumes in the `volumes:` section of the docker-compose file.
  48. | Volume-Name | Container mount | Description |
  49. | ---------------- | ---------------------- | ------------------------------ |
  50. | data | /data | storage for data of git server |
  51. | /etc/timezone | /etc/timezone:ro | link timezone |
  52. | /etc/localtime | /etc/localtime | link localtime |
  53. ###### Ports
  54. Set the following ports in the `ports:` section.
  55. | Container Port | Recommended outside port | Protocol | Description |
  56. | -------------- | ------------------------ | -------- | ---------------------- |
  57. | 3000 | 3000 | TCP | WebUI |
  58. | 22 | 222 | TCP | ssh port of git server |
  59. ###### Networks
  60. Set the following networks in the `networks:` section of the docker-compose file.
  61. | Name | Usage |
  62. | ----- | --------------------- |
  63. | gitea | connect db with gitea |
  64. ###### Dependencies
  65. Set the following dependencies in the `depends_on:` section of the docker-compose file.
  66. | Name | Usage |
  67. | ----- | --------------------- |
  68. | db | Ensure db is running |
  69. ##### MySql
  70. ###### Environment-variables
  71. Set the following environment-variables in the `environment:` section of the docker-compose file.
  72. | Name | Usage | Default |
  73. | ------------------- | ----------------------------- | ------- |
  74. | MYSQL\_ROOT\_PASSWORD | set the mysql admin password | |
  75. | MYSQL\_USER | set the mysql username | |
  76. | MYSQL\_PASSWORD | set the mysql user password | |
  77. | MYSQL\_Database | specify mysql database to use | |
  78. ###### Volumes
  79. Set the following volumes in the `volumes:` section of the docker-compose file.
  80. | Volume-Name | Container mount | Description |
  81. | ---------------- | ---------------------- | ---------------------------- |
  82. | mysql | /var/lib/mysql | storage for owncloud data |
  83. ###### Networks
  84. Set the following networks in the `networks:` section of the docker-compose file.
  85. | Name | Usage |
  86. | ----- | --------------------- |
  87. | gitea | connect db with gitea |
  88. ##### Rebuild
  89. ```
  90. #!/bin/sh
  91. docker-compose down
  92. docker-compose up -d
  93. ```
  94. ##### Docker-Compose.yml
  95. ```
  96. version: "2"
  97. networks:
  98. gitea:
  99. external: false
  100. services:
  101. server:
  102. image: gitea/gitea:latest
  103. environment:
  104. - USER_UID=1000
  105. - USER_GID=1000
  106. - DB_TYPE=mysql
  107. - DB_HOST=db:3306
  108. - DB_NAME=gitea
  109. - DB_USER=gitea
  110. - DB_PASSWD=gitea
  111. restart: unless-stopped
  112. networks:
  113. - gitea
  114. volumes:
  115. - data:/data
  116. - /etc/timezone:/etc/timezone:ro
  117. - /etc/localtime:/etc/localtime:ro
  118. ports:
  119. - "3000:3000"
  120. - "222:22"
  121. depends_on:
  122. - db
  123. db:
  124. image: mysql:5.7
  125. restart: unless-stopped
  126. environment:
  127. - MYSQL_ROOT_PASSWORD=gitea
  128. - MYSQL_USER=gitea
  129. - MYSQL_PASSWORD=gitea
  130. - MYSQL_DATABASE=gitea
  131. networks:
  132. - gitea
  133. volumes:
  134. - mysql:/var/lib/mysql
  135. volumes:
  136. data:
  137. driver: local
  138. mysql:
  139. driver: local
  140. ```