The application consists of three "microservices". Each has a specific function:
- Frontend:a Nginx web server that serves Vue.js static files.
- Backend: a Node/Java/PHP application that handles API requests from the Frontend
- Database: a database instance for development (MySQL/GraphQL/...)
User <-> Browser <-> Client-side web app (FE) <-> HTTP <-> API (BE) <-> Routes <-> Controllers <-> Model <-> Database
During development, each service works a bit different.
- Frontend doesn't use nginx, but a Vue development server, so it is possible to live-edit the source code of frontend, and see changes hot-reloaded instantly in the browser.
- Backend uses pm2 process manager, which restarts node server each time source code changes.
- Database should be using volume for development purposes.
- Install Docker
- Run Docker Daemon
git clone https://github.com/andrejnano/pis-eshop.git
cd pis-eshop
cp .template.env .env
copy environment configuration file template to an actual config filemake dev
(build & run services/containers in a dev configuration)- Open frontend app in browser: http://localhost:3000
- Open backend app in browser: http://localhost:4000
Optionally:
make ps
to display running services (containers)make clean
to stop containers and remove imagesmake dev-build
to rebuild imagesmake help
to display usage help
- Docker must be running in the background on host OS
cd
to project dirgit pull
for new repo changesmake dev-build
to build imagesmake dev
to run services- Make changes to project source code
make log
to display logs from both services,make log-frontend
ormake log-backend
to display logs from a single service. Tip: open 2 terminal windows/tabs, in each show logs form a single service side by sideCTRL + c
to close log stream- When finished, use
make clean
to stop running services & remove images. - Stage & commit changes +
git push
- Vue tutorial: https://www.taniarascia.com/getting-started-with-vue/
- Install Vue Dev Tools
- Install Vetur VSCode extension
- Syntax-highlighting
- Snippet
- Emmet
- Linting / Error Checking
- Formatting
- Auto Completion
- Debugging
- Install ESLint
...