teleren/devto huggingface dataset:
Dockerize your Next.js application on Spheron Compute
Published: 2023-06-30 22:27:49

**Spheron** is a decentralized cloud storage platform that provides an all-in-one solution for building and deploying DApps. In this article, we will show you how to dockerize your Next.js application and deploy it on Spheron Compute.

## What is Docker?

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package.

## What is Next.js?

Next.js is a popular React-based framework for building server-rendered or statically-exported React applications. It provides features such as automatic code splitting, server-side rendering, and more.

## Dockerizing your Next.js application

To Dockerize your Next.js application, you need to create a Dockerfile in the root of your project directory. This file contains instructions for building a Docker image of your application. Here is an example Dockerfile for a Next.js application:

### Use an official Node.js runtime as the base image
`FROM node:alpine
`
### Set the working directory
`WORKDIR /app`

### Copy package.json and package-lock.json
`COPY package*.json ./`

### Install dependencies
`RUN npm install`

### Copy the rest of the files
`COPY . .`

### Build the app
`RUN npm run build`

### Expose port 3000
`EXPOSE 3000`

### Start the app
`CMD ["npm", "start"]`

This Dockerfile uses the official Node.js runtime as the base image, sets the working directory to /app, copies the package.json and package-lock.json files, installs dependencies, copies the rest of the files, builds the app, exposes port 3000, and starts the app.

Once you have created the Dockerfile, you can build the Docker image by running the following command in your terminal:

`docker build -t my-nextjs-app .
`
This command builds a Docker image with the tag my-nextjs-app using the Dockerfile in the current directory.

## Deploying your Next.js application on Spheron Compute

Once you have Dockerized your Next.js application, you can deploy it on Spheron Compute. To do this, follow these steps:

Go to the Compute section in Spheron.

Create a new cluster by clicking on the “New Cluster” button.
Click on the “Select from marketplace app” button for fast-track deployment.
Select the IPFS template from the marketplace.
Choose your instance plan and click on the “Deploy” button.
Once your IPFS node is up and running, you can upload files to IPFS via WebUI or HTTP-Client, and access files using IPFS Gateway.

That’s it! You have successfully dockerized your Next.js application and deployed it on Spheron Compute. With Spheron’s all-in-one solution, you can easily build and deploy DApps without having to worry about complicated infrastructure.
Day 774 : Movin
Tags: hiphop, code, coding, lifelongdev
Published: 2023-06-30 22:03:18

_liner notes_:
- Professional : Today was pretty chill. Had a meeting where I showed what I worked on and came to a conclusion on what else to do. I worked on making those changes to the documentation.

- Personal : Went through Bandcamp and bought some tracks. I put together the tweets to send. Felt tired and went to sleep.

![Large land mass sticking out of the water in Hvítserkur, Iceland](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fvum4nyw5wl07cs0p885.jpg)

Going to put together the radio show. I want to work some on my side project. I need to get the uploading an image to GitHub working. Definitely want to watch the new episode of "Secret Invasion". Time to get moving.

Have a great night and weekend!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube Z8A-450oBm8 %}
A little script for PostgreSQL and AGE
Tags: postgres, apacheage, age, bash
Published: 2023-06-30 21:38:22

While trying to install PostgreSQL and Apache AGE, I noticed a lot of routine steps that could be automated. So I made this following script to automate the build and install of both PostgreSQL and Apache AGE.
Please note that you have to check for version compatibility for both applications (may add a check for that later)

