Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: change how to check whether initial or not #5766

Merged
merged 1 commit into from Aug 11, 2019

Conversation

midoridge
Copy link
Contributor

@midoridge midoridge commented Aug 2, 2019

When gogs on docker starts for the first time, change owner of /data, /app/gogs and ~git/ to git.
The current checking way is whether /data/gogs/conf/app.ini exists or not. (refer to #5724)

But if I already prepared app.ini file before and override /data/gogs/conf/app.ini, changing owner logic is skipped.
For example, I use docker-compose.yml as the following.

version: '3'
services:
  gogs:
    depends_on:
      - mysql
    image: gogs/gogs
    hostname: gogs
    networks:
      - default
    ports:
      - "3000:3000"
      - "10022:22"
    volumes:
      - git-data:/data/
      - ./gogs/conf/app.ini:/data/gogs/conf/app.ini

So, I changed initial checking logic that owner of /data is 'git' as the following.

if [ $(stat -c '%U' /data) != 'git' ]; then

When owner of /data is not 'git', change owner of /data, /app/gogs and ~git/ to git.

@unknwon
Copy link
Member

unknwon commented Aug 11, 2019

It is awesome! Thank you.

@unknwon unknwon merged commit 9571a9b into gogs:develop Aug 11, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants