teleren/devto huggingface dataset:
SSL para SaaS com multiplos domínios usando Docker e Caddy
Tags: security, saas, docker, webdev
Published: 2023-06-26 18:31:09

**Precisa fornecer automaticamente certificados SSL para os usuários do seu SaaS** (Software as a Service)? Pode parecer uma tarefa difícil à medida que você expande a quantidade de domínios. A boa notícia é que há uma solução viável e simples chamada **Caddy**.

Claro que existem várias soluções pagas disponíveis no mercado, tipo **[SSL para SaaS da Cloudflare](https://www.cloudflare.com/pt-br/ssl-for-saas-providers/)**, que simplificam o processo. Só que os preços são salgados, especialmente para empresas que estão começando e ainda não podem fazer esse investimento.

Depois de uma boa pesquisa e testes, descobri o Caddy, que oferece https on_demand, com validação de domínio. 

Vou te mostrar como implementei essa configuração usando Docker e Docker-compose.

Considerando um docker-compose com a aplicação principal e um container caddy. No container caddy, temos 3 volumes mapeados: "caddydata", "caddycfg" e o Caddyfile (próximo parágrafo).

```
version: '3'

services:
  caddy:
    image: caddy:latest
    restart: always
    ports:
      - '80:80'
      - '443:443'
      - '443:443/udp'
    volumes:
      - caddydata:/data
      - caddycfg:/config
      - ./Caddyfile:/etc/caddy/Caddyfile
    depends_on:
      - app
    networks:
      - app

  app:
    build:
      context: .
      dockerfile: ./dockerassets/app/Dockerfile
    restart: always
    networks:
      - app

networks:
  app:

volumes:
  caddydataprod:
  caddycfgprod:
```

Criando o Caddyfile:

```
{
    email email@suaempresa.com

    on_demand_tls {
        ask http://app/api/check-domain
        interval 2m
        burst 5
    }
}
```

No topo do arquivo, temos as configurações gerais do Caddy, incluindo o e-mail usado para emitir os certificados SSL e as configurações do on demand tls. No “on_demand_tls”, definimos a URL que responde com status 200, caso o domínio esteja cadastrado e ativo na sua aplicação, além do tempo de cache.

Assim, sempre que uma requisição de um domínio que ainda não tem certificado chega no servidor, o Caddy envia uma requisição para a URL do parâmetro “ask”, com o domínio como parâmetro de URL. Por exemplo: **http://app/api/check-domain?domain=dominio.com**. (lembre-se do www).

Aqui, temos o redirecionamento de http para https.

```
http:// {
    redir https://{host}{uri} permanent
}
```

E finalmente, o proxy reverso com tls on demand para a aplicação.

```
https:// {
    tls {
        on_demand
    }

    reverse_proxy app:80
}
```

Confira o Caddyfile completo com todas as configurações acima:

```
{
    email email@suaempresa.com
    on_demand_tls {
        ask http://app/api/check-domain
        interval 2m
        burst 5
    }
}

http:// {
    redir https://{host}{uri} permanent
}

https:// {
    tls {
        on_demand
    }

    reverse_proxy app:80
}
```

Pronto! Com tudo configurado corretamente, basta um simples "**docker compose up -d**" para que sua aplicação comece a fornecer certificados SSL para domínios apontados para o seu servidor.
𝟭𝟬 𝘁𝗵𝗶𝗻𝗴𝘀 𝘁𝗼 𝗸𝗻𝗼𝘄 𝗮𝗯𝗼𝘂𝘁 𝗔𝗪𝗦 𝗟𝗮𝗺𝗯𝗱𝗮🌻
Tags: aws, webdev, serverless, programming
Published: 2023-06-26 18:22:40



### 1. 𝗦𝗲𝗿𝘃𝗲𝗿𝗹𝗲𝘀𝘀 𝗖𝗼𝗺𝗽𝘂𝘁𝗶𝗻𝗴: 

AWS Lambda is a serverless computing service offered by Amazon Web Services (AWS). It allows you to run your code without provisioning or managing servers.

---

### 2. 𝗘𝘃𝗲𝗻𝘁-𝗗𝗿𝗶𝘃𝗲𝗻 𝗘𝘅𝗲𝗰𝘂𝘁𝗶𝗼𝗻: 

Lambda functions are triggered by various events such as changes to data in an Amazon S3 bucket, updates to a DynamoDB table, or HTTP requests via API Gateway.

---

### 3. 𝗟𝗮𝗻𝗴𝘂𝗮𝗴𝗲 𝗦𝘂𝗽𝗽𝗼𝗿𝘁: 

AWS Lambda supports multiple programming languages including Python, Node.js, Java.

---

### 4. 𝗣𝗮𝘆 𝗣𝗲𝗿 𝗨𝘀𝗮𝗴𝗲: 

Lambda follows a  Pay Per Usage model, meaning you are billed only for the compute time consumed by your functions.

---

### 5. 𝗔𝘂𝘁𝗼𝗺𝗮𝘁𝗶𝗰 𝗦𝗰𝗮𝗹𝗶𝗻𝗴: 

AWS Lambda automatically scales your functions based on the incoming request rate. It provisions the necessary compute resources to handle the load and manages scaling for you.

---

### 6. 𝗘𝘃𝗲𝗻𝘁 𝗦𝗼𝘂𝗿𝗰𝗲𝘀: 

Lambda functions can be triggered by various event sources such as AWS services like S3, DynamoDB, SNS, CloudWatch, and custom events from your applications.

---

### 7. 𝗣𝗲𝗿𝗺𝗶𝘀𝘀𝗶𝗼𝗻𝘀 𝗮𝗻𝗱 𝗦𝗲𝗰𝘂𝗿𝗶𝘁𝘆: 

Lambda functions can be associated with IAM roles to control access to AWS resources. You can define granular permissions for each function, allowing it to access specific services or resources.

---

### 8. 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻 𝗩𝗲𝗿𝘀𝗶𝗼𝗻𝗶𝗻𝗴: 

You can create different versions of your Lambda functions and deploy new versions without impacting the existing ones. This allows you to test and roll back changes easily. 

--- 

### 9. 𝗠𝗼𝗻𝗶𝘁𝗼𝗿𝗶𝗻𝗴 𝗮𝗻𝗱 𝗟𝗼𝗴𝗴𝗶𝗻𝗴: 

AWS Lambda provides built-in monitoring and logging capabilities.

---

### 10. 𝗖𝗿𝗼𝘀𝘀-𝗔𝗰𝗰𝗼𝘂𝗻𝘁 𝗔𝗰𝗰𝗲𝘀𝘀: 

Lambda functions can access resources in other AWS accounts using cross-account IAM roles.

---
---

### Support us

{% youtube Q-ha1S6KOFg %}

---

Thanks for Reading ❤️! Check my website [Demo coding](https://democoding.in/) for updates about my latest CSS Animation, CSS Tools, and some cool web dev tips. Let's be friends!

Don't forget to subscribe to our channel : [Demo code](https://www.youtube.com/@democode)

---
### Read Next Post 

{% link https://dev.to/jon_snow789/glassmorphism-css-generator-k90 %}
IT-Life: Difficulties of Being a Junior
Tags: hiring, startup, interview
Published: 2023-06-26 18:21:56

Hello, world! Today I would like to discuss with you such a problem as looking for a job in 2023.

It is always quite problematic for many juniors to break through, almost all companies need guys with work experience, and where to get it if they don't take juniors to work? And I began to wonder: what should I do?

After finishing courses or any preparations before applying, you are going to struggle with misunderstandings, hundreds of test tasks, and ghosting. Today the situation is not better: getting into IT is becoming more difficult.
What is the solution? Let’s discuss that issue. While applying for a position, we read a list of requirements. For example, you read these requirements and realize that you don’t have 1 skill, but you can learn that tool while working. What is your next step? Right, you will apply for a position and will be invited to the intro. Are you going to hide the fact that you don’t have such skill? Your future depends on that answer. So, you chose to lie but when you lie about something don’t forget to be a good cheater. I mean, hide the fact that you lied and try to learn that skill as fast as possible, don't let the company find out that you lied in the interview.

Let’s see another case. For example, you decided not to lie about definite skill. In that case be ready to be rejected, because the employee wants to hear things he wants to hear. Yes, of course, you can make your truth more colorful with the words “I’ve never had to work with that program but I’m ready to learn it with a huge interest”. But try to do it fast, because when the trainee period starts, you have to be multifunctional and learn everything quickly.
This is a kind of game called “Hide and Sick”. You can choose:

1. Tell the exact truth that you do not know how to work with this program and be honest (the chance of getting a job decreases at times).
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8fojp3epyce5aikqo0bd.png)

2. Do not let the company reveal the fact that hide the truth a little at the interview and try to join the process very quickly (there is a greater chance of getting a job)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a1efunuz6faryb53lohx.png)

Guys, everything I wanted to tell by this article is that if you have a chance to show yourself but you don’t have at least 1 skill, anyway, anyway, lie, ups sorry, I mean try ;), any experience is good, doesn’t matter if it is negative or positive. I will be glad if you share your first-job experience with me.
Embracing Change: My Journey from Veterinary and Dental Assistant to Software Engineer
Tags: beginners, codenewbie, newbie
Published: 2023-06-26 18:03:45

