-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[docker] Separate various /data/gitea #6652
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
Changes from all commits
54681e6
782755e
b8b0977
2e38f3e
c32f773
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# Define the environment variables | ||
export DATA_PATH=${DATA_PATH:-"/data/gitea"} | ||
export GITEA_CUSTOM=${GITEA_CUSTOM:-"/data/gitea"} | ||
export RUN_DIR=${RUN_DIR:-"/app/gitea"} | ||
|
||
|
||
# Set INSTALL_LOCK to true only if SECRET_KEY is not empty and | ||
# INSTALL_LOCK is empty | ||
if [ -n "$SECRET_KEY" ] && [ -z "$INSTALL_LOCK" ]; then | ||
INSTALL_LOCK=true | ||
fi | ||
|
||
export APP_NAME=${APP_NAME:-"Gitea: Git with a cup of tea"} | ||
export RUN_MODE=${RUN_MODE:-"dev"} | ||
export SSH_DOMAIN=${SSH_DOMAIN:-"localhost"} | ||
export HTTP_PORT=${HTTP_PORT:-"3000"} | ||
export ROOT_URL=${ROOT_URL:-""} | ||
export DISABLE_SSH=${DISABLE_SSH:-"false"} | ||
export SSH_PORT=${SSH_PORT:-"22"} | ||
export DB_TYPE=${DB_TYPE:-"sqlite3"} | ||
export DB_HOST=${DB_HOST:-"localhost:3306"} | ||
export DB_NAME=${DB_NAME:-"gitea"} | ||
export DB_USER=${DB_USER:-"root"} | ||
export DB_PASSWD=${DB_PASSWD:-""} | ||
export INSTALL_LOCK=${INSTALL_LOCK:-"false"} | ||
export DISABLE_REGISTRATION=${DISABLE_REGISTRATION:-"false"} | ||
export REQUIRE_SIGNIN_VIEW=${REQUIRE_SIGNIN_VIEW:-"false"} | ||
export SECRET_KEY=${SECRET_KEY:-""} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#!/bin/bash | ||
[[ -f ./default_env ]] && source ./default_env | ||
[[ -f ./setup ]] && source ./setup | ||
|
||
pushd /app/gitea > /dev/null | ||
pushd "${RUN_DIR}" > /dev/null | ||
exec su-exec $USER /app/gitea/gitea web | ||
popd |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,41 +6,20 @@ if [ ! -d /data/git/.ssh ]; then | |
fi | ||
|
||
if [ ! -f /data/git/.ssh/environment ]; then | ||
echo "GITEA_CUSTOM=/data/gitea" >| /data/git/.ssh/environment | ||
echo "GITEA_CUSTOM=${GITEA_CUSTOM}" >| /data/git/.ssh/environment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A change of See PR #6608 for a workaround: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should wait for your PR to get merged and I will rebased this PR on. |
||
chmod 600 /data/git/.ssh/environment | ||
fi | ||
|
||
if [ ! -f /data/gitea/conf/app.ini ]; then | ||
mkdir -p /data/gitea/conf | ||
|
||
# Set INSTALL_LOCK to true only if SECRET_KEY is not empty and | ||
# INSTALL_LOCK is empty | ||
if [ -n "$SECRET_KEY" ] && [ -z "$INSTALL_LOCK" ]; then | ||
INSTALL_LOCK=true | ||
fi | ||
if [ ! -f "${GITEA_CUSTOM}/conf/app.ini" ]; then | ||
mkdir -p "${GITEA_CUSTOM}/conf" | ||
|
||
# Substitude the environment variables in the template | ||
APP_NAME=${APP_NAME:-"Gitea: Git with a cup of tea"} \ | ||
RUN_MODE=${RUN_MODE:-"dev"} \ | ||
SSH_DOMAIN=${SSH_DOMAIN:-"localhost"} \ | ||
HTTP_PORT=${HTTP_PORT:-"3000"} \ | ||
ROOT_URL=${ROOT_URL:-""} \ | ||
DISABLE_SSH=${DISABLE_SSH:-"false"} \ | ||
SSH_PORT=${SSH_PORT:-"22"} \ | ||
DB_TYPE=${DB_TYPE:-"sqlite3"} \ | ||
DB_HOST=${DB_HOST:-"localhost:3306"} \ | ||
DB_NAME=${DB_NAME:-"gitea"} \ | ||
DB_USER=${DB_USER:-"root"} \ | ||
DB_PASSWD=${DB_PASSWD:-""} \ | ||
INSTALL_LOCK=${INSTALL_LOCK:-"false"} \ | ||
DISABLE_REGISTRATION=${DISABLE_REGISTRATION:-"false"} \ | ||
REQUIRE_SIGNIN_VIEW=${REQUIRE_SIGNIN_VIEW:-"false"} \ | ||
SECRET_KEY=${SECRET_KEY:-""} \ | ||
envsubst < /etc/templates/app.ini > /data/gitea/conf/app.ini | ||
envsubst < /etc/templates/app.ini > "${GITEA_CUSTOM}/conf/app.ini" | ||
fi | ||
|
||
# only chown if current owner is not already the gitea ${USER}. No recursive check to save time | ||
if ! [[ $(ls -ld /data/gitea | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /data/gitea; fi | ||
if ! [[ $(ls -ld /app/gitea | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /app/gitea; fi | ||
if ! [[ $(ls -ld "${GITEA_CUSTOM}" | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git "${GITEA_CUSTOM}"; fi | ||
if ! [[ $(ls -ld "${DATA_PATH}" | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git "${DATA_PATH}"; fi | ||
if ! [[ $(ls -ld "${RUN_DIR}" | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git "${RUN_DIR}"; fi | ||
if ! [[ $(ls -ld /data/git | awk '{print $3}') = ${USER} ]]; then chown -R ${USER}:git /data/git; fi | ||
chmod 0755 /data/gitea /app/gitea /data/git | ||
chmod 0755 "${GITEA_CUSTOM}" "${DATA_PATH}" "${RUN_DIR}" /data/git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these hidden in a service file?
Except for the
INSTALL_LOCK
they can all go into the Dockerfile.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I didn't want to cluter the dockerfile but still wanted to have a dedicated file detailing all the env variable possible to use and their default. But it could be in the Dockerfile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment to the Dockerfile to indicate to go see this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the various config options seem to clutter the Dockerfile.
Removing the
GITEA_CUSTOM
environment variable breaks the ad-hoc commands.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
DATA_PATH
?APP_DATA_PATH
is already a setting inapp.ini
we should keep name same for same purpose.