- 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
ssh
is installed (ssh -V
) -
Create VM/machine with Unix based OS. It should have
openssh-server
installed 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_keys
on 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 a
and define/database/inventory
[postgres] db1 ansible_host=192.168.0.7
Use
ansible postgres -m ping
to 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.sh
script from root dir.
with step-by-step guide ⚙️
- Go to
/database
and execute setup.yaml playbook for PostgreSQL role
ansible-playbook setup.yaml --extra-vars "role=postgres" -K
-
Create
.env
files (x3) based on.env.example
. -
Modify
DATABASE_URL
andSHADOW_DATABASE_URL
in/api/.env
by replacing address (127.0.0.1
) to the one that you've provided ininventory
. -
Go to root dir of project and build
client
andapi
images.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