```bash
#!/bin/bash

set -e

echo "Retrieving listings..."
listings=$(curl -s https://www.postgresql.org/ftp/source/ | grep -Po '(?<=href=")[^"]*' | grep '^v')

echo "Available listings:"
count=1
while read -r listing; do
  echo "$count. $listing"
  ((count++))
done <<< "$listings"

read -p "Please enter the number of the listing you'd like to explore: " listing_number

selected_listing=$(echo "$listings" | sed -n "${listing_number}p")

echo "Retrieving files for listing $selected_listing..."
files=$(curl -s "https://www.postgresql.org/ftp/source/$selected_listing" | grep -Po '(?<=href=")[^"]*')

echo "Available files:"
count=1
while read -r file; do
  echo "$count. $file"
  ((count++))
done <<< "$files"

read -p "Please enter the number of the file you'd like to download: " file_number

selected_file=$(echo "$files" | sed -n "${file_number}p")

echo "Downloading file $selected_file..."
wget "https://www.postgresql.org/ftp/source/$selected_listing$selected_file"

echo "File downloaded successfully!"

echo "Creating directories..."
mkdir -p age_installation/pg
cd age_installation/pg

echo "Installing dependencies..."
sudo apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison
sudo apt-get install -y postgresql-server-dev-11

echo "Extracting PostgreSQL source..."
tar -xf "../$selected_file"
source_folder=$(tar -tf "../$selected_file" | head -1 | cut -f1 -d"/")

cd "$source_folder"

echo "Configuring PostgreSQL..."
./configure --enable-debug --enable-cassert --prefix=$(pwd) CFLAGS="-ggdb -O0 -fno-omit-frame-pointer"

echo "Building and installing PostgreSQL..."
make world
make install-world

cd ../../age/

echo "Installing age..."
sudo make PG_CONFIG=$(pwd)/../pg/$source_folder/bin/pg_config install

echo "Running age install check..."
make PG_CONFIG=$(pwd)/../pg/$source_folder/bin/pg_config installcheck

cd "../$source_folder"

echo "Initializing PostgreSQL demo database..."
bin/initdb demo

echo "Starting PostgreSQL server..."
bin/pg_ctl -D demo -l logfile start

echo "Creating demodb..."
bin/createdb demodb

echo "Accessing demodb..."
bin/psql demodb
```
Happy sql'ing!
How to install a package from a private repository on Poetry for CI
Tags: python, poetry, gitlabci, ci
Published: 2023-06-30 21:22:28

## Why? 

One of the methods to install a package via poetry is to use `deploy tokens` directly on the package URL, and that used to work on poetry too before version ` 1.0.3`.

What changed? The git URL parsing has changed significant to be more consistent.

Are they planning on fixing this within poetry? No.
They don't want to expose credentials on the `pyproject.toml` file, which makes sense.

