Skip to content

Commit 182d225

Browse files
author
Simon Baerlocher
committed
feat: move data home
1 parent cbf1a84 commit 182d225

File tree

12 files changed

+58
-18
lines changed

12 files changed

+58
-18
lines changed

commands/_internals/checkUpdate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
function _ddeCheckUpdate() {
22
local oldPwd=$(pwd)
33
cd ${ROOT_DIR}
4-
if [ ! -f "${DATA_DIR}/.dde_update_check" ] || [ $(find "${DATA_DIR}/.dde_update_check" -mtime +1 -print) ]; then
4+
if [ ! -f "${DDE_DATA_HOME}/.dde_update_check" ] || [ $(find "${DDE_DATA_HOME}/.dde_update_check" -mtime +1 -print) ]; then
55
_logYellow "Check if dde update is available"
66
git fetch || true # allow offline usage
7-
touch ${DATA_DIR}/.dde_update_check
7+
touch ${DDE_DATA_HOME}/.dde_update_check
88
fi
99

1010
local upstream=${1:-'@{u}'}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
_createDataHome() {
2+
# Check if DDE_DATA_HOME is set
3+
if [ -z "$DDE_DATA_HOME" ]; then
4+
_logRed "DDE_DATA_HOME is not set."
5+
return 1
6+
fi
7+
8+
# Create the main directory if it doesn't exist
9+
if [ ! -d "$DDE_DATA_HOME" ]; then
10+
mkdir -p "$DDE_DATA_HOME"
11+
fi
12+
13+
# Check if DATA_DIR exists
14+
if [ -d "$DATA_DIR" ]; then
15+
# Move contents of DATA_DIR to DDE_DATA_HOME
16+
# Assuming DDE_DATA_HOME/data is the target directory
17+
local targetDir="$DDE_DATA_HOME/data"
18+
mkdir -p "$targetDir"
19+
mv "$DATA_DIR/*" "$targetDir/"
20+
fi
21+
22+
# Create config.yml if it doesn't exist
23+
local configFile="$DDE_DATA_HOME/config.yml"
24+
if [ ! -f "$configFile" ]; then
25+
touch "$configFile"
26+
fi
27+
28+
# Create dde.conf in the nginx conf.d directory if it doesn't exist
29+
local nginxConfFile="$DDE_DATA_HOME/data/reverseproxy/etc/nginx/conf.d/dde.conf"
30+
if [ ! -f "$nginxConfFile" ]; then
31+
mkdir -p "$(dirname "$nginxConfFile")"
32+
echo "client_max_body_size 100m;" > "$nginxConfFile"
33+
fi
34+
}

commands/project/destroy.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function project:destroy() {
1414

1515
for vhost in $(${DOCKER_COMPOSE} config | _yq_stdin e '.services.*.environment.VIRTUAL_HOST | select(length>0)'); do
1616
_logYellow "Delete certs for ${vhost}"
17-
rm -f ${CERT_DIR}/${vhost}.*
17+
rm -f ${DDE_CERT_PATH}/${vhost}.*
1818
done
1919

2020
if [ "${SYNC_MODE}" = "mutagen" ]; then
@@ -31,4 +31,3 @@ function project:destroy() {
3131
function destroy() {
3232
project:destroy
3333
}
34-

commands/project/up.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function project:up() {
1414

1515
_logYellow "Generating SSL cert"
1616
for vhost in $(${DOCKER_COMPOSE} config | _yq_stdin e '.services.*.environment.VIRTUAL_HOST | select(length>0)'); do
17-
${HELPER_DIR}/generate-vhost-cert.sh ${CERT_DIR} ${vhost}
17+
${HELPER_DIR}/generate-vhost-cert.sh ${DDE_CERT_PATH} ${vhost}
1818
done
1919

2020
if [ "${SYNC_MODE}" = "docker-sync" ]; then

commands/system/dde/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## makes the setup for your shell
22

33
function system:dde:install() {
4+
_createDataHome
45
system:dde:install:alias
56
}

commands/system/env.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ function system:env() {
99
echo OSTYPE=${OSTYPE}
1010
echo SOURCE=${SOURCE}
1111
echo ROOT_DIR=${ROOT_DIR}
12-
echo DATA_DIR=${DATA_DIR}
13-
echo CERT_DIR=${CERT_DIR}
12+
_logYellow "DATA_DIR (Deprecated, use DDE_DATA_HOME) = ${DATA_DIR}"
13+
_logYellow "CERT_DIR (Deprecated, use DDE_CERT_PATH) = ${CERT_DIR}"
14+
echo DDE_DATA_HOME=${DDE_DATA_HOME}
15+
echo DDE_CERT_PATH=${DDE_CERT_PATH}
1416
echo HELPER_DIR=${HELPER_DIR}
1517
echo NETWORK_NAME=${NETWORK_NAME}
1618
echo DOCKER_BUILDKIT=${DOCKER_BUILDKIT}
1719
echo DDE_UID=${DDE_UID}
1820
echo DDE_GID=${DDE_GID}
1921
echo ""
20-
_logGreen "Avialable services";
22+
_logGreen "Available services"
2123
system:services
2224
}
2325

commands/system/up.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ function system:up() {
2121
fi
2222

2323
_logYellow "Creating CA cert if required"
24-
mkdir -p ${CERT_DIR}
25-
cd ${CERT_DIR}
24+
mkdir -p ${DDE_CERT_PATH}
25+
cd ${DDE_CERT_PATH}
2626
if [ ! -f ca.pem ]; then
2727
openssl genrsa -out ca.key 2048
2828
openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 -subj "/C=CH/ST=Bern/L=Bern/O=dde/CN=dde" -out ca.pem
2929
fi
3030

3131
_logYellow "Creating certs used by system services"
32-
${HELPER_DIR}/generate-vhost-cert.sh ${CERT_DIR} mailhog.test
32+
${HELPER_DIR}/generate-vhost-cert.sh ${DDE_CERT_PATH} mailhog.test
3333

3434
_logYellow "Starting containers"
3535
cd ${ROOT_DIR}
@@ -44,4 +44,3 @@ function system:up() {
4444
function system-up() {
4545
system:up
4646
}
47-

commands/system/update.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function system:update() {
1919
${DOCKER_COMPOSE} build --pull
2020

2121
_logYellow "Starting dde (system)"
22+
_createDataHome
2223
system:up
2324

2425
_logGreen "Finished update successfully"

data/.gitkeep

Whitespace-only changes.

data/reverseproxy/etc/nginx/conf.d/dde.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)