Mentality is a booking enterprise solution where patients can book consultations with the therapists at our therapy booking web application. It is an online website that easily and conveniently connects people with our therapists based on their needs, with our doctors’ details such as specialisations and fees explicitly stated on the website.
The solution consists of 6 microservices - Patient, Doctor, Notification, Appointment, Consultation, Payment Payment Microservice uses Stripe External API and Notification Microservice uses Twilio External API.
-
Ensure you WAMP is running
-
Connect your WAMP to the ESD-ClinicAppointmentServices folder by creating an alias
-
The following microservices (doctor, patient, appointment, consultation, payment) are running on cloud, hence there is no need to run it individually.
-
However, you may also choose to run it locally, but do take note that you are require to run the micro-services on your system.
-
If you choose to run locally the micro-services, they can be found at the following sub-folder.
Doctor: ESD-ClinicAppointmentServices\docker\doctor Patient: ESD-ClinicAppointmentServices\docker\patient Appointment: ESD-ClinicAppointmentServices\docker\appointment Consultation: ESD-ClinicAppointmentServices\docker\consultation Payment: ESD-ClinicAppointmentServices\docker\payment Notification: ESD-ClinicAppointmentServices\docker\notification
-
Then, go to C:\wamp64\www\ESD-ClinicAppointmentServices\app\ui\include\codeLinks.php, comment line 31-35 and uncomment line 37-41 to switch to localhost ip.
-
-
The database is also running on cloud, hence there is no need to import the database. (However, should you want to look into the database structure, you may look at the ESD-ClinicAppointmentServices/sql folder)
-
To access the web application you may go to the following link
- Mentality Landing Page: localhost:80/ESD-ClinicAppointmentServices/app/ui/landing
- Mentality Landing Page: localhost:80/ESD-ClinicAppointmentServices/app/ui/landing/index.php
- Mentality Patient Portal: localhost:80/ESD-ClinicAppointmentServices/app/ui
- Mentality Doctor Portal: localhost:80/ESD-ClinicAppointmentServices/app/ui/doctor/doctorLogin.php
-
To access our online RDS database through phpmyadmin, follow these steps
-
Navigate to config.inc file. It is normally in this location: C:\wamp64\apps\phpmyadmin4.8.3\config.inc.php
-
Insert the following code at the very bottom, one line before ?>
$i++; $cfg['Servers'][$i]['verbose'] = 'ESD'; $cfg['Servers'][$i]['host'] = 'esd.cemjatk2jkn2.ap-southeast-1.rds.amazonaws.com'; $cfg['Servers'][$i]['port'] = '3306'; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['extension'] = 'mysql'; $cfg['Servers'][$i]['compress'] = TRUE; $cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'admin'; $cfg['Servers'][$i]['password'] = 'IloveESMandPaul!<3';
-
Select ESD(admin) as the server choice. Username: root password: (leave it empty)
-
Login. The tables are in ESD, namely esd_appointment, esd_consultation, esd_doctor, esd_notification, esd_patient, esd_payment
-
-
Alternatively, you can login using these account details
- Patient - Username: sophieng Password: sn1
- Patient - Username: zoeytan Password: zt1
- Doctor - Username: johnsmith Password: js1
- Doctor - Username: rosafernandez Password: rf1
You can now access our web application :)
Note: We have deployed all our microservice on AWS ECS and used Cloud RabbitMQ for messaging. Should you want to implement it on your own, you may refer to the guide below.
-
Go to cloudamqp.com
-
Create an account and sign in
-
Click “Create Instance” button
-
Put ESD for instance name. Leave the plan as “Little Lemur (Free)”
-
Click select region
-
Select AP-Southeast-2(Sydney) for Data Center and click review
-
Click create instance
-
Click on the created instance
-
Copy the AMQP url
-
Put the below command in all the microservices that need to connect to this cloud AMQP. The rest of the code will be the standard rabbitMQ code.
url = <Insert your AMQP url here> params = pika.URLParameters(url) connection = pika.BlockingConnection(params)
-
Open command prompt
-
Run these commands:
pip install awscli
-
Allow root access to awscli by running these commands:
aws configureAWS Access Key ID [************]: <Removed for confidentiality> AWS Secret Access Key [************]: <Removed for confidentiality> Default region name [ap-southeast-1]: ap-southeast-1 Default output format [json]: json
-
Build docker images by running: (Note that you need to change the path to the current location of all the microservices). You will also need to delete any existing images (NOT repositories) manually first in AWS before pushing
cd C:\wamp64\www\ESD-ClinicAppointmentServices\docker\dockerfiles\patient docker build -t g6t8/patient . cd C:\wamp64\www\ESD-ClinicAppointmentServices\docker\dockerfiles\doctor docker build -t g6t8/doctor . cd C:\wamp64\www\ESD-ClinicAppointmentServices\docker\dockerfiles\appointment docker build -t g6t8/appointment . cd C:\wamp64\www\ESD-ClinicAppointmentServices\docker\dockerfiles\consultation docker build -t g6t8/consultation . cd C:\wamp64\www\ESD-ClinicAppointmentServices\docker\dockerfiles\payment docker build -t g6t8/payment . cd C:\wamp64\www\ESD-ClinicAppointmentServices\docker\dockerfiles\notification docker build -t g6t8/notification . cd C:\wamp64\www\ESD-ClinicAppointmentServices\docker\dockerfiles\patient docker build -t g6t8/patient_amqp . cd C:\wamp64\www\ESD-ClinicAppointmentServices\docker\dockerfiles\notification docker build -t g6t8/notification_reply .
-
Go to AWS account => ECS service => Repositories (On the left side)
-
Click create repository => Name it as g6t8/patient
-
Repeat previous step for the 7 other microservices: g6t8/doctor, g6t8/appointment, g6t8/consultation, g6t8/notification, g6t8/payment, g6t8/patient_amqp, g6t8/notification_reply.
-
Click on patient repository => View push command
-
Copy the code in Step 1 and run it to authenticate your Docker client to your registry. It should be something like
aws ecr get-login-password --region ap-southeast-1 | docker login --username AWS --password-stdin <Removed for confidentiality>
-
Run the commands in Step 3 and 4 to push the docker images to this repository. It should be something like docker tag g6t8/patient:latest and docker push …. /g6t8/patient:latest
-
Repeat previous step for the 5 other microservices. Below are the commands that we used for reference:
docker tag g6t8/patient:latest 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/patient:latest docker push 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/patient:latest docker tag g6t8/doctor:latest 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/doctor:latest docker push 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/doctor:latest docker tag g6t8/appointment:latest 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/appointment:latest docker push 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/appointment:latest docker tag g6t8/consultation:latest 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/consultation:latest docker push 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/consultation:latest docker tag g6t8/notification:latest 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/notification:latest docker push 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/notification:latest docker tag g6t8/payment:latest 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/payment:latest docker push 603184320246.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/payment:latest docker tag g6t8/patient_amqp:latest 558294856729.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/patient_amqp:latest docker push 558294856729.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/patient_amqp:latest docker tag g6t8/notification_reply:latest 558294856729.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/notification_reply:latest docker push 558294856729.dkr.ecr.ap-southeast-1.amazonaws.com/g6t8/notification_reply:latest
-
Go back to AWS ECS => repositories (On the left navigation bar) Click on each of the 6 repositories and ensure all the images are pushed into their respective repo.
-
Copy the URI of g6t8/patient repository. Note that it is the repo URI, NOT the images URI (Should not have :latest behind)
-
Click on Clusters on the left navigation bar. Click “Get Started”
-
Click the “Configure” button under custom
-
Put “patient” for container name.
-
Paste the URI for g6t8/patient repo you have copied earlier into the image box
-
Change the port mapping to 80 tcp18. Click update => Next.
-
Do NOT change the load balancer type, leave it as none. Click Next again.
-
Put “patient” for the cluster name and click Next
-
Review your settings and click create.
-
Wait for your cluster to finish creating. (All green ticks)
-
Click on your created cluster. (Alternatively, click on Clusters on the left navigation bar => click on Patient)
-
Click on tasks. There should be 1 task running. Click on its task id (beside the task definition)
-
Click on the ENI id.
-
Scroll to the right until you see the Security groups column. Click on it.
-
Click on the security group ID
-
Click edit inbound rules
-
Click add rule. Change the type to all traffic and source to anywhere. Click save rules
-
Go back to the task page for the patient cluster (Should be in another tab if you have not closed it yet)
-
Copy the public IP. This will be the IP you use to connect to this patient microservice.
-
Repeat step 14 to 31 for all the other 7 repositories (each for 1 microservice)
- Version 1.0