{"id":15081283,"url":"https://github.com/trolit/simple-stack-playground","last_synced_at":"2026-01-03T00:48:45.660Z","repository":{"id":243447017,"uuid":"802649289","full_name":"trolit/simple-stack-playground","owner":"trolit","description":"Simple stack playground to experiment with Ansible, K8S, Terraform, VMs and database providers. ","archived":false,"fork":false,"pushed_at":"2024-06-16T22:24:44.000Z","size":91,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T05:42:48.791Z","etag":null,"topics":["ansible","ansible-roles","javascript","k8s-at-home","nodejs","playground","playground-project","terraform","unix-systems","virtual-machine"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trolit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-18T21:55:52.000Z","updated_at":"2024-06-16T22:23:31.000Z","dependencies_parsed_at":"2024-06-16T23:28:42.353Z","dependency_job_id":null,"html_url":"https://github.com/trolit/simple-stack-playground","commit_stats":null,"previous_names":["trolit/simple-stack-playground"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trolit%2Fsimple-stack-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trolit%2Fsimple-stack-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trolit%2Fsimple-stack-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trolit%2Fsimple-stack-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trolit","download_url":"https://codeload.github.com/trolit/simple-stack-playground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918630,"owners_count":20368745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-roles","javascript","k8s-at-home","nodejs","playground","playground-project","terraform","unix-systems","virtual-machine"],"created_at":"2024-09-25T06:00:27.840Z","updated_at":"2026-01-03T00:48:45.630Z","avatar_url":"https://github.com/trolit.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Stack\n\n- Docker\n- Ansible\n- Terraform\n- Node.js, Vue, PostgreSQL, Prisma, Redis\n- K8S cluster ([setup with Docker Desktop](https://docs.docker.com/desktop/kubernetes/)), kubectl\n\n## Preview\n\n```\n          +-----------------+\n          |  K8S STATELESS  |\n          |    CLUSTER      |\n          |                 |\n+-----+       +--------+    |\n| WWW | \u003c---\u003e | CLIENT |    |\n+-----+       +--------+    |\n          |       ^         |\n          |       |         | +----------+\n          |       v         | |  REDIS   |\n          |   +-------+       +----------+\n          |   |  API  | \u003c---\u003e | POSTGRES |\n          |   +-------+       +----------+\n          |                 |\n          +-----------------+\n```\n\n## Running project\n\n1.  Check if `ssh` is installed (`ssh -V`)\n2.  Create VM/machine with Unix based OS. It should have `openssh-server` installed and configured ssh connection with your machine\n\n    \u003cdetails\u003e\n    \u003csummary\u003eHow to configure SSH connection?\u003c/summary\u003e\n       \n    1. Generate key named `id_cass` (in case of different name, reflect change in [ansible.cfg](./database/ansible.cfg))\n\n    ```sh\n    sh-keygen -t rsa -b 4096 -f ~/.ssh/id_cass\n    ```\n\n    2. Paste public key (`~/.ssh/id_cass.pub`) content to `~/.ssh/authorized_keys` on VM/machine\n\n    \u003c/details\u003e\n\n3.  Check if current [become-directives](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_privilege_escalation.html#become-directives) in [setup.yaml](./database/setup.yaml) match VM/machine OS.\n\n4.  Get host of VM/machine using e.g. `ip a` and define `/database/inventory`\n\n    ```sh\n    [postgres]\n    db1 ansible_host=192.168.0.7\n    ```\n\n    \u003e Use `ansible postgres -m ping` to test if host is reachable. Note that for ping you might have to specify destination user (`ansible_user`).\n\n5.  Setup infrastructure\n\n    \u003cdetails\u003e\n       \u003csummary\u003ewith script 🔥\u003c/summary\u003e\n\n    1. Run `quick-start.sh` script from root dir.\n\n    \u003c/details\u003e\n\n    \u003cdetails\u003e\n       \u003csummary\u003ewith step-by-step guide ⚙️\u003c/summary\u003e\n\n    1. Go to `/database` and execute [setup.yaml](./database/setup.yaml) playbook for PostgreSQL role\n\n    ```sh\n    ansible-playbook setup.yaml --extra-vars \"role=postgres\" -K\n    ```\n\n    2. Create `.env` files (x3) based on `.env.example`.\n\n    3. Modify `DATABASE_URL` and `SHADOW_DATABASE_URL` in `/api/.env` by replacing address (`127.0.0.1`) to the one that you've provided in `inventory`.\n\n    4. Go to root dir of project and build `client` and `api` images.\n\n       ```\n       npm run dc-build\n       ```\n\n    5. Go to [/infrastructure-as-code](./infrastructure-as-code/) and call:\n\n       ```sh\n       terraform apply\n       ```\n\n       \u003e 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\n\n    6. Run migrations by accessing `api`:\n\n       ```sh\n       # kubectl get pod\n       kubectl exec --stdin --tty \u003cPOD-NAME\u003e -- /bin/bash\n\n       npm run db:migrate:dev\n       ```\n\n    7. Access app at http://localhost:31000 or http://127.0.0.1:31000\n\n    8. Destroy stack using `terraform destroy`\n\n    \u003c/details\u003e\n\n\u003cbr/\u003e\n\n---\n\n- [Mikael Krief \"Learning DevOps - Second Edition\"](https://www.amazon.com/Learning-DevOps-comprehensive-accelerating-Kubernetes/dp/1801818967)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrolit%2Fsimple-stack-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrolit%2Fsimple-stack-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrolit%2Fsimple-stack-playground/lists"}