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

Adding FE dev instructions #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ User can choose between 2 types of installations:

_N.B.: Ports can be customized in advanced options._

## Rebuild static files (for frontend development)

To immediately see your changes (in the `kpi` repository) live you need to run `npm run watch` to rebuild static files on the fly:

```
$kodo-docker> docker-compose -f docker-compose.frontend.yml -f docker-compose.frontend.override.yml run -p 3000:3000 --rm kpi npm run watch
Copy link
Contributor

@noliveleger noliveleger Sep 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to @jnm work, this could be simplified to:
$kobo-install> ./run.py -cf run -p 3000:3000 --rm kpi npm run watch

To use this new option, two-databases is merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably need some docs related to https://www.flowdock.com/app/kobotoolbox/kobo/threads/oHknJLFhaDrfnSUtNXY2QNoxhCK (maybe applies only to old installs?)

```

Keep in mind that you need to continue running `npm run watch` to have static files be served continuously. Once stopped, static files won't be found anymore until you restart the `npm watch` or rebuild the container using

```
$kobo-install> python run.py --build-kpi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add two other lines:

$kobo-install> python run.py --build-kpi
$kobo-install> python run.py -cf restart kpi

Be aware that `kpi` takes few minutes to restart and to be up&running

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noliveleger, restarting isn't sufficient to use a newly-built image.

host:~/Documents/kobo/dockdev/kobo-install$ docker ps | sed -n '1p;/kpi/p'
CONTAINER ID        IMAGE                                                                  COMMAND                  CREATED             STATUS              PORTS                              NAMES
f79d983dccab        50948607b605                                                           "/bin/bash -c 'exec …"   30 minutes ago      Up About a minute   8000/tcp                           kobo-docker_kpi_1
host:~/Documents/kobo/dockdev/kobo-install$ python run.py -cf restart kpi
Restarting kobo-docker_kpi_1 ... done
host:~/Documents/kobo/dockdev/kobo-install$ docker ps | sed -n '1p;/kpi/p'
CONTAINER ID        IMAGE                                                                  COMMAND                  CREATED             STATUS              PORTS                              NAMES
f79d983dccab        50948607b605                                                           "/bin/bash -c 'exec …"   30 minutes ago      Up 2 seconds        8000/tcp                           kobo-docker_kpi_1

Instead, I'd suggest ./run.py -cf up -d kpi, which should notice that the container is using an out-of-date image and recreate the container:

host:~/Documents/kobo/dockdev/kobo-install$ ./run.py -cf up -d kpi
WARNING: Found orphan containers (kobo-docker_redis_cache_1, kobo-docker_postgres_1, kobo-docker_mongo_1, kobo-docker_redis_main_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Recreating kobo-docker_kpi_1 ... done
host:~/Documents/kobo/dockdev/kobo-install$ docker ps | sed -n '1p;/kpi/p'
CONTAINER ID        IMAGE                                                                  COMMAND                  CREATED             STATUS              PORTS                              NAMES
65dbfcc2891f        kpi:dev.1573945934                                                     "/bin/bash -c 'exec …"   5 seconds ago       Up 4 seconds        8000/tcp                           kobo-docker_kpi_1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

```

## Tests

Tests can be run with `tox`.
Expand Down