thingaha-web is a web application to make life easier for thingaha donation group monthly donation data tracking and workflows.
For project background and current goals for v1.0, please read the Wiki Home Page.
Setup docker containers
backend
directory and run docker-compose up
. (Note: all the following commands assume we're in backend
directory as working directory)backend_web_1
container and backend_db_1
containers.docker ps
command for 2 containers.docker exec backend_web_1 /usr/bin/python3 ../src/db_seed.py
http://localhost:5000/api/v1/users
and should see a json error message.For backend developers, who want to use docker for backend development, please refer to the following commands:
requirements.txt
, we will need to rebuild the containers. To rebuild containers, we use:
docker-compose build
command.Troubleshooting with docker FAQ
backend
directory and run docker-compose up
if you haven't already.docker-compose stop web
to stop the web container to make sure there is no connection to the db.docker-compose exec db /bin/bash
to get into the shell of db container.dropdb -U thingaha thingaha_dev
(Using default username thingaha and password thingaha here. Replace with your credentials if you happen to have overriden it.)createdb -U thingaha thingaha_dev
(Using default username thingaha and password thingaha here. Replace with your credentials if you happen to have overriden it.)exit
command and restart currently running docker-compose up
.docker-compose exec web /usr/bin/python3 ../src/db_seed.py
thingaha_dev
(You can give any name you want but you need to update the configuration files in backend/conf
directory if you use a different database name.)backend/conf/config_dev.yaml
and backend/conf/conf_test.yaml
files with the credentials you used to install the database.conda create -n <envname>
conda activate <envname>
pip install -r ~/thingaha/backend/requirements.txt
create table and insert data to table
for linux, macOS -> go backend/bin and run -> ./db_migrate.sh
for windows -> go to backend\bin and run -> db_migrate.bat
#memo
postgres url be like [DB_TYPE]+[DB_CONNECTOR]://[USERNAME]:[PASSWORD]@[HOST]:[PORT]/[DB_NAME]
for linux, macOS -> go backend/bin and run -> ./db_seed.sh
for windows -> go to backend\bin and run -> db_seed.bat
#memo
Put all testing data to DB
for linux, macOS -> go backend/bin and run -> ./start_app.sh
for windows -> go to backend\bin and run -> start_app.bat
- Default server port is 5000:
- All API required JWT token for access data
- Get the access token from login.
-- init user_email: moemoe@gmail.com
-- init user_pass: 123
-- login URL : =>
-- [POST] http://localhost:5000/api/v1/login
- API docs can be found in https://github.com/thingaha/thingaha-web/tree/master/backend/docs
for linux, macOS -> go backend/bin and run -> ./start_test.sh
for windows -> go to backend\bin and run -> start_test.bat
This project was bootstrapped with Create React App.
Main UI framework is Material UI. For component styling, styled-components is used.
Then set up the frontend app.
To set up frontend dev server, cd
into the frontend
directory and install necessary node modules by running yarn install
.
To set up for connection with backend server
copy env file (frontend\src\.env.example
) and rename to (frontend\src\.env.local
)
Then, run yarn start
To set up for windows developmemt, please update frontend\package.json
"start": "PORT=5001 react-scripts start"
to "start": "set PORT=5001 && react-scripts start"
The frontend dev server is configured to run on port 5001
. Try navigating to http://localhost:5001/ to see the app in action.
initial login information
username: moemoe@gmail.com
password: 123
Check your local language in terminal
locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
~/.profile
or ~/.zshrc
file for it to correctly export your
locale settings upon initiating a new session.export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
locale -a
or locale
in terminal again. brew services list
brew services restart postgresql@12
test db
by using the following command.CREATE DATABASE db_test WITH TEMPLATE = templateUTF_8 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = '
en_US.UTF-8';
CREATE DATABASE thingaha_dev
WITH OWNER = XXXX
TEMPLATE = templateUTF_8
ENCODING = 'UTF8'
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;
db_migrate
and db_seed
again