source: [This issue on gitlab](https://github.com/python-poetry/poetry/issues/2062)

## How to do this then? 

There are multiple ways, using git credential helpers, setting credentials globally for a particular URL.

The one thing that was easy enough to me was to tell git to replace the URL when calling gitlab via HTTPS.

After [obtaining your deploy tokens from gitlab](https://docs.gitlab.com/ee/user/project/deploy_tokens/), this is how you tell git to use them

``` bash
deploy_user=YOUR_DEPLOY_TOKEN_USER
deploy_token=YOU_DEPLOY_TOKEN
git config --global url."https://$deploy_user:$deploy_token@gitlab.com".insteadOf https://gitlab.com

```

Note this is intended to run in a docker container via CI, so it does not matter that much if you rewrite that URL, I do not recommend you to do this on your local machine, for that use SSH keys.

Which takes me to the next section

### Poetry install Locally vs Gitlab CI

I do use SSH to clone mu libraries from gitlab, and the deploy token requires cloning via HTTPS, so now what? 

I replace the urls on my `before_script`, hacky but effective.

For example, let's say you have this library on your `pyproject.toml` file

```
testrail-api-wrapper = {git = "git@gitlab.com:mundo03/sample_library.git", rev = "main"}
```

You can rewrite it using `sed` like this:

``` bash
export SSH_URL=git@gitlab\.com:mundo03\/sample_library.git
export TOKEN_URL=https:\\/\\/gitlab.com\\/mundo03\/sample_library.git
sed -i "s|$SSH_URL|$TOKEN_URL|g" pyproject.toml
```

your `.gitlab-ci.yml` file would look like this, given you want to install you project and run `pytest`

``` yaml
stages:
  - test

.build:
  before_script:
      - pip install poetry
      - poetry config virtualenvs.in-project false #Ignore venv
      - export SSH_URL=git@gitlab\.com:mundo03\/sample_library.git
      - export TOKEN_URL=https:\\/\\/gitlab.com\\/mundo03\/sample_library.git
      - sed -i "s|$SSH_URL|$TOKEN_URL|g" pyproject.toml
      - git config --global url."https://$deploy_user:$deploy_token@gitlab.com".insteadOf https://gitlab.com
      - poetry update
      - poetry install -v

pytest_311:
  image: python:3.11
  extends: .build
  stage: test
  script:
    - poetry run pytest --cov
  retry: 2
  coverage: '/TOTAL.*\s+(\d+%)$/'
``` 

## Conclusion
Poetry did me dirty and I had to find another way to install dependencies in CI that come from private git repositories.
ttvnonlinenet
Published: 2023-06-30 19:17:06

[Suvip](https://ttvnonline.net/) nền tảng game bài đổi thưởng trực tuyến uy tín nhất 2023. Hứa hẹn đem đến cho quý khách trải nghiệm thú vị
https://www.pinterest.com/ttvnonlinenet/
https://www.youtube.com/@ttvnonlinenet/about
https://profile.hatena.ne.jp/ttvnonlinenet/profile
https://www.quora.com/profile/Ttvnonlinenet
https://social.msdn.microsoft.com/Profile/ttvnonlinenet
https://social.microsoft.com/profile/ttvnonlinenet
https://social.technet.microsoft.com/Profile/ttvnonlinenet
https://www.tripadvisor.com/Profile/ttvnonlinenet
https://www.reddit.com/user/ttvnonlinenet
https://www.wikihow.com/User:Ttvnonlinenet
https://www.yummly.com/profile/Ttvnonlinenet
https://www.hackerrank.com/ttvnonlinenet?hr_r=1
https://www.atlasobscura.com/users/ttvnonlinenet
https://codepen.io/inenet
https://coolors.co/u/ttvnonlinenet
https://leetcode.com/ttvnonlinenet/
https://www.producthunt.com/@ttvnonlinenet
https://anyflip.com/homepage/dysgz#About
https://www.evernote.com/client/web?login=true&newReg=true#?an=true&n=8f57cfd3-b99b-caca-4277-4bb3e08aa971&
https://www.kickstarter.com/profile/2025144427/about
https://fliphtml5.com/homepage/cwacp
https://www.4shared.com/u/rohiTD5e/ttvnonlinenet.html
https://hub.docker.com/u/ttvnonlinenet
https://www.bark.com/en/us/company/ttvnonlinenet/mZnnL/
https://osf.io/nbjd9/
https://www.openstreetmap.org/user/ttvnonlinenet
https://www.thestudentroom.co.uk/member.php?u=6272399
https://newspicks.com/user/9190508
https://orcid.org/0009-0004-7733-0937
https://comicvine.gamespot.com/profile/ttvnonlinenet/
https://creativemarket.com/users/ttvnonlinenet
https://www.bitchute.com/channel/Mh7YnCVypUWz/
https://www.reverbnation.com/ttvnonlinenet?profile_view_source=header_icon_nav
https://twitter.com/ttvnonlinenet
https://dev.to/ttvnonlinenet
The 21st Day of the 100 Days of Code challenge
Published: 2023-06-30 20:19:12

Today, I improved the transcription accuracy in my real-time transcription app with Whisper (demo available in the post from yesterday) and tried to imrpove the accuracy of the Speaker Re-identification for the Speaker Diarization feature.

To do that, I chose to use a different library for the Speaker Re-identification part.

I tried to install pykaldi but failed miserably, I chose to use DeepSpeaker but that didn't go all that well. I didn't iterate much on implementing it in my project, so I'll put more effort on that tomorrow. If it works accurately, there'll be no need to install pykaldi. 

I improved the transcription accuracy by using Whisper's large model, and didn't sacrifice on execution time by running my server on Google Colab (which I had a nightmare using copying and pasting files to).

Not much for today, hoping for a finished product tomorrow! Happy coding everyone :)
#DEVDiscuss: ChatGPT Lawsuits
Tags: devdiscuss, discuss, openai, chatgpt
Published: 2023-06-30 20:00:00

Hey Devs, happy Friday 🦥💚

As always, it's been an eventful week in the tech industry. We've got a lot to talk about! And today I want to discuss...the ChatGPT lawsuits 💼

In case you missed it, OpenAI has been hit with its first defamation lawsuit for...hallucinating. Or, as the defendant might put it, generating false and defamatory information about them.

{% embed https://www.theverge.com/2023/6/9/23755057/openai-chatgpt-false-information-defamation-lawsuit %}

> The case states that a journalist, Fred Riehl, asked ChatGPT to summarize a real federal court case by linking to an online PDF. ChatGPT responded by created a false summary of the case that was detailed and convincing but wrong in several regards. ChatGPT’s summary contained some factually correct information but also false allegations against Walters. It said Walters was believed to have misappropriated funds from a gun rights non-profit called the Second Amendment Foundation “in excess of $5,000,000.” Walters has never been accused of this.

In the US, lawsuits are a common method for pushing legislative changes and reform.

So, what do you think will happen here? Share your thoughts in the comments and let's discuss!

---

_Want to submit a question for discussion, or even ask for advice? Visit [Sloan's Inbox](https://docs.google.com/forms/d/e/1FAIpQLSc6wgzJ1hh2OR4WsWlJN9WHUJ8jV4dFkRDF2TUP32urHSAsQg/viewform?usp=sf_link)! You can choose to remain anonymous._
A question I usually ask in interviews..
Tags: webdev, javascript, react
Published: 2023-06-30 19:55:05


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/41wy8s54w6qc1tmfp1nw.png)"Do you understand React's life cycle"? The answer is very often a confident "yes".
But maximum students failed to explain to them when it comes to the functional component.

Some common questions that one can prepare on useEffect hook:-
1. What are side effects, and how can we perform side effects in React?
2. How can we perform unMounting in functional components, and why is it required?

Check the image to see six ways one can use useEffect() hook.
LB Labs: Inside the Top 10% of Engineering Orgs
Published: 2023-06-30 19:25:39

Fact: You can’t become better at anything unless you understand what getting better would actually look like. This is especially true in the case of engineering teams.

Following the analysis of 2,000 dev teams and over 4 million code branches, the 2023 Engineering Benchmarks report is out.

To walk us through the performance metrics of the top 10% of engineering teams, LinearB’s Head of Developer Relations Ben Lloyd Pearson makes his first Dev Interrupted appearance.

From how long elite teams take to complete code tasks to the size of their pull requests, this is a great episode to understand where your dev team stands and where they have concrete room to improve.

{% spotify spotify:episode:4oaEcz9f39dpdN4iYli6oS %}

## Episode Highlights:
* (0:00) Accelerate State of DevOps survey
* (2:15) Introductions
* (7:38) Research behind the engineering benchmarks
* (11:23) Delivery lifecycle metrics
* (14:51) PR automation tooling
* (18:32) Elite developer workflow metrics
* (25:40) State of business alignment metrics
* (34:19) Predictability and planning accuracy

[Read the full episode transcript
](https://devinterrupted.com/podcast/lb-labs-inside-the-top-10-of-engineering-orgs/)

---

***While you’re here, check out this video from our [YouTube channel](https://www.youtube.com/c/DevInterrupted?sub_confirmation=1), and be sure to like and [subscribe](https://www.youtube.com/c/DevInterrupted?sub_confirmation=1) when you do!***

{% youtube OPK3MlJimUA %}

---

## A 3-part Summer Workshop Series for Engineering Executives
Engineering executives, [register now](https://linearb.io/events/2023-summer-series/?utm_source=Dev.to&utm_medium=referral&utm_campaign=202306%20-%20Event%20-%20Summer%20Series%20-%20Podcast%20Distribution) for LinearB's 3-part workshop series designed to improve your team's business outcomes. Learn the three essential steps used by elite software engineering organizations to decrease cycle time by 47% on average and deliver better results: Benchmark, Automate, and Improve.

Don't miss this opportunity to take your team to the next level - [save your seat today](https://linearb.io/events/2023-summer-series/?utm_source=Dev.to&utm_medium=referral&utm_campaign=202306%20-%20Event%20-%20Summer%20Series%20-%20Podcast%20Distribution).

[![Register Today](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nd6b3egikvnssdi9x50g.png)](https://linearb.io/events/2023-summer-series/?utm_source=Dev.to&utm_medium=referral&utm_campaign=202306%20-%20Event%20-%20Summer%20Series%20-%20Podcast%20Distribution)
NEXT.JS: Fetching API on button click
Published: 2023-06-30 19:15:17

Next.js version: 13.4

I have a component which returns a <button>. I also have a function like
async function getDataFromApi(name) {
  const res = fetch(`http://dummy.api?name=${name}`,
   {
     headers: {
      Authorization: process.env.API_KEY,
     },
   }
  )
  const data = await res.json()
  return data
}


How can I run this function whenever the button gets clicked? I tried using both client (cant because of the process.env.API_KEY) and server (cant because of the onClick() on the button and the full code uses states as well) components.
Also the API key should remain a 'secret', because it wouldn't be great if my key gets leaked.

EDIT: couldn't use the the code markdown in the post, because it gave an error
Ordering a pizza is more transparent than applying to a job
Published: 2023-06-30 19:09:51

It's Friday, you've been through a tough week. You open your delivery app of choice, spend 5 minutes and $20 maybe ordering a pizza to sit back and relax. Seconds after you've hit _order_, a notification pops up "A human being has seen your order". An hour later, you can forget about the entire interaction. Yet, you've grown to expect this level of transparency and get angry if that pizza is late or cold.

## Why don't we expect the same from jobs?

Using the above metrics, let's look at a typical job application and see how ridiculous the comparison gets. Time. For a typical job application, you often spend days compiling your details and if it's successful, it can often define years of your life. Money. Instead of the mere $20, given industry rates, a job can easily become a six-figure question. Yet, we're kind of okay with not hearing back from a company. Nobody likes it, but we've kind of accepted this is how things work.

Some companies are nicer and they do give feedback. However, given the volume of applications they often have to deal with, what we get is usually a template email where it's a good sign if we're not called `{{firstName}}`.

## Is there an acceptable compromise?
Our mission at [Moonka.space](https://moonka.space) is alleviating some of the issues that have become ubiquitous in the tech hiring space. Learning from the open startup and building in public movements, there's a clear lesson: share as much data as you can without hurting interests. It helps every party involved. There's clarity, transparency and learning.

We apply the same principle to job applications. Teams can set up stages, which is usual for any hiring tool. However, they can also attach public labels to these stages. Developers immediately get a notification if their application is updated. No need for verbose emails to be written or read. A label changes, without any effort from the company and with all the information the applicant wants to know.

And to bring pizza closer to tech jobs: once somebody sees your application, you'll know it.

In case something more needs to be said, there's always the option to say more. Do you want extra pepperoni? Maybe you want whipped cream on your Hawaii pizza to piss off even more Italians? You got it.

But when one word is all that's there, we don't have an excuse to make things more complicated than getting pizza.

## May we take your order?
Whether you're a developer looking for a job or you represent a company hiring, [create an account](https://moonka.space/login?type=seeker&focus=register) in less time than it takes to order that pizza and we'll set everything up for you.
How to stepup CI/CD in AWS
Tags: devops, ci, cd
Published: 2023-06-30 19:01:48

---
title: How to stepup CI/CD in AWS
published: true
description: Setting CI/CD pipelins
tags: devops, CI, CD
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-06-30 19:00 +0000
---
How To deploy your django app to AWS ECS
Tags: aws, ecs
Published: 2023-06-30 19:00:08

---
title: How To deploy your django app to AWS ECS
published: true
description: Deploying your containerized flask application to aws
tags: aws, ecs
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-06-30 18:56 +0000
---
Elastic Block Storage (EBS Volume)
Tags: aws, storage, cloudcomputing
Published: 2023-06-30 18:58:26


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

An Elastic Block Storage (EBS) Volume hosts virtual data in segments. It's like a storage disk with the ability to contain various sizes of data. 
These virtual storage devices usually replicate within one AWS region to increase their availability.



- EBS volume are the storage that only can be mounted on EC2 instance and that can be attached to the particular availability zone.
- A EBS volume can attach to 16 instance and provide higher availability.
- An AWS account has a limit to 20 EBS volume. And an instance can have attach to 20 EBS volume but **it is recommended to use 10 EBS to a single instance.**



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



### Volume Type

- Solid State Drive(SSD) volumes
- Hard disk Drive (HDD) volumes
- Standard volume or previous generation Volumes

### Solid State Drive(SSD) Volume
SSD backed are optimised and good for frequent input output.

####SSD Volume types includes:
1. General Purpose SSD and 
2. Provisioned IOPS SSD

#####General Purpose ssd 
These are balanced priced and used for balanced performance 

Types of General Purpose SSD volumes:
- General Purpose SSD (gp3) volumes —latest generation General Purpose SSD volume
- General Purpose SSD (gp2) volumes


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

`A tebibyte (TiB) and gibibytes (GiB)  is a unit of measure used to describe computing capacity` [For details](https://www.ibm.com/docs/en/spectrum-control/5.4.2?topic=concepts-units-measurement-storage-data)


#####Provisional IOPS SSD

Provisioned IOPS SSD volumes are backed by solid-state drives (SSDs). They are the highest performance Amazon EBS storage volumes designed for critical, intensive workloads that require low latency.

Types of Provisioned IOPS SSD volumes:
- Provisioned IOPS SSD (io2) volumes
- Provisioned IOPS SSD (io2) Block Express volumes
- Provisioned IOPS SSD (io1) volumes


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



###Hard disk drive (HDD) volumes

HDD-backed volumes are optimized for large streaming workloads where the dominant performance attribute is throughput. 
HDD volume types include 
- Throughput Optimized HDD and 
- Cold HDD.



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




### Standard volume or previous generation Volumes

Magnetic (standard) volumes are previous generation volumes that are backed by magnetic drives. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4tbibxlvu9jlqvn02nwh.png)

## SUMMARY


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4epjki0dc8d4oc86qzhv.png)





[For More Detail Explanation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html)