Change is inevitable, and sometimes it is true that life presents us with unexpected opportunities that lead us down completely different paths. My name is Jessica, and for the past decade, I’ve worked as a vet assistant while also spending some time dental assisting. I learned a lot in both professions, and enjoyed them both. However as time passed, my priorities shifted. I realized a goal of mine was to build a sustainable life with my future wife. Unfortunately, I discovered that my career growth and financial prospects in my current fields had reached a plateau. It was during this time that a friend’s decision to become a software engineer interested me. This set me on an unexpected path. In this blog post, I will share my journey from a vet and dental assistant to an aspiring software engineer.

Discovering the Possibilities:
My friend Marissa had successfully completed a bootcamp for software engineering career, and I began to pick her brain about it. I realized that her professional growth and income were not the only factors that interested me. Memories of my teenage years, when I unknowingly coded HTML and CSS to customize my MySpace page (yes, it was that long ago! LOL). It sparked the idea that this could possibly be the right path for me as well.

Taking the Leap:
A complete career change can be super intimidating, so it took me two years of fighting my self doubt to finally go for it. Fueled by the desire for personal and professional growth, I built up the courage to enroll in a software engineering program. Going from working as a vet/dental assistant to being a student in an intensive program was not easy, but I was determined to try something new and grow in a field that seemed foreign to me.

