Skip to content

Commit 181c5ce

Browse files
committed
update script
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 4f70cd6 commit 181c5ce

2 files changed

Lines changed: 48 additions & 6 deletions

File tree

docs/installation.rst

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ This script will:
5454
``DEJACODE_HOME=/path/to/dir bash install.sh``
5555

5656
3. Create an application user
57-
------------------------------
57+
-----------------------------
5858

5959
::
6060

61-
dejacode createsuperuser
61+
dejacode exec web ./manage.py createsuperuser
6262

6363
Follow the prompt instructions, providing the required information:
6464

@@ -67,7 +67,7 @@ Follow the prompt instructions, providing the required information:
6767
- **Strong Password**: Create a password following security guidelines.
6868

6969
4. Access the application
70-
--------------------------
70+
-------------------------
7171

7272
.. admonition:: Congratulations!
7373
:class: tip
@@ -82,6 +82,31 @@ Follow the prompt instructions, providing the required information:
8282
The pre-built image always corresponds to the most recent release and is tagged
8383
``latest``.
8484

85+
.. _dejacode_command:
86+
87+
Managing your installation
88+
--------------------------
89+
90+
The ``dejacode`` command is a thin wrapper around ``docker compose``. All standard
91+
``docker compose`` subcommands work directly::
92+
93+
dejacode up -d # start all services in the background
94+
dejacode down # stop and remove containers
95+
dejacode restart # restart all services
96+
dejacode ps # show service status
97+
dejacode logs -f # follow all logs
98+
dejacode logs -f web # follow logs for a specific service
99+
dejacode pull # pull the latest image
100+
dejacode exec web ./manage.py createsuperuser
101+
102+
To update DejaCode to the latest release::
103+
104+
dejacode pull && dejacode up -d
105+
106+
To completely remove DejaCode and all its data::
107+
108+
dejacode uninstall
109+
85110
.. _run_with_docker_build:
86111

87112
Run with Docker — build from source

install.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,26 @@ printf 'SECRET_KEY=%s\nALLOWED_HOSTS=localhost\nCSRF_TRUSTED_ORIGINS=http://loca
4343
# ── Install wrapper command ───────────────────────────────────────────────────
4444
info "Installing dejacode command to $WRAPPER"
4545
mkdir -p "$BIN_DIR"
46-
curl -sSL "$REPO/bin/dejacode" -o "$WRAPPER"
47-
# Hardcode install dir into the wrapper
48-
sed -i.bak "s|^INSTALL_DIR=.*|INSTALL_DIR=\"$INSTALL_DIR\"|" "$WRAPPER" && rm "$WRAPPER.bak"
46+
cat > "$WRAPPER" << EOF
47+
#!/usr/bin/env bash
48+
set -euo pipefail
49+
INSTALL_DIR="$INSTALL_DIR"
50+
51+
case "\${1:-}" in
52+
uninstall)
53+
printf "This will permanently delete all DejaCode data. Type 'yes' to confirm: "
54+
read -r CONFIRM
55+
[ "\$CONFIRM" = "yes" ] || { echo "Aborted."; exit 1; }
56+
docker compose --project-directory "\$INSTALL_DIR" down -v --remove-orphans 2>/dev/null || true
57+
rm -rf "\$INSTALL_DIR"
58+
rm -f "\$0"
59+
echo "DejaCode has been uninstalled."
60+
;;
61+
*)
62+
cd "\$INSTALL_DIR" && exec docker compose "\$@"
63+
;;
64+
esac
65+
EOF
4966
chmod +x "$WRAPPER"
5067

5168
# ── Add ~/.local/bin to PATH if needed ───────────────────────────────────────

0 commit comments

Comments
 (0)