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

fix(system): separate data and config folders #88

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions commands/_internals/checkProject.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ function _checkProject() {
_logRed "docker-compose.yml not found"
exit 1
fi
if [ -z $(docker network ls --filter=name=${NETWORK_NAME} -q) ]; then
_logRed "dde network not created. Please run dde system:up"
exit 1
fi

mkdir -p .dde
cp -R ${ROOT_DIR}/helper/configure-image.sh .dde/configure-image.sh
}
17 changes: 9 additions & 8 deletions commands/system/destroy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
# system-destroy

function system:destroy() {
if [ -z $(docker network ls --filter=name=${NETWORK_NAME} -q) ]; then
_logRed "Already destroyed"
exit 0
fi

_logRed "Removing containers"
docker rm -f $(docker network inspect -f '{{ range $key, $value := .Containers }}{{ printf "%s\n" $key }}{{ end }}' ${NETWORK_NAME}) &>/dev/null
cd ${ROOT_DIR}
${DOCKER_COMPOSE} down --remove-orphans
${DOCKER_COMPOSE} --project-directory ${ROOT_DIR} down --remove-orphans
docker rm -f $(docker network inspect -f '{{ range $key, $value := .Containers }}{{ printf "%s\n" $key }}{{ end }}' ${NETWORK_NAME}) &>/dev/null || true

_logRed "Removing network if created"
if [ "$(docker network ls --filter=name=${NETWORK_NAME} -q)" != "" ]; then
_logRed "Remove network ${NETWORK_NAME}"
docker network rm ${NETWORK_NAME}
fi
_logRed "Remove network ${NETWORK_NAME}"
docker network rm ${NETWORK_NAME}

_logGreen "Finished destroying successfully"
}
Expand Down
8 changes: 6 additions & 2 deletions commands/system/nuke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ function system:nuke() {
_logRed "Removing dde sytem"
system:destroy

if [ -z ${DATA_DIR} ]; then
_logRed "DATA_DIR is not defined"
exit 1
fi

_logRed "Removing data"
cd ${ROOT_DIR}
sudo find ./data/* -maxdepth 1 -not -name .gitkeep -exec rm -rf {} ';'
sudo rm -rf ${DATA_DIR}/*

_logGreen "Finished nuking successfully"
}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./data/reverseproxy/etc/nginx/certs:/etc/nginx/certs:ro
- ./data/reverseproxy/etc/nginx/vhost.d:/etc/nginx/vhost.d:ro
- ./data/reverseproxy/etc/nginx/conf.d/dde.conf:/etc/nginx/conf.d/dde.conf:ro
- ./config/reverseproxy/etc/nginx/conf.d/dde.conf:/etc/nginx/conf.d/dde.conf:ro
hostname: reverseproxy
domainname: test
container_name: dde_reverseproxy
Expand Down
1 change: 1 addition & 0 deletions helper/generate-vhost-cert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ DIR=$1
VHOST=$2

# Generate
mkdir -p $DIR
cd $DIR
if [ ! -f $VHOST.crt ]; then \
openssl genrsa -out $VHOST.key 2048 && \
Expand Down