The importance of teamwork:
While the decision to change careers was not easy, I am grateful for the opportunity and being able to connect with new people. Having a good support system within your classmates who are also learning a new path has been so crucial in my learning process. I am super grateful to have them my "sweet angel babies" along this journey. 
Don't be afraid to ask questions and remind yourself that we are all learning something new, so try not to be hard on yourself!!

Conclusion:
Life is a journey of self-discovery. My transition from a vet and dental assistant to an aspiring software engineer has been filled with SO MANY highs and lows but, it has taught me the importance of embracing change, even when it seems scary. 

Remember, it’s never too late to pursue your dreams and embark on a new path!
Call, Apply and Bind Method in JavaScript.
Published: 2023-06-26 17:44:37

Look at the code below to see how we defined a variable and specified a function within it to get the intended result. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ylxjjl218jdw2kfkgi2.jpeg)

## Call Method
Let's declare another variable, and if you think declaring that function again here will be acceptable, think again. This is not a good practise. So this is where call method comes in picture.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aq89bu4jihufp0q709wj.jpeg)

## Apply Method
The apply method is extremely similar to the call method, with the main difference being how we pass arguments, with the first argument being a reference to this and the second argument being a list of the arguments that we pass in the function. Instead of sending these arguments individually using a coma in call method, we pass them in an array list to the apply method.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oeak0oz13ycmrfrxz1af.jpeg) 

## Bind Method
The bind method is quite similar to the call method, with the exception that the bind method links this method (function name) with the object and then returns a copy of the method (that function). There is a catch over there that does not directly call the function but instead returns a duplicate of that function that we can call later.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjlzn66y6lfrzadyx0lx.jpeg)


Thank you for reading.
Tools & Resources to Improve Your UI/UX Skills
Tags: webdev, frontend, ui, tutorial
Published: 2023-06-26 17:37:37



1. http://learnui.design
2. http://uxfol.io
3. http://lawsofux.com
4. http://visily.ai
5. http://enhanceui.com
6. http://figma.com
7. http://sketch.com

**Youtube** 

8. Design Course
9. Flux
10. UX Mastery
How to use stripe-mock with GitHub Actions
Tags: stripe, githubactions
Published: 2023-06-26 17:36:08

