|
|
@@ -1,86 +1,36 @@ |
|
|
|
Docker |
|
|
|
====== |
|
|
|
|
|
|
|
TOOLS ARE WRITTEN FOR TESTING AND TO SEE WHAT IT IS! |
|
|
|
|
|
|
|
For this to work you will need the nifty docker tool [docker-compose]. |
|
|
|
|
|
|
|
The most simple setup will look like this: |
|
|
|
|
|
|
|
```sh |
|
|
|
./assemble_blocks.sh docker_gogs w_db option_db_mysql |
|
|
|
docker-compose up |
|
|
|
# Docker for gogs |
|
|
|
|
|
|
|
## Usage |
|
|
|
``` |
|
|
|
docker pull gogits/gogs |
|
|
|
|
|
|
|
That's it. You have GoGS running in docker linked to a MySQL docker container. |
|
|
|
|
|
|
|
Now visit http://localhost:3000/ and give details for the admin account an you're up and running. |
|
|
|
|
|
|
|
|
|
|
|
How does it work |
|
|
|
---------------- |
|
|
|
|
|
|
|
`./assemble_blocks.sh` will look in `blocks` for subdirectories. |
|
|
|
In the subdirectories there are three relevant files: `Dockerfile`, `config` and `docker-compose`. |
|
|
|
|
|
|
|
`Dockerfile` will be copied to `docker/` (also means last `Dockerfile` wins). |
|
|
|
|
|
|
|
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. |
|
|
|
Here you can define things like the MySQL server for your database block. |
|
|
|
|
|
|
|
The `docker-compose` file will just be added to `docker-compose.yml`, which is used by docker-compose to manage your containers. |
|
|
|
This includes container linking! |
|
|
|
|
|
|
|
Just have a look at them and it will be clear how to write your own blocks. |
|
|
|
|
|
|
|
Just some things |
|
|
|
|
|
|
|
- all files (`Dockerfile`, `docker-compose` and `config`) are optional |
|
|
|
- the gogs block should always be the first block |
|
|
|
|
|
|
|
Currently the blocks are designed that, the blocks that start with `docker` pull in the base docker image. |
|
|
|
Then one block starting with `w` defines, what containers should be linked to the gogs container. |
|
|
|
For every option in the `w` block you need to add an `option` container. |
|
|
|
|
|
|
|
Example: |
|
|
|
|
|
|
|
```sh |
|
|
|
./assemble_blocks.sh docker_gogs w_db_cache option_db_mysql option_cache_redis |
|
|
|
mkdir -p /var/gogs |
|
|
|
docker run --name=gogs -p 10022:22 -p 10080:3000 -v /var/gogs:/data gogits/gogs |
|
|
|
``` |
|
|
|
|
|
|
|
File will store in local path: `/var/gogs` |
|
|
|
|
|
|
|
More sophisticated Example |
|
|
|
-------------------------- |
|
|
|
|
|
|
|
Here is a more elaborated example |
|
|
|
|
|
|
|
```sh |
|
|
|
./assemble_blocks.sh docker_gogs w_db_cache_session option_db_postgresql option_cache_redis option_session_mysql |
|
|
|
docker-compose up |
|
|
|
``` |
|
|
|
|
|
|
|
This will set up four containters and link them proberly. One for each of |
|
|
|
docker-compose |
|
|
|
- session (mysql) |
|
|
|
Directory `/var/gogs` keeps git repos and gogs data |
|
|
|
|
|
|
|
WARNING: This will not work at the Moment! MySQL session is broken! |
|
|
|
/var/gogs |
|
|
|
|-- git |
|
|
|
| `-- gogs-repositories |
|
|
|
|-- ssh |
|
|
|
| `-- # ssh pub-pri keys for gogs |
|
|
|
`---- gogs |
|
|
|
|-- conf |
|
|
|
|-- data |
|
|
|
|-- log |
|
|
|
`-- templates |
|
|
|
|
|
|
|
## SSH Support |
|
|
|
|
|
|
|
Remark |
|
|
|
------ |
|
|
|
In order to support ssh, You need to change `HTTP_PORT` and `SSH_PORT` in `/var/gogs/gogs/conf/app.ini` |
|
|
|
|
|
|
|
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. |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
```sh |
|
|
|
./assemble_blocks.sh docker_gogs_custom w_db option_database_mysql |
|
|
|
``` |
|
|
|
[server] |
|
|
|
HTTP_PORT = 3000 |
|
|
|
SSH_PORT = 10022 |
|
|
|
``` |
|
|
|
|
|
|
|
This will pull in the `Dockerfile` from `docker_gogs` instead of the one from `docker_gogs`. |
|
|
|
|
|
|
|
`Dockerfile`s for the `master` and `dev` branch are provided as `docker_gogs` and `docker_gogs_dev` |
|
|
|
|
|
|
|
|
|
|
|
[docker-compose]:https://docs.docker.com/compose/ |
|
|
|
setting description can be found in <http://gogs.io/docs/advanced/configuration_cheat_sheet.html> |