Project

General

Profile

Git Repositories on Docker

Added by Rodrigo Alonso 5 months ago

Before explaining your problem, please add the following informations:
- Ruby, Rails: Docker image redmine:latest
- OS: host OS openSUSE microOS, running Docker
- Database used, and its version: Docker image postgres:latest
- Ruby-aware server used: Puma I believe (

I have followed the guide specified here HowTo_Easily_integrate_a_(SSH_secured)_GIT_repository_into_redmine albeit my git isn't ssh_secured. I did a git clone with http
I made sure my volumes are correctly mounted (plugins & themes work), and I cloned the git as a mirror.
However I'm not sure about the part where we need to switch to the user that owns redmine: `switch to redmine-user`, however Docker is running as root, and I did the git clone as root.

I made sure the absolute path is in the settings within redmine, and I still get the 404 not found, and I see this in the docker container logs:

```
fatal: not a git repository: '/usr/src/redmine/repos/my_repo/'
fatal: not a git repository: '/usr/src/redmine/repos/my_repo/'
```

Here is my `docker-compose.yml`:
```
services:
postgres:
image: postgres:latest
container_name: postgres
restart: always
environment:
- POSTGRES_PASSWORD=< super top secret>
- POSTGRES_USER=postgres-redmine-user
networks:
- redmine-network

redmine:
image: redmine:latest
container_name: redmine
restart: always
ports:
- 80:3000
volumes:
- ./redmine_data:/usr/src/redmine/files
- ./plugins:/usr/src/redmine/plugins
- ./themes:/usr/src/redmine/public/themes
- ./repos:/usr/src/redmine/repos
environment:
- REDMINE_DB_POSTGRES=postgres
- REDMINE_DB_USERNAME=postgres-redmine-user
- REDMINE_DB_PASSWORD=< super top secret>
networks:
- redmine-network

networks:
redmine-network:
```

here is my git repo directory:
`~/redmine/repos/my_repo`

again, plugins & themes work with similar volume configurations and directories. I don't know if things should change due to cloning with http, or if cloning as root makes a difference, as I don't have a redmine user since it runs through Docker.

Thanks for the help!


Replies (4)

RE: Git Repositories on Docker - Added by Rodrigo Alonso 5 months ago

Apologies for the bad formatting, here's the yml:

services:
  postgres:
    image: postgres:latest
    container_name: postgres
    restart: always
    environment:
      - POSTGRES_PASSWORD=< super top secret>
      - POSTGRES_USER=postgres-redmine-user
    networks:
      - redmine-network
  redmine:
    image: redmine:latest
    container_name: redmine
    restart: always
    ports:
      - 80:3000
    volumes:
      - ./redmine_data:/usr/src/redmine/files
      - ./plugins:/usr/src/redmine/plugins
      - ./themes:/usr/src/redmine/public/themes
      - ./repos:/usr/src/redmine/repos
    environment:
      - REDMINE_DB_POSTGRES=postgres
      - REDMINE_DB_USERNAME=postgres-redmine-user
      - REDMINE_DB_PASSWORD=< super top secret>
    networks:
      - redmine-network
networks:
  redmine-network:

RE: Git Repositories on Docker - Added by Holger Just 5 months ago

Make sure that the repository in /usr/src/redmine/repos/my_repo/ is a bare repository, i.e. it does not contain a working copy of checked out files, but just the git-internal data structures, i.e. files like HEAD and config and directories like hooks, refs and objects.

This is normally done by git when performing a git clone --mirror.

RE: Git Repositories on Docker - Added by Rodrigo Alonso 4 months ago

Hi, thanks for your response.
I did make sure that I did a git clone --mirror, the list of directories I have in that folder are these:

HEAD
branches
config
description
hooks
info
objects
packed-refs
refs

RE: Git Repositories on Docker - Added by Rodrigo Alonso 4 months ago

Without making any changes it started working today, don't know if it just takes a couple days or git was acting weird

    (1-4/4)