[stripe-mock](https://github.com/stripe/stripe-mock) is a library that allows you to mock the Stripe API. It's useful for testing purposes when you don't want to make requests to the actual API.

You can also use it with GitHub Actions on the testing pipeline for your CI environment.

`stripe-mock` has a Docker image you can use on GitHub Actions: `stripe/stripe-mock`.

This allows us to use [service containers](https://docs.github.com/en/actions/using-containerized-services/about-service-containers) to run the mock server:

```yml
jobs:

  test:
    runs-on: ubuntu-latest

    services:
      stripemock:
        image: stripe/stripe-mock:latest
        ports: ['12111:12111']
```

That's it! Now the mock Stripe API will be running on port `12111` when you run your tests on GitHub Actions.
PHP Api Rest alternative
Tags: php, api, rest
Published: 2023-06-26 15:18:28

Hello guys,

I'm the creator of [Micron](https://github.com/gpisano97/Micron),it is an API Rest framework for PHP that permit to create API Rest. It supports MySQL Database, complex routes definitision, JWT Token authentication and authorization. To speed up the development i also created a beautiful Database class that extends PDO with some awesome functionalities...

Why i'm doing this post? Because is very very difficult to popularize a project, i used it in many works with my company, and i think that can be very helpfull and can improve the productivity!

I'm still developing new functions and improvement, i support it at 100% (also because I use it in my works) and i think that if it can be used from more people Micron can become ever bigger!

So, i know, there i a little lack in the documentation and the "tutorial" section is still under construction, but if you want to see something new, simple and fast, check my little baby and let me know what you think about it!

Good coding to everyone.
Best CSS animation libraries
Tags: webdev, css, frontend, programming
Published: 2023-06-26 17:31:48



✅ **Animate.css**

✅ **Hover.css**

✅ **Magic Animations**

✅ **Transition.css**

✅ **Mo.js**

✅ **Anime.js**

✅ **GreenSock (GSAP)**

✅ **CSShake**

✅ **Move.js**

✅ **Bounce.js**

✅ **Vivify**

✅ **Effeckt.css**

✅ **Animista**

✅ **WOW.js**

✅ **Micron.js**

Add more below 👇
Introduce An Open Source Vocabulary Term | Outreachy Internship | QEMU
Published: 2023-06-26 17:27:11

When I first started contributing to QEMU, I came across a lot of new vocabulary terms and concepts. One term that confused me at first was “RFC”. My mentors asked me to submit an RFC for a patch series I was working on. I wasn’t sure what an RFC was or what I needed to do. 

Luckily, QEMU has great documentation that explains what an RFC is:

https://www.qemu.org/docs/master/devel/submitting-a-patch.html#use-the-rfc-tag-if-needed

“RFC” stands for “Request For Comments”. An RFC means you aren’t asking for your patch series to be immediately applied, but want to get early feedback and review. Reasons for an RFC include:

• The patch depends on upcoming kernel changes, so the patch series is blocked. But it’s still worth reviewing.

• The patch series isn’t finished yet. You want feedback on a major API change or design before continuing work.

At first, I was hesitant to ask what an RFC was and how I should submit one. I worried that as an intern, I should already understand the process. But after searching QEMU’s documentation and seeing RFC used in the mailing list, I realized I wasn’t the only one who didn’t fully understand. Other newcomers to the project were likely also unsure. 

By asking my mentors and on the mailing list about RFCs, I helped clarify for others. My mentors pointed me to helpful resources and I submitted my RFC patch as a draft to get early feedback.  

If you’re worried about asking questions in your open source community, remember that everyone starts out not knowing things. Your questions will help other newcomers who are also unsure. Don’t be afraid to ask mentors or others in the community chat. They want to see you succeed, and will be happy to point you to resources to help you learn.
Pros and Cons of REACT
Published: 2023-06-26 17:15:11

React, a widely used JavaScript library for building user interfaces, is highly regarded for its efficiency, reusability, and flexibility. Let's explore the advantages and disadvantages of developing a React app.

**Advantages of React:**

1. Component-based architecture: React employs a modular approach, breaking down the user interface into reusable components. This facilitates better code organization, simplified maintenance, and accelerated development. Developers can create self-contained components with their own logic and styling, facilitating the construction of intricate user interfaces.

2. Virtual DOM: React employs a virtual DOM, which is a lightweight representation of the actual DOM. This allows React to efficiently update and render only the necessary components when changes occur, resulting in enhanced performance and faster user interfaces.

3. Reusability and scalability: React promotes code reusability, enabling developers to create component libraries that can be shared across multiple projects. This reusability saves development time and effort, while also facilitating scalability as applications can be easily extended and modified.

4. One-way data flow: React adheres to a unidirectional data flow, where data flows from parent components to child components. This simplifies understanding of how data changes propagate through the application, making debugging easier and reducing unexpected side effects.

5. Strong community and ecosystem: React boasts a large and active community, providing access to a wealth of resources, tutorials, and libraries. This enables developers to quickly find solutions to problems and stay updated with best practices, fostering a supportive environment.

**Disadvantages of React:**

1. Complexity: React has a steep learning curve for developers new to component-based architecture and virtual DOM. JSX, combining JavaScript and HTML, can be complex for those unfamiliar with it. The official documentation may be challenging for beginners, lacking clarity and ease of navigation.

2. Boilerplate code: React projects often require the setup of additional tools and build configurations. This initial setup process can be time-consuming and may involve writing boilerplate code. Nonetheless, tools like Create React App have been developed to streamline this process.

3. Performance concerns: While React's virtual DOM provides performance benefits, complex React applications with numerous components and frequent updates may encounter performance issues. Careful optimization and performance tuning may be necessary in such cases to ensure optimal performance.

In conclusion, React is a powerful JavaScript library for building user interfaces, known for its component-based architecture, virtual DOM, and code reusability. It offers scalability and efficiency. However, developers should consider the learning curve, JSX complexity, and performance when using React. With the right knowledge, React can be a valuable tool for high-quality web applications.
#TestCulture 🦅 Episode 36 – Milestones are evaluated objectively
Tags: agile, devops, webdev, beginners
Published: 2023-06-26 15:15:16

In agile, milestones are, among other things, the moments when the product is delivered to the customer. 🕰️
There are other types of milestones such as the delivery of each User Story (US).
SAFe proposes other milestones such as the Program Increment (PI) which classically frames four consecutive two-week sprints.
The point made by this practice is that each of these milestones must be framed by verifiable criteria that allow us to say whether the milestone has been reached. ✅
In agility, this practice must absolutely be combined with the incremental approach, otherwise we fall back into the waterfall and tunnel effect...
---
👉🏼 Learn more about this concept: [here](https://agilitest.com/cards/milestones-are-evaluated-objectively)
---
[A thread](https://twitter.com/agilitest/status/1651594509438918659?s=20) on Twitter.
AWS - A solução consiste em uma arquitetura de duas camadas implantada na AWS em várias zonas de disponibilidade.
Published: 2023-06-26 16:23:40


A primeira camada consistirá em recursos de “computação”: um balanceador de carga, um grupo de dimensionamento automático e instâncias do EC2. Em seguida, a camada de “dados” será composta por uma instância RDS executando um servidor MySQL.

Aqui está o diagrama arquitetônico

![image](https://github.com/andreelidio/terraform-aws-alb-asg-efs-wordpress/assets/97263573/52c6c6bf-4882-4289-8fce-d5a187265c0d)


O ponto de entrada é um Elastic Load Balancer que balanceará e enviará o tráfego para uma série de instâncias do EC2. Nessas instâncias EC2, temos o WordPress instalado e, caso tenhamos uma situação de “alto tráfego”, podemos escalar rapidamente implantando novas máquinas. 

Implantei um grupo de dimensionamento automático que observa a carga da CPU dessas instâncias e adiciona ou encerra máquinas de acordo com a carga. Quando implantamos novas instâncias Ec2, usamos um modelo de inicialização que especifica o tipo EC2 e AMI (Amazon Machine Image). Há também um pequeno script de inicialização que será executado quando iniciar a máquina. 

Essas máquinas são recursos temporários. Quando o aplicativo estiver em alta demanda, teremos muitas instâncias, mas quando as coisas estiverem calmas, o sistema encerra o excesso de energia e podemos acabar com apenas um EC2. Devido a essa volatilidade, isso significa que não podemos armazenar dados persistentes no EC2. A solução para esse problema é implantar um Elastic File System(EFS) na EC2. 

Depois, vinculamos a pasta 'wp-content' do WordPress ao EFS. Essa ação garante que todos os arquivos de mídia, plug-ins e temas sejam armazenados fora da instância do EC2. Dessa forma, quando encerrarmos uma máquina EC2, não perderemos os plugins, temas ou mídias carregadas. E todos os EC2 implantados compartilharão esse EFS e terão acesso aos mesmos dados.

Seguindo o mesmo princípio, criamos uma instância RDS que executa o servidor MySQL. Novamente, a EC2 se conectará a esse banco de dados e o sistema não salvará os dados localmente. 
Como queremos que nosso aplicativo esteja altamente disponível, implantaremos nossos recursos em várias zonas de disponibilidade. Quando implantamos essa arquitetura, podemos acessar nosso novo site WordPress chamando o nome DNS do ELB. 

O monitoramento e observalidade ficará pelo AWS CloudWatch, irá monitorar as instâncias EC2 com o WordPress funcionando, existem várias formas de configuração e coleta de métricas disponíveis.

Versionamento do código:
https://github.com/andreelidio/terraform-aws-alb-asg-efs-wordpress


Espero que você tenha gostado deste post e tenha aprendido algo novo🆙
Qualquer feedback será bem-vindo, é só deixar nos comentários.😀
Curta, compartilhe, siga-me em:
✅ https://linktr.ee/andreelidio