Skip to content

Commit 2947c16

Browse files
committed
feat: Add an utility to run API containers easier
1 parent c82a127 commit 2947c16

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

bin/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Local maintenance utilities
2+
3+
This directory contains scripts to help running and maintaining the Flagsmith
4+
API in the local environment.
5+
6+
## Requirements
7+
8+
- Docker
9+
10+
That's it. These scripts are designed to interact with the application runtime
11+
through ephemeral Docker containers.
12+
13+
## Scripts
14+
15+
### `bin/run`
16+
17+
Runs any command within the `api` container. Examples:
18+
19+
- `bin/run` — runs pending migrations and starts the API HTTP server in dev mode.
20+
- `bin/run bash` — starts a bash shell in the API container.
21+
- `bin/run python manage.py makemigrations` — runs the command in the API container.
22+
- `bin/run flagsmith createsuperuser` — the Flagsmith CLI should be there too!
23+
- `bin/run pytest --sw --pdb api/tests/unit/test_my_feature.py` — you get it.
24+
25+
> This script is intended as a one-command option to run Flagsmith code with no
26+
> previous setup except from installing Docker.

bin/run

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
#
3+
# Runs any command from within an application container.
4+
# If no command is given, it runs the application's default command.
5+
docker compose -f docker/new/docker-compose.yml run --rm $([ $# -eq 0 ] && echo --service-ports --use-aliases) api "$@"

0 commit comments

Comments
 (0)