The NeuroRecovery App assists post-stroke patients with their recovery through a web application
The NeuroRecovery app is tested and deployed with Tilt CI/CD.
This form of deployment requires some upfront cost. Once the environment is configured with a Kubernetes cluster and tilt up
is running though, the application will be automatically deployed in a consistent manner, and the developer receives immediate CI/CD feedback for any code changes.
By completing the below steps the environment will be ready to deploy the application on a Kubernetes cluster:
- Install Tilt CI/CD
- Start a Kubernetes cluster on your local machine such as K3s which provides a Load Balancer by default. If using K3s, you may have to change the
traefik-config.yaml
to allow usage of port 80, see Load Balance Rust for more details. - Install
kubectl
,helm
,podman
andbuildah
locally, on Fedora this would be:sudo dnf install kubernetes helm podman buildah
.- On other Linux distros(RHEL8, Ubuntu, etc.) view these links to install: Podman/Buildah install, Kubectl binary install, Helm binary install
- Deploy an image registry on the Kubernetes cluster, see setting up any Image Registry from Tilt, an example of deploying a registry from scratch. Ensure to apply cluster registry yaml file so Tilt identifies it.
- Clone the repo into the deployment server:
git clone git@github.com:mark-ruddy/neurorecovery.git
- For the
send_email
function to work in the backend, it requires AWS credentials to use Simple Email Service(SES) to send the emails to the meeting invitee and sender, you can get those creds by following the AWS docs - https://docs.aws.amazon.com/IAM/latest/UserGuide/security-creds.html - Add a
.env
file to thebackend
directory,touch backend/.env
, then add your tokens:
NEURORECOVERY_MONGODB_PASS=au5maduk55
AWS_ACCESS_KEY_ID=(hidden)
AWS_SECRET_ACCESS_KEY=(hidden)
- If
NEURORECOVERY_MONGODB_PASS
is changed to anything other thanau5maduk55
, then update it inTiltfile
too:os.putenv('NEURORECOVERY_MONGODB_PASS', 'au5maduk55')
. - If this is an internet-exposed deployment, then set the backend URL in the frontends
BackendService
, since the Angular JS will be delivered to the users browser it must query the internet-exposed backend URL:
// NOTE: In production this URL should be the host server address
public backendBaseUrl = 'http://neurorecovery-app.xyz:8080';
- Run
tilt up --host 0.0.0.0
and visitlocalhost:10350
, if the local dependencies are not installed, then there will be some failing tests - this is OK if the goal is to get the deployment up only. - Run
kubectl get all -n neurorecovery
andhelm ls -a -n neurorecovery
to view the deployed resources.
Once the resources have been compiled and built into container images to be deployed on the cluster, they will be available on the host node at:
- Frontend Server LoadBalancer: http://localhost:80
- Backend Server LoadBalancer: http://localhost:8080
- MongoDB ClusterIP: mongodb://10.43.252.173:27017
To connect to MongoDB by shell: mongo --host 10.43.252.173 -u root -p <YOUR_PASS>
For a production deployment some extra steps may be considered:
- Restricting CORS settings for the backend server to only accepting requests from the frontend server:
- Modify the
layer(CorsLayer::permissive())
line in thecreate_router()
function inmain.rs
of the backend code.
- Modify the
pandoc report_neurorecovery.md -o dist/report_neurorecovery.docx
- Manually add first page from template in libreoffice
- Export as pdf to
dist/report_neurorecovery.pdf
- this is report generated