FAQ | This is a LIVE service | Changelog

Skip to content

feat: add ability to run shell command inside container

Dmitrii Unterov requested to merge add-debug-exec-url into master

Closes #60 (closed)

How to test it locally

Prepare project

copier copy --trust --vcs-ref add-debug-exec-url https://gitlab.developers.cam.ac.uk/uis/devops/webapp-boilerplate.git ~/projects/sandbox/bptest2
# answer questions, leave all in default mostly

cp secrets.env.in secrets.env

By default CMD_DEBUG is set to false

poe up --wait

curl --request POST http://localhost:8000/exec --header "Content-Type: text/plain" --data-binary "ls -la"
# will return 404 page

poe down

In docker-compose file set

  CMD_DEBUG: true
poe up --wait

curl --request GET http://localhost:8000/exec --header "Content-Type: text/plain" --data-binary "ls -la"
{"message": "Use POST method."}%

curl --request POST http://localhost:8000/exec --header "Content-Type: text/plain" --data-binary "ls -la"
total 224
drwxr-xr-x 29 root root    928 Nov  6 14:33 .
drwxr-xr-x  1 root root   4096 Nov  6 12:46 ..
-rw-r--r--  1 root root    668 Nov  6 14:31 .copier-answers.yml
-rw-r--r--  1 root root    130 Nov  6 14:31 .coveragerc
-rw-r--r--  1 root root    216 Nov  6 14:31 .dockerignore
-rw-r--r--  1 root root    397 Nov  6 14:31 .editorconfig
-rw-r--r--  1 root root    228 Nov  6 14:31 .flake8
drwxr-xr-x 10 root root    320 Nov  6 14:31 .git
-rw-r--r--  1 root root   1296 Nov  6 14:31 .gitignore
drwxr-xr-x  3 root root     96 Nov  6 14:31 .gitlab
-rw-r--r--  1 root root     52 Nov  6 14:31 .gitlab-ci.yml
drwxr-xr-x  5 root root    160 Nov  6 14:33 .mypy_cache
-rw-r--r--  1 root root   1393 Nov  6 14:31 .pre-commit-config.yaml
-rw-r--r--  1 root root    497 Nov  6 14:31 .release-it.json
-rw-r--r--  1 root root   4481 Nov  6 14:31 Dockerfile
-rw-r--r--  1 root root   2935 Nov  6 14:31 README.md
drwxr-xr-x  3 root root     96 Nov  6 14:32 build
-rw-r--r--  1 root root   1265 Nov  6 14:31 conftest.py
-rw-r--r--  1 root root   4004 Nov  6 14:38 docker-compose.yml
-rw-r--r--  1 root root    886 Nov  6 14:31 gunicornconf.py
-rwxr-xr-x  1 root root    551 Nov  6 14:31 manage.py
-rw-r--r--  1 root root 130774 Nov  6 14:31 poetry.lock
drwxr-xr-x  9 root root    288 Nov  6 14:33 projectname
drwxr-xr-x 10 root root    320 Nov  6 14:33 projectname_project
-rw-r--r--  1 root root   4220 Nov  6 14:31 pyproject.toml
-rw-r--r--  1 root root    554 Nov  6 14:31 renovate.json
-rw-r--r--  1 root root    704 Nov  6 14:31 secrets.env
-rw-r--r--  1 root root    704 Nov  6 14:31 secrets.env.in
-rw-r--r--  1 root root   2365 Nov  6 14:31 tox.ini

poe down
Edited by Dmitrii Unterov

Merge request reports

Loading