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

Conversation

tinok
Copy link
Member

@tinok tinok commented Aug 22, 2019

This adds short instructions on using npm run watch to rebuild static files during FE development in kpi.

@tinok tinok requested a review from noliveleger August 22, 2019 16:35
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

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?)

@jnm
Copy link
Member

jnm commented Jun 18, 2020

Let's also add a message to the run.py output and possibly a new --npm-run-watch flag that does the equivalent of ./run.py -cf run -p 3000:3000 --rm kpi npm run watch

https://www.flowdock.com/app/kobotoolbox/support/threads/L98VRtgJ23hevNvov8mBrBqtWJk

@ahmadshahkhadem123
Copy link

how see kobotoolbox URL and used URL in Mobile kobo app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants