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.

86 lines
2.7 KiB

10 years ago
10 years ago
  1. Docker
  2. ======
  3. TOOLS ARE WRITTEN FOR TESTING AND TO SEE WHAT IT IS!
  4. For this to work you will need the nifty docker tool [docker-compose].
  5. The most simple setup will look like this:
  6. ```sh
  7. ./assemble_blocks.sh docker_gogs w_db option_db_mysql
  8. docker-compose up
  9. ```
  10. That's it. You have GoGS running in docker linked to a MySQL docker container.
  11. Now visit http://localhost:3000/ and give details for the admin account an you're up and running.
  12. How does it work
  13. ----------------
  14. `./assemble_blocks.sh` will look in `blocks` for subdirectories.
  15. In the subdirectories there are three relevant files: `Dockerfile`, `config` and `docker-compose`.
  16. `Dockerfile` will be copied to `docker/` (also means last `Dockerfile` wins).
  17. The `config` file contains lines which will in the gogs docker container end up in `$GOGS_PATH/custom/config/app.ini` and by this gogs will be configured.
  18. Here you can define things like the MySQL server for your database block.
  19. The `docker-compose` file will just be added to `docker-compose.yml`, which is used by docker-compose to manage your containers.
  20. This includes container linking!
  21. Just have a look at them and it will be clear how to write your own blocks.
  22. Just some things
  23. - all files (`Dockerfile`, `docker-compose` and `config`) are optional
  24. - the gogs block should always be the first block
  25. Currently the blocks are designed that, the blocks that start with `docker` pull in the base docker image.
  26. Then one block starting with `w` defines, what containers should be linked to the gogs container.
  27. For every option in the `w` block you need to add an `option` container.
  28. Example:
  29. ```sh
  30. ./assemble_blocks.sh docker_gogs w_db_cache option_db_mysql option_cache_redis
  31. ```
  32. More sophisticated Example
  33. --------------------------
  34. Here is a more elaborated example
  35. ```sh
  36. ./assemble_blocks.sh docker_gogs w_db_cache_session option_db_postgresql option_cache_redis option_session_mysql
  37. docker-compose up
  38. ```
  39. This will set up four containters and link them proberly. One for each of
  40. docker-compose
  41. - session (mysql)
  42. WARNING: This will not work at the Moment! MySQL session is broken!
  43. Remark
  44. ------
  45. After you execute `assemble_blocks.sh` you should always trigger `docker-compose build` to inculde the the new init script `init_gogs.sh` in the docker image.
  46. If you want to use another GoGS docker file, but keep everything else the same, you can create a block, e.g. `docker_gogs_custom`, with only a `Dockerfile` and call
  47. ```sh
  48. ./assemble_blocks.sh docker_gogs_custom w_db option_database_mysql
  49. ```
  50. This will pull in the `Dockerfile` from `docker_gogs` instead of the one from `docker_gogs`.
  51. `Dockerfile`s for the `master` and `dev` branch are provided as `docker_gogs` and `docker_gogs_dev`
  52. [docker-compose]:https://docs.docker.com/compose/