{"id":13753257,"url":"https://github.com/kbariotis/ansible-nodejs-digitalocean","last_synced_at":"2025-04-27T04:32:20.724Z","repository":{"id":14148295,"uuid":"76106921","full_name":"kbariotis/ansible-nodejs-digitalocean","owner":"kbariotis","description":"Complete playbook to create and deploy a Node.js application on Digital Ocean.","archived":false,"fork":false,"pushed_at":"2022-04-08T14:17:25.000Z","size":24,"stargazers_count":76,"open_issues_count":2,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-03T09:05:07.919Z","etag":null,"topics":["ansible","ansible-playbook","digital-ocean","nodejs"],"latest_commit_sha":null,"homepage":"https://kbariotis.github.io/ansible-nodejs-digitalocean/","language":"Jinja","has_issues":true,"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/kbariotis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-10T10:53:58.000Z","updated_at":"2024-07-17T11:01:18.000Z","dependencies_parsed_at":"2022-08-07T07:16:22.936Z","dependency_job_id":null,"html_url":"https://github.com/kbariotis/ansible-nodejs-digitalocean","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/kbariotis%2Fansible-nodejs-digitalocean","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbariotis%2Fansible-nodejs-digitalocean/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbariotis%2Fansible-nodejs-digitalocean/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbariotis%2Fansible-nodejs-digitalocean/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kbariotis","download_url":"https://codeload.github.com/kbariotis/ansible-nodejs-digitalocean/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224059084,"owners_count":17248743,"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-playbook","digital-ocean","nodejs"],"created_at":"2024-08-03T09:01:19.200Z","updated_at":"2024-11-11T06:28:02.750Z","avatar_url":"https://github.com/kbariotis.png","language":"Jinja","readme":"# Node.js on DigitalOcean with Ansible\n\u003e Complete playbook to create and deploy a Node.js application on Digital Ocean.\n\n## Intro\nThis project created to be the one and only destination to bootstrap new projects on [DigitalOcean](digitalocean.com) \nusing [Ansible](https://www.ansible.com/).\n\nI wanted to:\n* Automate build and configuration of a droplet\n* Automate deployments of my project\n\nTo start using this repo, you need a DigitalOcean account, \na [DigitalOcean API key](https://cloud.digitalocean.com/settings/applications), a domain name and a\n[Papertrail](https://papertrailapp.com) account along with its [API key](https://papertrailapp.com/account/profile).\n\nMany thanks to https://github.com/yoshz/ansible-digitalocean cause I took a lot of his code.\n\n## What's inside\nThis script will:\n\n* Generate an SSH key on the local machine if it doesn't exist\n* Create a droplet with the SSH key\n* Add a domain and point it to the droplet\n* Add swapfile to droplet\n* Add a new root-user to the droplet and enable sudo\n* Secure with ufw and restrict SSH to pub-key access only\n* Setup Papertrail logging\n* Add nginx as a reverse proxy\n* Request a certificate from LetsEncrypt\n\n## How to use it\nYou need Ansible to start with this project. [So go get it](https://spacelift.io/blog/ansible-tutorial)!\n\n* Clone this repo\n* Edit `defaults/vars.yml`\n* Edit `tasks/project.yml` and add your own rules\n\nMake sure to add the `launch` and `deploy` tags (or any other you need) to your own tasks.\n\nThen run:\n\n`ansible-playbook main.yml --tags=launch` to launch the server\n\n## Commands\n\n`ansible-playbook main.yml` or `ansible-playbook main.yml --tags=launch`\n\nfor the initial setup. Make sure that you've obtained your domain and already pointed \nto [DigitalOcean's nameservers](https://www.digitalocean.com/community/tutorials/how-to-point-to-digitalocean-nameservers-from-common-domain-registrars). \nIt's better to wait a few hours for the changes to be propagated.\n\n`ansible-playbook main.yml --tags=deploy` \n\nto deploy your app. Make sure to add the apropriate tags in \n[tasks/project.yml] (https://github.com/kbariotis/ansible-nodejs-digitalocean/blob/master/tasks/project.yml) \nwhen adding your custom tasks.\n\n`ansible-playbook main.yml --tags=certificate` \n\nto renew the certificate.\n\n## Internals\nThe main entrypoint is the [main.yml](https://github.com/kbariotis/ansible-nodejs-digitalocean/blob/master/main.yml) \nfile. The playbook is divided in three plays one \nfor the DigitalOcean configuration, one for the server initial configuration which runs as \nroot user and the third for the specific project configuration.\n\nThe [tasks](https://github.com/kbariotis/ansible-nodejs-digitalocean/blob/master/tasks)\nfolder contains all tasks required by the playbook. Its file is named \nafter its concern so it's easy to spot where something is happening.\n\nYou can place your project's specific files at the [files](https://github.com/kbariotis/ansible-nodejs-digitalocean/blob/master/files) \nfolder.\n\nTweak the project using the [defaults/vars.yml](https://github.com/kbariotis/ansible-nodejs-digitalocean/blob/master/defaults/vars.yml) \nfile. All of the values there are required, so make sure that are valid and cover your needs.\n\nThe main file you need to edit is the [tasks/project.yml](https://github.com/kbariotis/ansible-nodejs-digitalocean/blob/master/tasks/project.yml).\nThis file is called after the server is up and running. The example file will:\n\n* Pull your repo (http://docs.ansible.com/ansible/git_module.html) only if it has changes to pull\n* install local dependecies (http://docs.ansible.com/ansible/npm_module.html)\n* install global dependecies like `webpack` and `pm2`\n* build your repo using `webpack`\n* start it using `pm2`\n\n## Contribute\nPlease, do contribute by [opening an issue](https://github.com/kbariotis/ansible-nodejs-digitalocean/issue) \nor creating a Pull Request.\n\n## License\n[MIT](https://github.com/kbariotis/ansible-nodejs-digitalocean/blob/master/LICENSE.md)\n","funding_links":[],"categories":["nodejs"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkbariotis%2Fansible-nodejs-digitalocean","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkbariotis%2Fansible-nodejs-digitalocean","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkbariotis%2Fansible-nodejs-digitalocean/lists"}