- Table of Contents
- Team Members
- About the project
- PostgreSQL set up
- Running the app
- Deploying to production on Heroku
- Deploying the LIFF App
- Titouan Le Mao
- Cedric Le Mercier
- Urusha Rajkarnikar
- Htoo Lwin
TBD
Go to https://www.postgresql.org/download/ and follow the instructions for installing. By default, install on port 5432. In the components installation screen, make sure to tick “pgAdmin 4” to install the admin user interface for managing PostgreSQL.
- Create an admin user for database in pgAdmin 4
- By default, the application is configured with the following database admin credentials, either create a user in pgAdmin with these credentials or change application.properties configuration in
./src/main/resources/
Note: Windows users can experience an ‘authentication type 10 error’ during first time setup. Check the troubleshooting section for more information.
spring.datasource.username=admin
spring.datasource.password=admin
- Create a table for cocotrace in pgAdmin 4
- Create a database named cocotrace and set the newly created admin user as the Owner
In the terminal :
- sudo -u postgres createuser admin
- sudo -u postgres createdb cocotrace
- sudo -u postgres psql psql=# alter user admin with encrypted password 'admin';
- psql=# grant all privileges on database cocotrace to admin ;
- Don't forget to add the data in 'data.sql' file. Go on http://127.0.0.1:62467/browser/ and execute SQL queries in Query tool (right click on cocotrace database)
Run CocotraceApplication.java
as the main class. During the first run, it should create 6 tables within the cocotrace database and populate the tables with the queries contained in src/main/resources/data.sql.
Visit the application at http://localhost:8082
and login as an administrator with the default credentials
Username: administrator
Password: administrator
If it doesn’t work, there was possibly an error with the queries populating table. Check the troubleshooting section “Populate the tables with dummy data manually with pgAdmin 4”.
To deploy Spring Boot applications to heroku, follow this guide: https://devcenter.heroku.com/articles/deploying-spring-boot-apps-to-heroku
NOTE: When publishing the Spring Boot app on Heroku, there is no need to create a database as it will be created automatically
In some cases, the tables will be created empty and you will need to run the queries manually to add default and dummy data. Get the queries in the Troubleshooting section. To connect to Heroku database from CLI, login to Heroku via CLI and run:
heroku pg: psql
Then copy paste the SQL queries one by one. More info on Heroku PostgreSQL and CLI: https://devcenter.heroku.com/articles/heroku-postgresql#using-the-cli
Set up the environment variables for the app to work For only the webapp:
APP_URL
: Put your heroku app URL here (only used to create QR Codes links)DATABASE_URL
: The heroku database url, beginning with postgres://
For LINE Chatbot to work only (If creating your own Dialogflow and LINE chatbot):
-
CHANNEL_TOKEN
: Put the Chatbot MESSAGING API Line channel token here (necessitates a LINE Developer account and create a Chatbot using Messaging API) -
LIFF_URL
: The LIFF App URL (Check Deploying the LIFF App section).
Current url for the LIFF Application https://cocotrace-liff.herokuapp.com/
Note: Some functionalities are only available in LINE application, such as scanning QR code)
LINE Front-end Framework (LIFF) is a platform for web apps provided by LINE. The web apps running on this platform are called LIFF apps. The LIFF app is what allows the chatbot to access advanced features, such as scanning QR code or getting user profile information.
Clone the repository:
git clone https://github.com/cocostuff/cocotrace-liff
# then run to install dependencies
npm install
Follow the instructions on deploying node.js apps https://devcenter.heroku.com/articles/deploying-nodejs