Skip to content

Commit

Permalink
Clean up of repo
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelicr committed Nov 24, 2023
1 parent 4091922 commit ef910d7
Show file tree
Hide file tree
Showing 50 changed files with 211 additions and 6,893 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
################### BUILD AND RUN THIS DOCKER FILE ############################

### BUILD IMAGE
# docker build -t rachelicr/env-pisca-v1 -f .devcontainer/Dockerfile .
## docker build -t rachelicr/env-pisca-v1 -f .devcontainer/Dockerfile .
# docker build -t env-pisca-v1 -f .devcontainer/Dockerfile .

### USE IMAGE
# ctrl-sh-p in vscode and select the image
Expand Down
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python:Streamlit",
"type": "python",
"request": "launch",
"module": "streamlit",
"args": [
"run",
"${file}",
"--server.port",
"8501"
]
},
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}



70 changes: 0 additions & 70 deletions README-dev.md

This file was deleted.

25 changes: 0 additions & 25 deletions README-use-vue.md

This file was deleted.

36 changes: 36 additions & 0 deletions dev_docs/dev_1_container.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Containerised Development

Due to the complexity of the PISCA environment this project is designed to be developed and debugged in a container.

Thus, VSCode is the IDE of choice, as the ability use conatiners for development is integrated and free. It is also possible in a paid-foir version of pycharm.
You will need the Dev Containers extension installed.

## The container
The develoment container is defined in the `devcontainer.json` file. This file defines the container image to be used, the extensions to be installed and the settings to be used.

The container image is defined in the `Dockerfile` file. This file defines the base image to be used and the additional packages to be installed.

## Building the container
- You should not need to build the container, it can pull down from docker automatically
- Should you need to, the instructions for building are at the top of the Dockerfile

## Using the container
- ctrl-sh-p in vscode and select "Devcontainers: Repoen in container"

You will see the file system much as before, this time in Workspaces/pisca-box a pseudo linux operating system.
It will feel a bit different to an ordinary dev environment as for example there is no virtual environment, that was all installed in the container.

If you find a need to add a python library or R library they need to go in the container and then it needs to be rebuilt and redistributed.

Check it is as you would expect:
```R --version``` will give 4.3.2
```beast``` will throw java errors - but it is there

## Installations from the marketplace
You will not have pulled in any of your markletplace extensions so they need re-installing: warning every time the container is rebuilt they need to be re-installed so don't get too comfortable.






49 changes: 49 additions & 0 deletions dev_docs/dev_2_run_debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Run the application

Navigate 1 directory in then run the entry point:
```
cd pisca-box-run
streamlit run app/home.py
```

The application will pop up in [localhost 8501](http://localhost:8501/)

# Debug the application
https://stackoverflow.com/questions/60172282/how-to-run-debug-a-streamlit-application-from-an-ide
the answer here that starts "If you're a VS Code user,"
In summary, create a launch.json on the debugger (left side) in vscode.
Add to it this config below, navigate to the app/home.py page and choose to "run".
```
{
"version": "0.2.0",
"configurations": [
{
"name": "Python:Streamlit",
"type": "python",
"request": "launch",
"module": "streamlit",
"args": [
"run",
"${file}",
"--server.port",
"8501"
]
},
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
```
when on the page you want to run, select python:streannlit and press play.






39 changes: 39 additions & 0 deletions dev_docs/dev_3_build_application.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Containerised Deployment

Due to the complexity of the PISCA environment this project is designed to be deployed in a container.

## The application container
The develoment container has already been explained.
The application container uses the development container as a base to minimise time spent building containers and replicating envirnments.

The container image is defined in the `pisca-box-vue/Dockerfile` file.
It is fairly light and is mostly only an entry point into the copied code installation.

## Building the application container

This is **NOT FROM INSIDE THE DEVCONTAINER** you want to go back to your local folder (ctrl-sh-p "Reopen in local folder").

If you need to build and deploy the application container (you are probably in the ICR?) use the docker-compose.yml file.
This has the addition of the listening port, not necessary for manual running of the container, but necessary were it to be deployed on azure.

You can use docker commands, or you can have the docker extenstion installed.

On the file pisca-box-vue/docker-compose.yml right click and select "Compose Up"

This will build the image and run it.

## Test the image

You can test the image by running it locally.
```docker run --rm --name pisca-box -p 8002:8501 icrsc/pisca-box```
[localhost:8002](http://localhost:8002) should show the app.

## Push the image to docker hub

You can find the image in the docker dashboard.

Right-click and select push to upload to docker hub (you need access to be able to upload it to github).




11 changes: 11 additions & 0 deletions dev_docs/test_1_regression.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

# Regression Testing

### In the development container (but not the app)
Run the regression tests from pytests and the lint formatting:
```
pytest
ruff --format=github --select=E9,F63,F7,F82 --target-version=py37 .
ruff --format=github --target-version=py37 .
```

14 changes: 1 addition & 13 deletions testing.md → dev_docs/test_2_github.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# Testing Framework for pisca-box

### Correctness
The containerised app does not necessarily run on a workstation.

### Before checkin
from pisca-box$
```
ruff --format=github --select=E9,F63,F7,F82 --target-version=py37 .
ruff --format=github --target-version=py37 .
pytest
```

### Github Actions
### Github Actions will run automatically on checkin
- ruff is used as a linter and the tests created in tests directory are run when a push is made to github
- Ruff can be installed from VSCode MarketPlace and will automatically execute contiunuously
- The VSCode palette has Ruff: commands "quick fix" and "fix all" and "organize imports"
Expand Down
21 changes: 21 additions & 0 deletions dev_docs/test_3_acceptance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Acceptance testing of a version

**See below for what RUN CHECKS means**

1. RUN CHECKS on the proposed application locally as a docker container before pushing to docker hub or github main
2. Upload to docker hub and then RUN CHECKS on that docker image FROM ANOTHER MACHINE
3. Upload to the public webserver and then RUN CHECKS from a non ICR laptop or at least not inside the ICR and not on the VPN
4. RUN CHECKS from a mobile


RUN CHECKS means:
- The app is accessible
- The app is responsive
- The app runs
- beauti-box: test you can create a beauti xml file and download it
- pisca-box: test you can upload a beauti xml file and it is displayed
- tree-annotator: test you can annotate the previous trees file and download it
- plot-box: you can produce the plot from the above (or other files)
- The app is performant
- all the above is not too slow

26 changes: 0 additions & 26 deletions docker_pisca.md

This file was deleted.

File renamed without changes.
Binary file removed documentation/pisca-help-using-containers.docx
Binary file not shown.
Binary file removed documentation/pisca-help-using-containers.pdf
Binary file not shown.
Binary file removed examples/.DS_Store
Binary file not shown.
Loading

0 comments on commit ef910d7

Please sign in to comment.