- Docker
- Ansible
- Terraform
- Node.js, Vue, PostgreSQL, Prisma, Redis
- K8S cluster (setup with Docker Desktop), kubectl
+-----------------+
| K8S STATELESS |
| CLUSTER |
| |
+-----+ +--------+ |
| WWW | <---> | CLIENT | |
+-----+ +--------+ |
| ^ |
| | | +----------+
| v | | REDIS |
| +-------+ +----------+
| | API | <---> | POSTGRES |
| +-------+ +----------+
| |
+-----------------+
-
Check if
sshis installed (ssh -V) -
Create VM/machine with Unix based OS. It should have
openssh-serverinstalled and configured ssh connection with your machineHow to configure SSH connection?
- Generate key named
id_cass(in case of different name, reflect change in ansible.cfg)
sh-keygen -t rsa -b 4096 -f ~/.ssh/id_cass- Paste public key (
~/.ssh/id_cass.pub) content to~/.ssh/authorized_keyson VM/machine
- Generate key named
-
Check if current become-directives in setup.yaml match VM/machine OS.
-
Get host of VM/machine using e.g.
ip aand define/database/inventory[postgres] db1 ansible_host=192.168.0.7
Use
ansible postgres -m pingto test if host is reachable. Note that for ping you might have to specify destination user (ansible_user). -
Setup infrastructure
with script 🔥
- Run
quick-start.shscript from root dir.
with step-by-step guide ⚙️
- Go to
/databaseand execute setup.yaml playbook for PostgreSQL role
ansible-playbook setup.yaml --extra-vars "role=postgres" -K-
Create
.envfiles (x3) based on.env.example. -
Modify
DATABASE_URLandSHADOW_DATABASE_URLin/api/.envby replacing address (127.0.0.1) to the one that you've provided ininventory. -
Go to root dir of project and build
clientandapiimages.npm run dc-build -
Go to /infrastructure-as-code and call:
terraform apply
If creating client service fails and you don't want to wait until K8S tries to resurrect it again, re-run it manually after few seconds
-
Run migrations by accessing
api:# kubectl get pod kubectl exec --stdin --tty <POD-NAME> -- /bin/bash npm run db:migrate:dev
-
Access app at http://localhost:31000 or http://127.0.0.1:31000
-
Destroy stack using
terraform destroy
- Run