Repository navigation
Getting Started & Developer Essentials
- Make
- Go Programming Language
- Migrate Cli
- Psql Db
- Yarn package manager
- Docker
sudo apt-get install build-essential
- Update the system and install some required dependencies
sudo apt update
sudo apt upgrade
sudo apt install wget software-properties-common apt-transport-https
- Access
https://go.dev/dl/to get the latest go pacakge. Extract the package and install it in /usr/local/
wget https://golang.org/dl/go1.21.6.linux-386.tar.gz
sudo tar -zxvf go1.21.6.linux-386.tar.gz -C /usr/local/
- Load the config to /etc/profile.d/go.sh and source it. Verify that you have the go config variables in path with quick check
go version.
echo "export PATH=/usr/local/go/bin:${PATH}" | sudo tee /etc/profile.d/go.sh
source /etc/profile.d/go.sh
go version
Required for versioning of db scripts
Note: Applications built with releases can be checked out to download relative binaries. You have to download the source code, build it and move it to the appropriate location. You can also use other toolchains to do such.
https://github.com/golang-migrate/migrate/releases
- Retrieve the migrate file from the repository
curl -s https://packagecloud.io/install/repositories/golang-migrate/migrate/script.deb.sh | sudo bash
- Update your machine
sudo apt-get update
- Install the selected package
sudo apt-get install -y migrate
How to use the migrate application package. https://github.com/golang-migrate/migrate/blob/master/cmd/migrate/README.md
Install postgresql as it is the database system
sudo apt-get install postgresql postgresql-contrib
-
If you get error
Error: No cluster specified with $PGCLUSTERthen you can just simply remove the PGCLUSTER withunset PGCLUSTERas we are not using that -
If you are setting up the psql for the first time, the role
postgresmight not exist. The role you setup your computer would be inherited. To overwrite this, you can usesudo -i -u postgresandpsqlinto your instance. Please note thatyou would have to do this every time. Instead you can opt tocreate a rolefor your user. This step is not documented since its not required to start the application.
Yarn package manager is used to build and deploy the frontend of the application.
- Install yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
- For a first time run, you need to install
vite. Navigate to the folder withcd /frontendand run commandyarn. You can also use the commandmake runClient.
Installing docker steps is located in docker essentials
- Run script in
main.shfor dev mode. To deploy run script inmainDeploy.sh. - For
dev modeaftermain.shcommands, open a new terminal and runmake startserver. Your backend should start up. - For
dev modeafter step 2, for first time install, runmake runClientor navigate tofrontenddirectory and runyarndepending on what you have setup. - For
dev modeif not first time, runmake startclientfrom root. UI should start up.
- Vs Code uses launch.json file to process debugging. Use the provided
launch.jsonfile. - Copy the contents into
.vscodefolder in the root of the project. - To use
postmanor other tools to access the secure routes, you need theauthorization2header. Sign in with the signIn url. The response header will containauthorization2header. Use thisauthorization2header in subsequent requests to login and execute api calls. The token does not get stored intocookie.
- Run command
ip addr show eth0 | grep -oP 'inet \K[\d.]+'. Ensure your docker container is up and running. This provides you with the IP Address. - Connection properties can be viewed from
docker pshowever default connection isPORT:8089. - Username is
postgresand password ishome.
- For
dev modeto access db, rundocker psto view container name. Then rundocker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_name>to retrieve IP address of container. - Follow steps 2 and 3 above.
- For
dev modeuse that container ip address to connect with your db tool.