{"id":21409864,"url":"https://github.com/stackbuilders/nano-chat-ansible","last_synced_at":"2026-01-02T17:49:16.344Z","repository":{"id":139306674,"uuid":"141329191","full_name":"stackbuilders/nano-chat-ansible","owner":"stackbuilders","description":"Nano Chat - Ansible","archived":false,"fork":false,"pushed_at":"2018-08-03T17:18:58.000Z","size":7624,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-23T04:32:39.732Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackbuilders.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-07-17T18:37:04.000Z","updated_at":"2022-02-06T02:19:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec9a9c73-03ee-425c-bf1b-dc0247f4d863","html_url":"https://github.com/stackbuilders/nano-chat-ansible","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fnano-chat-ansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fnano-chat-ansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fnano-chat-ansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbuilders%2Fnano-chat-ansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackbuilders","download_url":"https://codeload.github.com/stackbuilders/nano-chat-ansible/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910690,"owners_count":20367538,"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":[],"created_at":"2024-11-22T17:34:46.655Z","updated_at":"2026-01-02T17:49:16.307Z","avatar_url":"https://github.com/stackbuilders.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"![Stack Builders](https://github.com/stackbuilders/nano-chat/raw/master/sb.png)\n\n# Ansible provisioning\n\n## Set up your SSH keys\n\nVerify that your private and public key are located in the default directory `~/.ssh`.\nThe public key is used by Vagrant to establish the connection between your machine and the virtual machine.\n\nIf you don't have a SSH key you can read [how to generate one](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/).\n\nYou can check out the configuration on the \"General Vagrant VM configuration.\" section of the [Vagrantfile](Vagrantfile).\n\n## Getting started with Vagrant\n\nClone the repository:\n\n```bash\ngit clone https://github.com/stackbuilders/nano-chat-ansible.git\n```\n\nDownload the VM images and create two guest machines, one in 192.168.1.10 and the other in 192.168.1.20.\n\n```bash\nvagrant up\n```\n\nCheck if everything is working fine in vagrant\n\n```bash\nvagrant status\n```\n\nLogin to *webserver* machine\n\n```bash\nvagrant ssh webserver\n```\n\nCheck if SSH works properly\n\n```bash\nssh vagrant@192.168.1.10\n```\n\nYou have your servers up and running but with no apps.\n\n## Provisioning with Ansible\n\n### Install requirements on target server\n\n1. Verify connection through Ansible\n\n    ```bash\n    ansible -m ping all\n    ```\n\n    When you receive a pong request, it means that Ansible can connect with the remote servers.\n\n1. Install galaxy requirements\n\n1. Add your database server to the `hosts` file.\n\n1. Add the following apps to the `default-apps` role\n    - htop\n    - tree  \n    - net-tools\n    - vim\n    - ufw\n    - make\n\n1. Open the ports 80 and 443 on the `networking` role.\n\n1. Add `default-apps` and `networking` roles to **webserver playbook**\n\n1. Run the playbook\n\n    ```bash\n    ansible-playbook playbooks/webserver_playbook.yml\n    ```\n\n### Prepare a deployment\n\n1. Clone the Node.js app repository on the `deploy-app` role:\n\n    ```\n    https://github.com/stackbuilders/nano-chat.git\n    ```\n    Make sure the destination of the application is the `node_app_location` directory.\n\n1. Start the Node.js application on the `deploy-app` role by executing:\n\n    ```\n    make start -C {{ node_app_location }}\n    ```\n1. Run the playbook\n\n    ```bash\n    ansible-playbook playbooks/deploy_playbook.yml\n    ```\n\n    Your app is now provisioned. Test it on [http://192.168.1.10](http://192.168.1.10)\n\n    ![Deployed](meme.gif)\n\n### Using a database\n\n1. Run the database playbook to provision the database server.\n\n    ```bash\n    ansible-playbook playbooks/database_playbook.yml\n    ```\n\n1. Install `sequelize-cli` node module on the `deploy-app` role\n\n1. Run Sequelize commands on the `{{ node_app_location }}/backend` directory:\n\n    ```bash\n    sequelize db:migrate\n    sequelize db:seed:all\n    ```\n\n1. Define a environment variable `DB_CONN_NANOCHAT` with value of `postgresql://postgres@192.168.1.20:5432/nanochat` **deploy playbook**\n\n1. Test the application's endpoint to retrieve some data from database on [http://192.168.1.10/api/users](http://192.168.1.10/api/users)\n\n## License\n\nMIT, see the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackbuilders%2Fnano-chat-ansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackbuilders%2Fnano-chat-ansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackbuilders%2Fnano-chat-ansible/lists"}