Merge pull request #222 from SamR1/docker-tests
Updade docker commands + fix docker compose
This commit is contained in:
commit
8f5c48a893
2
.github/workflows/.tests-python.yml
vendored
2
.github/workflows/.tests-python.yml
vendored
@ -95,4 +95,4 @@ jobs:
|
||||
export TEST_APP_URL=http://$(hostname --ip-address):5000
|
||||
sleep 5
|
||||
nohup flask worker --processes=1 >> nohup.out 2>&1 &
|
||||
pytest e2e --driver Remote --capability browserName firefox --host selenium --port 4444
|
||||
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444
|
||||
|
25
Makefile
25
Makefile
@ -50,11 +50,18 @@ docker-build-all: docker-build docker-build-client
|
||||
docker-build-client:
|
||||
docker-compose -f docker-compose-dev.yml build fittrackee_client
|
||||
|
||||
docker-init: docker-init-db docker-restart docker-run-workers
|
||||
docker-init: docker-run docker-init-db docker-restart docker-run-workers
|
||||
|
||||
docker-init-db:
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee docker/init-database.sh
|
||||
|
||||
docker-lint-client:
|
||||
docker-compose -f docker-compose-dev.yml up -d fittrackee_client
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee_client yarn lint
|
||||
|
||||
docker-lint-python: docker-run
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee docker/lint-python.sh
|
||||
|
||||
docker-logs:
|
||||
docker-compose -f docker-compose-dev.yml logs --follow
|
||||
|
||||
@ -85,6 +92,18 @@ docker-shell:
|
||||
docker-stop:
|
||||
docker-compose -f docker-compose-dev.yml stop
|
||||
|
||||
docker-test-client:
|
||||
docker-compose -f docker-compose-dev.yml up -d fittrackee_client
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee_client yarn test:unit
|
||||
|
||||
# needs a running application
|
||||
docker-test-e2e: docker-run
|
||||
docker-compose -f docker-compose-dev.yml up -d selenium
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee docker/test-e2e.sh $(PYTEST_ARGS)
|
||||
|
||||
docker-test-python: docker-run
|
||||
docker-compose -f docker-compose-dev.yml exec fittrackee docker/test-python.sh $(PYTEST_ARGS)
|
||||
|
||||
docker-up:
|
||||
docker-compose -f docker-compose-dev.yml up fittrackee
|
||||
|
||||
@ -184,11 +203,11 @@ set-admin:
|
||||
echo "Deprecated command, will be removed in a next version. Use 'user-set-admin' instead."
|
||||
$(FTCLI) users update $(USERNAME) --set-admin true
|
||||
|
||||
test-all: test-client test-python
|
||||
|
||||
test-e2e:
|
||||
$(PYTEST) e2e --driver firefox $(PYTEST_ARGS)
|
||||
|
||||
test-all: test-client test-python
|
||||
|
||||
test-e2e-client:
|
||||
E2E_ARGS=client $(PYTEST) e2e --driver firefox $(PYTEST_ARGS)
|
||||
|
||||
|
@ -12,6 +12,8 @@ services:
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
volumes:
|
||||
- ./data/db:/var/lib/postgresql/data
|
||||
networks:
|
||||
- fittrackee-net
|
||||
|
||||
fittrackee:
|
||||
container_name: fittrackee
|
||||
@ -24,14 +26,12 @@ services:
|
||||
- fittrackee-db
|
||||
- redis
|
||||
- mail
|
||||
links:
|
||||
- fittrackee-db
|
||||
- redis
|
||||
- mail
|
||||
volumes:
|
||||
- .:/usr/src/app
|
||||
- ./data/workouts:/usr/src/app/workouts
|
||||
- ./data/uploads:/usr/src/app/uploads
|
||||
networks:
|
||||
- fittrackee-net
|
||||
|
||||
fittrackee_client:
|
||||
container_name: fittrackee_client
|
||||
@ -57,6 +57,8 @@ services:
|
||||
hostname: redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
networks:
|
||||
- fittrackee-net
|
||||
|
||||
mail:
|
||||
container_name: fittrackee-mailhog
|
||||
@ -64,3 +66,14 @@ services:
|
||||
ports:
|
||||
- "1025:1025"
|
||||
- "8025:8025"
|
||||
networks:
|
||||
- fittrackee-net
|
||||
|
||||
selenium:
|
||||
image: selenium/standalone-firefox:latest
|
||||
hostname: selenium
|
||||
privileged: true
|
||||
shm_size: 2g
|
||||
|
||||
networks:
|
||||
fittrackee-net:
|
@ -2,7 +2,7 @@
|
||||
set -e
|
||||
cd /usr/src/app
|
||||
|
||||
source .env.docker
|
||||
source .env
|
||||
|
||||
ftcli db drop
|
||||
ftcli db upgrade
|
8
docker/lint-python.sh
Executable file
8
docker/lint-python.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cd /usr/src/app
|
||||
|
||||
source .env
|
||||
|
||||
mypy fittrackee
|
||||
pytest --flake8 --isort --black -m "flake8 or isort or black" fittrackee e2e --ignore=fittrackee/migrations
|
@ -2,6 +2,6 @@
|
||||
set -e
|
||||
cd /usr/src/app
|
||||
|
||||
source .env.docker
|
||||
source .env
|
||||
|
||||
flask worker --processes=$WORKERS_PROCESSES >> dramatiq.log 2>&1
|
||||
|
@ -2,6 +2,6 @@
|
||||
set -e
|
||||
cd /usr/src/app
|
||||
|
||||
source .env.docker
|
||||
source .env
|
||||
|
||||
ftcli users update $1 --set-admin true
|
||||
|
@ -2,6 +2,6 @@
|
||||
set -e
|
||||
cd /usr/src/app
|
||||
|
||||
source .env.docker
|
||||
source .env
|
||||
|
||||
/bin/bash
|
8
docker/test-e2e.sh
Executable file
8
docker/test-e2e.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cd /usr/src/app
|
||||
|
||||
source .env
|
||||
|
||||
export TEST_APP_URL=http://$(hostname --ip-address):5000
|
||||
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444 $*
|
7
docker/test-python.sh
Executable file
7
docker/test-python.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cd /usr/src/app
|
||||
|
||||
source .env
|
||||
|
||||
pytest fittrackee $*
|
@ -710,16 +710,22 @@ Installation
|
||||
|
||||
For evaluation purposes, docker files are available, installing **FitTrackee** from **sources**.
|
||||
|
||||
- To install **FitTrackee** with database initialisation and run the application and dramatiq workers:
|
||||
- To install **FitTrackee**:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git clone https://github.com/SamR1/FitTrackee.git
|
||||
$ cd FitTrackee
|
||||
$ cp .env.docker .env
|
||||
$ make docker-build docker-run docker-init
|
||||
$ make docker-build
|
||||
|
||||
Open http://localhost:5000 and register.
|
||||
- To initialise database:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ docker-init
|
||||
|
||||
- Open http://localhost:5000 and register.
|
||||
|
||||
Open http://localhost:8025 to access `MailHog interface <https://github.com/mailhog/MailHog>`_ (email testing tool)
|
||||
|
||||
@ -772,4 +778,13 @@ Development
|
||||
Open http://localhost:3000
|
||||
|
||||
.. note::
|
||||
Some environment variables need to be updated like `UI_URL`
|
||||
Some environment variables need to be updated like `UI_URL`
|
||||
|
||||
- to run lint or tests:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lint-client # run lint on javascript files
|
||||
$ make test-client # run unit tests on Client
|
||||
$ make lint-python # run type check and lint on python files
|
||||
$ make test-python # run unit tests on API
|
@ -996,15 +996,23 @@ server {
|
||||
</div>
|
||||
<p>For evaluation purposes, docker files are available, installing <strong>FitTrackee</strong> from <strong>sources</strong>.</p>
|
||||
<ul class="simple">
|
||||
<li><p>To install <strong>FitTrackee</strong> with database initialisation and run the application and dramatiq workers:</p></li>
|
||||
<li><p>To install <strong>FitTrackee</strong>:</p></li>
|
||||
</ul>
|
||||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ git clone https://github.com/SamR1/FitTrackee.git
|
||||
$ <span class="nb">cd</span> FitTrackee
|
||||
$ cp .env.docker .env
|
||||
$ make docker-build docker-run docker-init
|
||||
$ make docker-build
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Open <a class="reference external" href="http://localhost:5000">http://localhost:5000</a> and register.</p>
|
||||
<ul class="simple">
|
||||
<li><p>To initialise database:</p></li>
|
||||
</ul>
|
||||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ docker-init
|
||||
</pre></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p>Open <a class="reference external" href="http://localhost:5000">http://localhost:5000</a> and register.</p></li>
|
||||
</ul>
|
||||
<p>Open <a class="reference external" href="http://localhost:8025">http://localhost:8025</a> to access <a class="reference external" href="https://github.com/mailhog/MailHog">MailHog interface</a> (email testing tool)</p>
|
||||
<ul class="simple">
|
||||
<li><p>To set admin rights to the newly created account, use the following command line:</p></li>
|
||||
@ -1057,6 +1065,15 @@ $ make docker-build docker-run docker-init
|
||||
<p class="admonition-title">Note</p>
|
||||
<p>Some environment variables need to be updated like <cite>UI_URL</cite></p>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p>to run lint or tests:</p></li>
|
||||
</ul>
|
||||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ make lint-client <span class="c1"># run lint on javascript files</span>
|
||||
$ make test-client <span class="c1"># run unit tests on Client</span>
|
||||
$ make lint-python <span class="c1"># run type check and lint on python files</span>
|
||||
$ make test-python <span class="c1"># run unit tests on API</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
File diff suppressed because one or more lines are too long
@ -710,16 +710,22 @@ Installation
|
||||
|
||||
For evaluation purposes, docker files are available, installing **FitTrackee** from **sources**.
|
||||
|
||||
- To install **FitTrackee** with database initialisation and run the application and dramatiq workers:
|
||||
- To install **FitTrackee**:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git clone https://github.com/SamR1/FitTrackee.git
|
||||
$ cd FitTrackee
|
||||
$ cp .env.docker .env
|
||||
$ make docker-build docker-run docker-init
|
||||
$ make docker-build
|
||||
|
||||
Open http://localhost:5000 and register.
|
||||
- To initialise database:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ docker-init
|
||||
|
||||
- Open http://localhost:5000 and register.
|
||||
|
||||
Open http://localhost:8025 to access `MailHog interface <https://github.com/mailhog/MailHog>`_ (email testing tool)
|
||||
|
||||
@ -772,4 +778,13 @@ Development
|
||||
Open http://localhost:3000
|
||||
|
||||
.. note::
|
||||
Some environment variables need to be updated like `UI_URL`
|
||||
Some environment variables need to be updated like `UI_URL`
|
||||
|
||||
- to run lint or tests:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make lint-client # run lint on javascript files
|
||||
$ make test-client # run unit tests on Client
|
||||
$ make lint-python # run type check and lint on python files
|
||||
$ make test-python # run unit tests on API
|
Loading…
Reference in New Issue
Block a user