next.js, nginx, reverse-proxy, ssl
$ sudo apt-get update
$ sudo apt-get install nginx letsencryptSample config files to demonstrate seup that creates and updates free SSL certificates from Let's Encrypt given that the domains are maintained at CloudFlare service.
Certbot verifies domains ownership by accessing CloudFlare API that adds temporary TXT DNS records. To enable it You must provide your CloudFlare API token. More details in documentation for dns-cloudflare Certbot plugin.
Certbot saves created certificates in Docker volume certbot_etc. Pay attention to output of the certbot run - it mentions path to the created certificates.
| version: "3.9" | |
| services: | |
| grafana: | |
| image: grafana/grafana | |
| ports: | |
| - 3000:3000 | |
| prometheus: | |
| image: prom/prometheus | |
| ports: |
| # run a kubernetes cluster in local VM using vagrant + k3s | |
| # require: Virtualbox, vagrant | |
| # steps: | |
| # * in the folder contain this `Vagrantfile`, run `vagrant up` and wait a bit for provisioning. | |
| # Once done, `vagrant ssh master` into the node and start using the k8s cluster, | |
| # such as `kubectl get nodes`, `kubectl get pods -A`, `kubectl get componentstatus`, | |
| # or `kubectl run busybox --image=busybox:1.28 --rm --restart=Never -it -- nslookup kubernetes` | |
| # * To clean up, logout these nodes, then run `vagrant destroy` to destroy the VMs. | |
| # - next time run `vagrant up` again to provision again | |
| # - or run `vagrant halt` to halt these VMs, and bring them back to the same state |
| - hosts: all | |
| become: yes | |
| gather_facts: false | |
| vars: | |
| tasks: | |
| - name: Check that the /etc/docker/daemon.json exists | |
| stat: | |
| path: /etc/docker/daemon.json | |
| register: stat_result |
| <!-- MAKE SURE TO ADD DATABASE DEPENDENCY IN POM.XML --> | |
| # H2 | |
| spring.datasource.url=jdbc:h2:file:C:/temp/test | |
| spring.datasource.username=sa | |
| spring.datasource.password= | |
| spring.datasource.driverClassName=org.h2.Driver | |
| spring.jpa.database-platform=org.hibernate.dialect.H2Dialect | |
| # MySQL |
| --- | |
| - name: install and start jenkins | |
| hosts: web | |
| become: yes | |
| tasks: | |
| - name: add redhat-stable jenkins repo | |
| ansible.builtin.get_url: | |
| url: https://pkg.jenkins.io/redhat-stable/jenkins.repo | |
| dest: /etc/yum.repos.d/jenkins.repo |
| Vagrant.configure("2") do |config| | |
| config.vm.box = "ubuntu/xenial64" | |
| config.vm.define "ubuntu_minikube" do |ubuntu_minikube| | |
| config.vm.network "forwarded_port", | |
| guest: 8001, | |
| host: 8001, | |
| auto_correct: true | |
| # Tutorial: https://blog.creekorful.com/2020/01/how-to-expose-traefik-2-dashboard-securely-docker-swarm/ | |
| version: '3' | |
| services: | |
| reverse-proxy: | |
| image: traefik:2.3 | |
| command: | |
| # - '--log.level=DEBUG' | |
| - '--api=true' | |
| - '--api.dashboard=true' |
| version: '3' | |
| services: | |
| traefik: | |
| container_name: traefik | |
| image: traefik:v2.0 | |
| command: | |
| - "--api.insecure=true" | |
| - "--providers.docker=true" |