{"id":25716202,"url":"https://github.com/haletran/42_cloud-1","last_synced_at":"2026-01-30T16:03:01.030Z","repository":{"id":275971964,"uuid":"927766954","full_name":"Haletran/42_Cloud-1","owner":"Haletran","description":"Deploy a fully functionnal Wordpress instance on the cloud using Docker and Ansible","archived":false,"fork":false,"pushed_at":"2025-02-10T11:43:01.000Z","size":53,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-05T05:46:27.433Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Makefile","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/Haletran.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,"zenodo":null}},"created_at":"2025-02-05T14:08:56.000Z","updated_at":"2025-03-06T22:21:41.000Z","dependencies_parsed_at":"2025-02-05T15:45:49.377Z","dependency_job_id":"9a04d444-2c66-4b88-b082-356aa373fd22","html_url":"https://github.com/Haletran/42_Cloud-1","commit_stats":null,"previous_names":["haletran/42_cloud-1"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Haletran/42_Cloud-1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haletran%2F42_Cloud-1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haletran%2F42_Cloud-1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haletran%2F42_Cloud-1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haletran%2F42_Cloud-1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Haletran","download_url":"https://codeload.github.com/Haletran/42_Cloud-1/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haletran%2F42_Cloud-1/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28914939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-02-25T14:51:47.362Z","updated_at":"2026-01-30T16:03:01.016Z","avatar_url":"https://github.com/Haletran.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 42_Cloud-1\n\n## TODO\n\n- [x] Need to replace Ansible yml file for container creations into a docker compose\n- [x] Setup TLS/https with duckdns domain\n- [x] Setup Caddy as proxy instead of raw port\n- [x] Setup .env generation and copy\n- [x] Add automatic way to connect to a server (ssh key generation)\n- [ ] Add custom user instead of root (like ansuser or else) and check if container already exist etc...\n- [ ] Add check for distro in installation docker to make this compatible with every server distro\n- [x] Make persistent data with volumes\n\n## Project\n\nThe VPS on `Vultr` is running on Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-42-generic x86_64) as required by the subject.\nThis VPS will be were the project will run, so the launch of everything can be done on the actual computer and\nthen it will be deployed on the VPS. \n\nBasically the goal of this project is to deploy a fully functionnal `Wordpress` instance on a `VPS` using `Docker` and `Ansible`.\n\n[Subject](https://cdn.intra.42.fr/pdf/pdf/147805/en.subject.pdf)\n\n\n\u003cdetails\u003e\n\u003csummary\u003eRequirements\u003c/summary\u003e\n\n### REQUIREMENTS\n\n- Install Docker and docker-compose\n```bash\nsudo apt install apt-transport-https ca-certificates curl software-properties-common\ncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -\nsudo add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable\"\nsudo apt install docker-ce docker-compose\n```\n\n- Install Ansible (Configuration Management tool) \n```bash\nsudo apt-add-repository ppa:ansible/ansible\nsudo apt update \u0026\u0026 sudo apt install ansible\n```\n\n`Ansible` use declarative push-based YAML code to automate the configuration of the server,\ncalled `Playbooks`.\n\n```yaml\n## basic example of an Ansible playbook that installs and starts the Nginx web server on a group of remote servers\n---\n- name: Install and start Nginx\n  hosts: web_servers\n  become: yes  # Run tasks with sudo\n\n  tasks:\n    - name: Install Nginx\n      apt:\n        name: nginx\n        state: present\n      when: ansible_os_family == \"Debian\"\n\n    - name: Install Nginx on RedHat-based systems\n      yum:\n        name: nginx\n        state: present\n      when: ansible_os_family == \"RedHat\"\n\n    - name: Start and enable Nginx\n      service:\n        name: nginx\n        state: started\n        enabled: yes\n```\n\n```bash\n# Run the playbook to install and start Nginx on the web_servers group\nansible-playbook deploy.yml\n\n# Run the playbook on a remote server\nansible-playbook ./src/playbook/deploy.yml -i ./src/inventory/hosts --user root --ask-pass --ask-become-pass\n\n# To connect to the remote servers and run commands\nansible -i src/inventory/hosts ubuntu -m ping --user root --ask-pass\n```\n\n\u003c/details\u003e\n\n### CONTAINERS\n\nThe Ansible playbook will deploy the following containers automatically:\n\n- `Wordpress` (CMS) \n- `MySQL` (Database) \n- `PHPMyAdmin` (Database Management) \n- `Caddy` (Web Server - it will setup the TLS/https)\n- `DuckDNS` (Dynamic DNS)\n- `Portainer` (Container Management)\n\n### To setup the ssh connection token\n\nGet the .pub token of your computer and add it to `known_hosts` file on your server. \n\nThen you should be able to connect to your server without password,\nthen for Ansible, add your private_key (of your computer) to the .cfg\nof Ansible in this field : \n\n```conf\n## in my case this\nprivate_key_file = ~/.ssh/id_rsa\n```\n\n### Setup .env\n\nFor .env, i'm using ansible-vault to encrypt the file and then decrypt it when needed.\nAnd I'm using jinja2 (env.j2) template to generate the .env file with the encrypted password.\n\n```bash\n# Encrypt the .env file\nansible-vault encrypt vault.yml\n# To edit it\nansible-vault edit vault.yml\n# To decrypt it\nansible-vault decrypt vault.yml\n```\n\nExample of the vault.yml file:\n\n```yaml\n# vault.yml\ndb_root_password: \"root\"\ndb_name: \"wordpress\"\n```\n\n\n## How to run the project \n\n```bash\n## launch the nix-shell\nNIXPKGS_ALLOW_UNFREE=1 nix-shell flake.nix\n```\n\n```bash\nmake all\n## or\nansible-playbook playbook/install_docker.yml #no need for other args since  everything is setup in ansible.cfg\nansible-playbook playbook/install_container.yml\n```\n\nAccess all the web services with the following links:\n\n- `Wordpress` : [wordpress.bapasqui-cloud1.duckdns.org](https://wordpress.bapasqui-cloud1.duckdns.org)\n- `PHPMyAdmin` : [phpmyadmin.bapasqui-cloud1.duckdns.org](https://phpmyadmin.bapasqui-cloud1.duckdns.org)\n- `Portainer` : [portainer.bapasqui-cloud1.duckdns.org](https://portainer.bapasqui-cloud1.duckdns.org)\n\n\n### Some ressource for the project\n\n- [Ansible tutorial: install Wordpress with Ansible playbook (video)](https://www.youtube.com/watch?v=Gxbj28ZoUbI)\n- [Automate your Docker deployments with Ansible (video)](https://www.youtube.com/watch?v=CQk9AOPh5pw)\n- [This web UI for Ansible is so damn useful!(video)](https://www.youtube.com/watch?v=Gxbj28ZoUbI)\n- [Things I wish I knew about Ansible from day 1(video](https://www.youtube.com/watch?v=Gxbj28ZoUbI)\n- [Automate EVERYTHING with Ansible! (Ansible for Beginners)(video](https://www.youtube.com/watch?v=Gxbj28ZoUbI)\n- [Ansible docker(docs of a video)](https://github.com/christianlempa/videos/tree/main/ansible-and-docker)\n- [Setup Caddy on docker](https://thriveread.com/caddy-reverse-proxy-server-docker-compose)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaletran%2F42_cloud-1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaletran%2F42_cloud-1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaletran%2F42_cloud-1/lists"}