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.

138 lines
4.2 KiB

7 months ago
  1. # Gitea
  2. ## Setup Server
  3. ### Docker
  4. #### Gitea
  5. ##### Environment-variables
  6. Set the following environment-variables in the `environment:` section of the docker-compose file.
  7. | Name | Usage | Default |
  8. | ------------------- | ------------------------------ | ------- |
  9. | USER\_UID | User userid to run gitea | |
  10. | USER\_GID | User groupid to run gitea | |
  11. | DB\_TYPE | Specify database type | |
  12. | DB\_HOST | Specify database host and port | |
  13. | DB\_NAME | Specify Name of the database | |
  14. | DB\_USER | Username for the database | |
  15. | DB\_PASSWD | Password for the database | |
  16. ##### Volumes
  17. Set the following volumes in the `volumes:` section of the docker-compose file.
  18. | Volume-Name | Container mount | Description |
  19. | ---------------- | ---------------------- | ------------------------------ |
  20. | data | /data | storage for data of git server |
  21. | /etc/timezone | /etc/timezone:ro | link timezone |
  22. | /etc/localtime | /etc/localtime | link localtime |
  23. ##### Ports
  24. Set the following ports in the `ports:` section.
  25. | Container Port | Recommended outside port | Protocol | Description |
  26. | -------------- | ------------------------ | -------- | ---------------------- |
  27. | 3000 | 3000 | TCP | WebUI |
  28. | 22 | 222 | TCP | ssh port of git server |
  29. ##### Networks
  30. Set the following networks in the `networks:` section of the docker-compose file.
  31. | Name | Usage |
  32. | ----- | --------------------- |
  33. | gitea | connect db with gitea |
  34. ##### Dependencies
  35. Set the following dependencies in the `depends_on:` section of the docker-compose file.
  36. | Name | Usage |
  37. | ----- | --------------------- |
  38. | db | Ensure db is running |
  39. #### MySql
  40. ##### Environment-variables
  41. Set the following environment-variables in the `environment:` section of the docker-compose file.
  42. | Name | Usage | Default |
  43. | ------------------- | ----------------------------- | ------- |
  44. | MYSQL\_ROOT\_PASSWORD | set the mysql admin password | |
  45. | MYSQL\_USER | set the mysql username | |
  46. | MYSQL\_PASSWORD | set the mysql user password | |
  47. | MYSQL\_Database | specify mysql database to use | |
  48. ##### Volumes
  49. Set the following volumes in the `volumes:` section of the docker-compose file.
  50. | Volume-Name | Container mount | Description |
  51. | ---------------- | ---------------------- | ---------------------------- |
  52. | mysql | /var/lib/mysql | storage for owncloud data |
  53. ##### Networks
  54. Set the following networks in the `networks:` section of the docker-compose file.
  55. | Name | Usage |
  56. | ----- | --------------------- |
  57. | gitea | connect db with gitea |
  58. #### Rebuild
  59. ```
  60. #!/bin/sh
  61. docker-compose down
  62. docker-compose up -d
  63. ```
  64. #### Docker-Compose.yml
  65. ```
  66. version: "2"
  67. networks:
  68. gitea:
  69. external: false
  70. services:
  71. server:
  72. image: gitea/gitea:latest
  73. environment:
  74. - USER_UID=1000
  75. - USER_GID=1000
  76. - DB_TYPE=mysql
  77. - DB_HOST=db:3306
  78. - DB_NAME=gitea
  79. - DB_USER=gitea
  80. - DB_PASSWD=gitea
  81. restart: unless-stopped
  82. networks:
  83. - gitea
  84. volumes:
  85. - data:/data
  86. - /etc/timezone:/etc/timezone:ro
  87. - /etc/localtime:/etc/localtime:ro
  88. ports:
  89. - "3000:3000"
  90. - "222:22"
  91. depends_on:
  92. - db
  93. db:
  94. image: mysql:5.7
  95. restart: unless-stopped
  96. environment:
  97. - MYSQL_ROOT_PASSWORD=gitea
  98. - MYSQL_USER=gitea
  99. - MYSQL_PASSWORD=gitea
  100. - MYSQL_DATABASE=gitea
  101. networks:
  102. - gitea
  103. volumes:
  104. - mysql:/var/lib/mysql
  105. volumes:
  106. data:
  107. driver: local
  108. mysql:
  109. driver: local
  110. ```