AWS |
lambdaタグが付けられた新着投稿 - Qiita |
AWS Lambdaでhostsファイルを設定する方法 |
https://qiita.com/speaktech/items/8723cae816f90f8de21c
|
awslambda |
2023-04-23 15:43:31 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Windowsでパス指定時のエラーの対処方法 (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape |
https://qiita.com/yulily/items/d14ef707733d504e7f91
|
|
2023-04-23 15:57:47 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
bybitのOHLCV(ローソク足+出来高)を全期間取得 |
https://qiita.com/hk512/items/4d6e957c29d3bb008b0c
|
stsimportpandasaspdurlhtt |
2023-04-23 15:32:36 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
PostGIS(と空間インデックス)を利用したポリゴン重なり数 |
https://qiita.com/yosukefk/items/013b398913e22c110df2
|
geopandas |
2023-04-23 15:15:36 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Rails controllerとは何か |
https://qiita.com/mavengr/items/c6ee50881f61e8193bd8
|
model |
2023-04-23 15:18:58 |
Linux |
Ubuntuタグが付けられた新着投稿 - Qiita |
Android Anbox で kindle にチャレンジ |
https://qiita.com/nanbuwks/items/70c1ccdf89a36f7fb91a
|
kindle |
2023-04-23 15:51:06 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
【1分理解】Amazon ELBとは!?(自分用) |
https://qiita.com/ITnoKosaka/items/dc0c6933fbc01c792988
|
amazonelb |
2023-04-23 15:27:02 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
【非エンジニア向け】Azure Virtual Machineを作成してWindows PCやLinux PCを使用する |
https://qiita.com/erio_vallecu/items/e61284dde21c145fb54c
|
azurevirtualmachine |
2023-04-23 15:56:46 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
Rails controllerとは何か |
https://qiita.com/mavengr/items/c6ee50881f61e8193bd8
|
model |
2023-04-23 15:18:58 |
海外TECH |
DEV Community |
Containers: what is containerization and container orchestration? |
https://dev.to/ezinne_anne/containers-what-is-containerization-and-container-orchestration-38pe
|
Containers what is containerization and container orchestration Containers are formally huge iron boxes to ship items to another location In computing containers are virtual boxes This time you use them to package applications with all their needs and ship them to your audience or users This pattern of packaging and shipping applications in the cloud has been gaining momentum because of the benefits This article will cover What is containerization What is a virtual machine VM Containers vs virtual machinesBenefits of containerizationWhat is container orchestration Benefits of container orchestrationTools for containerization and orchestration What is containerization Containerization is the process of running applications in an isolated environment with the necessary libraries and network processes for the application on the same operating system Containerization places an application on its own to run hitch free without interference with the OS A containerized app can run on any operating system removing set up and compatibility issues Containerization is a form of virtualization and containers are different from virtual machines Containers have a lightweight structure and you can containerize any application What is a virtual machine VM A virtual machine VM is an emulation simulation or virtual prototype of a physical computer that runs on a physical computer The physical computer that it runs on is the host and the VM is the guest A virtual machine uses the CPU memory and space of the computer it is on to create an operating system and build applications on it With virtualization you can build multiple virtual machines each with its own operating system This is possible with software called a hypervisor which acts as a connection between the host and the virtual machine The hypervisor shares computing resources with the virtual machine and inspects the machine often Containers vs virtual machines Containers have their own network memory and processes but they use the same operating system Containers contain an application with the necessary libraries and they consume the resources they require from the operating system they are on Virtual machines use different operating systems for each machine They also use networks memory and processes from the physical computer Virtual machines contain a virtual operating system and virtual hardware for the system and the application that will run on the machine with the necessary libraries Image source Benefits of Containerization Efficient use of resourcesContainerization makes containerized applications use their resources properly even though the container runs on the operating system It uses minimal memory and space so it does not overload the system PortabilityContainerized applications are compatible with a wide range of platforms and operating systems They also do not have setup constraints as they can run in different test and production environments This makes it portable and easy to use anywhere High speedContainerized applications usually occupy little space and make little use of CPU resources This makes them faster and able to run at high speeds SecurityContainerization secures applications because of its isolated nature It keeps the apps safe from possible vulnerabilities Also even if a container is under attack the container host is safe from being attacked Streamlined deployment and managementContainerization ensures containers have a standard unit of deployment Because of their light structure you can deploy them easily You can also roll back or make updates with ease because of the container s structure What is container orchestration Container orchestration is the process of deploying multiple containers and managing them using a container orchestration tool The container orchestration tool automates the use of containers instead of running and deploying them manually The tool takes care of it instead This is very useful in large organizations where they could deploy hundreds of thousands of containers in a day So the tool comes in handy to simplify the process Benefits of container orchestration Automatic deploymentContainer orchestration tools automate deployments making it easier to deploy many containers thereby speeding up the process and eliminating the complexities involved Management of containersThe tools also manage the containers by running health checks replacing failed containers or restarting them This makes containers easier to use and ensures the application is available to users Load balancingOrchestration tools distribute workload among the containers so there is no overload on any container Each of the containers gets to work efficiently when you are running the application Making UpdatesWith orchestration you can make updates easily When a team is making updates to an application they can roll out a new version of the application across the cluster This will reduce downtime and ensure that the application is available during the update process Access to and use of resources You can access how the containers use resources on the cluster Orchestration tools provide visibility into that making it possible for you to optimize resource allocation So you could distribute the necessary resources to the containers that needed them Tools for containerization and orchestration DockerDocker is an open source containerization platform that builds packages and deploys applications and their dependencies using containers Docker can run on popular operating systems like Windows Linux and macOS Docker uses the Docker engine for containers and Docker Swarm for orchestration The Docker engine is the host that runs on an operating system for building containers KubernetesKubernetes also known as KS is an open source container orchestration tool It automates deployments and distributes loads among containers It also monitors containers and replaces failed ones Although originally built by Google Kubernetes is currently under the Cloud Native Computing Foundation CNCF Kubernetes has a rapidly growing population of engineers using it Some organizations offer orchestration services using Kubernetes Some of them are the Google Kubernetes Engine GKE Azure Kubernetes Services AKS and so on Apache MesosApache Mesos is another orchestration tool for managing container based applications It uses Marathon to manage clusters and Shipworm as a network tool It is customizable and you can use it for large complex applications even virtual machines The Apache Mesos Project team is in charge of this orchestration tool and they have a thriving developer community NomadNomad is an open source orchestration tool that manages containerized and non containerized applications It is cloud agnostic which means it can run in any cloud environment It has a simple installation process is flexible and aims to eliminate the complexities surrounding orchestration with other tools Nomad integrates with other tools like Consul and Vault from its parent company Hashicorp You can also use it with Kubernetes and other orchestration tools Summary Containers are different from virtual machines Container orchestration takes the containerization process to a whole new level by introducing automation and simplifying the process Many businesses have started using containers for their applications Soon we might have a new standard for containerized apps |
2023-04-23 06:36:03 |
海外TECH |
DEV Community |
50 ChatGPT Prompts to Debug ReactJS Issues |
https://dev.to/nilanth/50-chatgpt-prompts-to-debug-reactjs-issues-35h3
|
ChatGPT Prompts to Debug ReactJS IssuesDebugging ReactJS applications can be a real challenge especially when you re trying to identify and solve issues quickly and efficiently But what if we told you that there s a solution that can help you streamline your debugging process and save time and frustration Introducing Essential Tips for Debugging ReactJS Applications with ChatGPT our brand new ebook that provides practical advice and actionable tips for using ChatGPT to debug issues in your ReactJS codebase These tips cover everything from identifying the location of the issue in your codebase to using tools like debuggers linters and code editors Plus you ll learn best practices for providing clear and concise descriptions of the issue including relevant error messages and console logs and using version control and consistent code style and formatting With the help of ChatGPT you ll be able to streamline your debugging process and supercharge your ReactJS development And best of all you can get your copy of this ebook today Grab your copy now and start saving time and frustration when encountering issues in your ReactJS applications Grab your Copy now on Gumroad More BlogsUse Vite for React Apps instead of CRATwitter Followers Tracker using Next js NextAuth and TailwindCSSDon t Optimize Your React App Use Preact InsteadHow to Reduce React App Loading Time By Build a Portfolio Using Next js Tailwind and Vercel with Dark Mode SupportNo More Import in React React Packages with K UI Components Packages to Optimize and Speed Up Your React App During DevelopmentHow To Use Axios in an Optimized and Scalable Way With React Custom Hooks to Make your React Component Lightweight Ways to Host Your React App For FreeHow to Secure JWT in a Single Page Application |
2023-04-23 06:32:37 |
海外TECH |
DEV Community |
PHP CRUD Rest API with Docker |
https://dev.to/francescoxx/php-crud-rest-api-with-docker-2c3f
|
PHP CRUD Rest API with DockerLet s create a CRUD Rest API in PHP using Laravel PHP framework Composer PHP package manager Postgres database DockerDocker ComposeMind the similar names ️ Composer is a package manager for PHP It is used to install and manage dependencies in PHP projects It is similar to NPM in Node js projects ️ Compose is a tool for defining and running multi container Docker applications It is similar to Docker Compose in Node js projects If you prefer a video version All the code is available in the GitHub repository link in the video description IntroHere is a schema of the architecture of the application we are going to create We will create endpoints for basic CRUD operations CreateRead allRead oneUpdateDelete StepsWe will go with a step by step guide so you can follow along Here are the steps Check the prerequisitesCreate a new Laravel projectCode the applicationRun the Postgres database with DockerBuild and run the application with Docker ComposeTest the application with Postman and Tableplus Prerequisitesphp installed version composer installed version docker installed version optional VS Code installed or any IDE you prefer optional Laravel cli optional Postman or any API test tool optional Tableplus or any database client Create a new Laravel projectTo create a new Laravel project we will use the Laravel CLI laravel new laravel crud apiThis will take a while but the final output should be something like this Now step into the project folder cd laravel crud apiand open the project with your favorite IDE If you use VS Code you can use the following command code this will open the project open a terminal and run the following command php artisan serveand you should have something like this You can stop the server with Ctrl C Now we are ready to start coding Code the applicationThere are two steps to code the application Configure the database connectionCreate the Player PlayerController and PLayer routes Configure the database connectionWe will use Postgres as our database To configure the database connection we will use the env file Open the env file and replace the lines DB CONNECTION DB HOST DB PORT DB DATABASE DB USERNAME DB PASSWORD with the following it should be mysql by default DB CONNECTION pgsqlDB HOST dbDB PORT DB DATABASE postgresDB USERNAME postgresDB PASSWORD postgresYour final env file should look like this APP NAME LaravelAPP ENV localAPP KEY base EB RhludascxYGVkIeHpoZTLtivQlZpVvQpQQ APP DEBUG trueAPP URL http localhostLOG CHANNEL stackLOG DEPRECATIONS CHANNEL nullLOG LEVEL debugDB CONNECTION pgsqlDB HOST dbDB PORT DB DATABASE postgresDB USERNAME postgresDB PASSWORD postgresBROADCAST DRIVER logCACHE DRIVER fileFILESYSTEM DISK localQUEUE CONNECTION syncSESSION DRIVER fileSESSION LIFETIME MEMCACHED HOST REDIS HOST REDIS PASSWORD nullREDIS PORT MAIL MAILER smtpMAIL HOST mailpitMAIL PORT MAIL USERNAME nullMAIL PASSWORD nullMAIL ENCRYPTION nullMAIL FROM ADDRESS hello example com MAIL FROM NAME APP NAME AWS ACCESS KEY ID AWS SECRET ACCESS KEY AWS DEFAULT REGION us east AWS BUCKET AWS USE PATH STYLE ENDPOINT falsePUSHER APP ID PUSHER APP KEY PUSHER APP SECRET PUSHER HOST PUSHER PORT PUSHER SCHEME httpsPUSHER APP CLUSTER mtVITE PUSHER APP KEY PUSHER APP KEY VITE PUSHER HOST PUSHER HOST VITE PUSHER PORT PUSHER PORT VITE PUSHER SCHEME PUSHER SCHEME VITE PUSHER APP CLUSTER PUSHER APP CLUSTER ️Note note that instead of an ip address we use the name of the service db as the host This is because we will use Docker Compose to run the application and the database This is how Docker knows how to connect the two services of course they should be in the same network Create the resource structureWe will create a Player resource This resource will have the following fields id autoincremented name string email string php artisan make model Player mThis created a Player php file in App Models and a create players table php file in database migrations Open the Player php file and replace it with the following lt phpnamespace App Models use Illuminate Database Eloquent Factories HasFactory use Illuminate Database Eloquent Model class Player extends Model use HasFactory add name and email to fillable protected fillable name email Open the create players table php file in the database migrations folder and replace it with the following lt phpuse Illuminate Database Migrations Migration use Illuminate Database Schema Blueprint use Illuminate Support Facades Schema return new class extends Migration Run the migrations public function up void Schema create players function Blueprint table table gt id table gt string name table gt string email table gt timestamps Reverse the migrations public function down void Schema dropIfExists players Now create a file called PlayerController php in the App Http Controllers folder and add the following lt phpnamespace App Http Controllers use App Models Player use Illuminate Http Request class PlayerController extends Controller Display a listing of the resource public function index get all players players Player all return JSON response with the players return response gt json players Store a newly created resource in storage public function store Request request validatedData request gt validate name gt required string email gt required string player Player create validatedData return response gt json player Display the specified resource public function show Player player return JSON response with the player return response gt json player Update the specified resource in storage public function update Request request Player player validatedData request gt validate name gt required string email gt required string player gt update validatedData return response gt json player Remove the specified resource from storage public function destroy Player player player gt delete return response gt json null Last open the routes api php file and add the following at top of the file use App Http Controllers PlayerController And this at the bottom of the file Route get players PlayerController class index Route post players PlayerController class store Route get players player PlayerController class show Route put players player PlayerController class update Route delete players player PlayerController class destroy The api php file should look like this lt phpuse Illuminate Http Request use Illuminate Support Facades Route use App Http Controllers PlayerController API Routes Here is where you can register API routes for your application These routes are loaded by the RouteServiceProvider and all of them will be assigned to the api middleware group Make something great Route middleware auth sanctum gt get user function Request request return request gt user Route get players PlayerController class index Route post players PlayerController class store Route get players player PlayerController class show Route put players player PlayerController class update Route delete players player PlayerController class destroy DockerizationNow let s dockerize the application We will use docker compose to run the application We will create a Dockerfile and a docker compose yml file DockerfileCreate a new file called Dockerfile in the root of the project Add the following content explanation is in the comments FROM php RUN apt get update amp amp apt get install y libpq dev amp amp docker php ext install pdo pdo pgsqlWORKDIR var www htmlCOPY RUN chown R www data www data var www html storage var www html bootstrap cacheCMD php artisan serve host port Explanation of the Dockerfile FROM php this is the base image that we will use We will use the official php image with version RUN apt get update amp amp apt get install y this is the command that will be executed when the image is built We will update the apt package manager and install the libpq dev package RUN docker php ext install pdo pdo pgsql this is the command that will be executed when the image is built We will install the pdo and pdo pgsql extensions WORKDIR var www html this is the working directory of the container All the commands will be executed from this directory COPY this is the command that will be executed when the image is built We will copy all the files from the current directory to the working directory of the container RUN chown R www data www data this is the command that will be executed when the image is built We will change the owner of the storage and bootstrap cache directories to www data CMD php artisan serve host this is the command that will be executed when the container is started We will start the php artisan serve command docker compose ymlLet s create the docker compose yml file at the root of the project Add the following content version services laravelapp container name laravelapp image francescoxx laravelapp build ports env file env depends on db db container name db image postgres ports environment POSTGRES USER postgres POSTGRES PASSWORD postgres POSTGRES DB postgres volumes db data var lib postgresql datavolumes db data Explanation of the docker compose yml file version this is the version of the docker compose file services this is the section where we will define the services that we want to run laravelapp this is the name of the service container name laravelapp this is the name of the container image francescoxx laravelapp this is the name of the image that we will use We will use the image that we created in the previous step Replace francescoxx with your DockerHub usernamebuild this is the path of the Dockerfile We will use the Dockerfile that we created in the previous step ports this is the section where we will define the ports that we want to expose this is the port that we want to expose We will expose the port of the container to the port of the host env file this is the section where we will define the environment variables that we want to use env this is the path of the env file We will use the env file that we created in the previous step depends on this is the section where we will define the services that we want to run before this one db this is the name of the service that we want to run before this one db this is the name of the service container name db this is the name of the container image postgres this is the name of the image that we will use We will use the official postgres image with version ports this is the section where we will define the ports that we want to expose this is the port that we want to expose We will expose the port of the container to the port of the host environment this is the section where we will define the environment variables that we want to use Now it s time to build the image and run the services containers Build and run the projectNow we can build and run the project Run the Postgres databaseFirst we need to run the Postgres database docker compose up d dbTo check if it s running you can use the following command docker compose logsand thedocker ps aIf the output is like the following one you are good to go You should see something like that you are good to go As additional test you can connect to the database using TablePlus or any other database client You can create a new connection using the following parameters Host localhostPort Database postgresUser postgresPassword postgresThen click on the Test Connection button The database is connected but emptt for now ️Build the projectTo build the project type docker compose buildAnd the output should be something like that ️Run the projectNow we can run the project docker compose up laravelappAnd this should be the output Apply the migrationsNow we need to apply the migrations docker compose exec laravelapp php artisan migrateNow it s time to test the project Test the projectNow we can test the project We will use Postman but you can use any other tool Create a playerTo create a new player make a POST request to localhost api player The body of the request should be like that name aaa email aaa mail The output should be something like that Let s create two more players make a POST request to localhost api player name bbb email bbb mail name ccc email ccc mail Get all playersTo get all players make a GET request to localhost api player The output should be something like that Get a playerTo get a player make a GET request to localhost api players id For example GET request to localhost api players The output should be something like that Update a playerTo update a player make a PUT request to localhost api players id For example PUT request to localhost api players The body of the request should be like that name NEW email MODIFIED mail The output should be something like that Delete a playerTo delete a user make a DELETE request to localhost api players id For example DELETE request to localhost api players On Postman you should see something like that Final testAs a final test we can check the database using TablePlus Create a new connection using the following parameters Host localhostPort Database postgresUser postgresPassword postgresThen click on the Connect button at the bottom right As you can see we have a players table with records ConclusionWe made it We have built a CRUD Rest API in PHP using Laravel PHP framework Composer PHP package manager Postgres database DockerDocker ComposeIf you prefer a video version All the code is available in the GitHub repository link in the video description That s all If you have any question drop a comment below Francesco |
2023-04-23 06:03:54 |
海外ニュース |
Japan Times latest articles |
Japan order to shoot down North Korean rocket dramatic, but intercept unlikely |
https://www.japantimes.co.jp/news/2023/04/23/national/north-korea-satellite-japan-shootdown-analysis/
|
Japan order to shoot down North Korean rocket dramatic but intercept unlikelyExperts say the order to shoot down any falling North Korean rocket components is more about reassuring a nervous public than actually intercepting them |
2023-04-23 15:53:00 |
海外ニュース |
Japan Times latest articles |
In Nagano, an excavation of Japan’s ancient elephant looks to rewrite history |
https://www.japantimes.co.jp/news/2023/04/23/national/naumanns-elephant-nagano-dig-history-climate/
|
In Nagano an excavation of Japan s ancient elephant looks to rewrite historyResearchers are looking for clues on how Naumann s elephant went extinct with findings having the potential to shift understanding of humankind s presence in Japan |
2023-04-23 15:48:33 |
海外ニュース |
Japan Times latest articles |
China lodges complaint over South Korean president’s ‘erroneous’ Taiwan remarks |
https://www.japantimes.co.jp/news/2023/04/23/asia-pacific/china-protest-south-korea-yoon/
|
China lodges complaint over South Korean president s erroneous Taiwan remarksSouth Korean leader Yoon Suk yeol said tension around Taiwan is part of an attempt to change the status quo by force and he opposed such |
2023-04-23 15:29:21 |
海外ニュース |
Japan Times latest articles |
U.S. military evacuates diplomats from Sudan as conflict rages |
https://www.japantimes.co.jp/news/2023/04/23/world/us-sudan-evacuation/
|
U S military evacuates diplomats from Sudan as conflict ragesThe mission ordered by President Joe Biden saw special operations forces positioned kilometers away in Djibouti bring the Americans out on MH Chinook helicopters |
2023-04-23 15:21:58 |
海外ニュース |
Japan Times latest articles |
G7 farm ministers condemn Russia for war’s impact on food security |
https://www.japantimes.co.jp/news/2023/04/23/national/g7-farm-meeting/
|
G farm ministers condemn Russia for war s impact on food securityThe Group of Seven farm ministers condemned Russia for its war against Ukraine and the impact the conflict has had on global food security |
2023-04-23 15:10:01 |
ニュース |
BBC News - Home |
Sudan fighting: US military evacuates diplomats from Khartoum |
https://www.bbc.co.uk/news/world-africa-65363586?at_medium=RSS&at_campaign=KARANGA
|
biden |
2023-04-23 06:11:45 |
ニュース |
BBC News - Home |
Looking after tiny islands 'best job in the world' |
https://www.bbc.co.uk/news/uk-scotland-highlands-islands-65335459?at_medium=RSS&at_campaign=KARANGA
|
scottish |
2023-04-23 06:42:36 |
コメント
コメントを投稿