sameersbn / docker-gitlab

Dockerized GitLab
http://www.damagehead.com/docker-gitlab/
MIT License
7.9k stars 2.14k forks source link

How can I find this key? #2587

Open andyzheung opened 2 years ago

andyzheung commented 2 years ago

I install gitlab-ce use this repo: how can i find the following env? where are they store? --env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \ --env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' \ --env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' \

andyzheung commented 2 years ago

I think the file is here: https://stackoverflow.com/questions/43647885/gitlab-500-page-after-upgrading-a-gitlab-setup-with-two-factor-login /home/git/data/.secret but I can't cat or cp out of container? image

andyzheung commented 2 years ago

I want to restore the repo....any one can give some information,

kkimurak commented 2 years ago

They are stored in /home/git/gitlab/config/secrets.yml if you have never changed configuration.


Detailed architecture:

We can configure gitlab (and related middle ware) via environment variables. You can find dummy variable {{GITLAB_SECRETS_DB_KEY_BASE}} is in /etc/docker-gitlab/runtime/config/gitlabhq/secrest.yml in container. We call those files as "template file".
During container startup, sameersbn/gitlab will copy those template files that placed in /etc/docker-gitlab/runtime/config/ to respective directory. You can find the message like Installing configuration templates... in docker logs.
See install_template function for implementation.

Then, those variables will be updated by update_template. For example, when we pass --env GITLAB_SECRETS_DB_KEY_BASE=hoge, the secrets file /home/git/gitlab/config/secrets.yml will be like:

production:
  db_key_base: hoge

Now the dummy value {{GITLAB_SECRETS_DB_KEY_BASE}} is replaced by the value of environment variable GITLAB_SECRETS_DB_KEY_BASE.

andyzheung commented 2 years ago

They are stored in /home/git/gitlab/config/secrets.yml if you have never changed configuration.

Detailed architecture:

We can configure gitlab (and related middle ware) via environment variables. You can find dummy variable {{GITLAB_SECRETS_DB_KEY_BASE}} is in /etc/docker-gitlab/runtime/config/gitlabhq/secrest.yml in container. We call those files as "template file". During container startup, sameersbn/gitlab will copy those template files that placed in /etc/docker-gitlab/runtime/config/ to respective directory. You can find the message like Installing configuration templates... in docker logs. See install_template function for implementation.

Then, those variables will be updated by update_template. For example, when we pass --env GITLAB_SECRETS_DB_KEY_BASE=hoge, the secrets file /home/git/gitlab/config/secrets.yml will be like:

production:
  db_key_base: hoge

Now the dummy value {{GITLAB_SECRETS_DB_KEY_BASE}} is replaced by the value of environment variable GITLAB_SECRETS_DB_KEY_BASE.

Tks for the information. But I need this env value to restore the gitlab.. When I exec into container, I found the env: GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string How can I know the value about the "long-and-random-alpha-numeric-string"? and so that i can import to the other gitlab to restore it?

kkimurak commented 2 years ago

Then long-and-random-alpha-numeric-string is the value for it.

andyzheung commented 2 years ago

Then long-and-random-alpha-numeric-string is the value for it.

oh, you mean the value is: long-and-random-alpha-numeric-string.. I got it, and try it.