投稿時間:2021-08-21 08:37:22 RSSフィード2021-08-21 08:00 分まとめ(50件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
TECH Engadget Japanese Android 12のChromeブラウザ、複数ウィンドウ管理に正式対応へ https://japanese.engadget.com/android-12-chrome-223013959.html xdadevelopers 2021-08-20 22:30:13
TECH Engadget Japanese デザイン一新!見やすくなったSafariの使い方を解説:iPhone Tips【iOS 15パプリックベータ】 https://japanese.engadget.com/ios15-safari-221030843.html iphonetips 2021-08-20 22:10:30
IT ITmedia 総合記事一覧 [ITmedia ビジネスオンライン] 日本初! 電動バイク専用インドアスポーツ施設がイオン海老名にオープン https://www.itmedia.co.jp/business/articles/2108/21/news037.html etrailpark 2021-08-21 07:14:00
TECH Techable(テッカブル) 好きな音楽と自分のトークで番組制作! Spotifyの「Music + Talk」 https://techable.jp/archives/160210 musictalk 2021-08-20 22:00:13
python Pythonタグが付けられた新着投稿 - Qiita GCP ; API GCPのText to Speech API を利用しナレーションを作成する https://qiita.com/sf9/items/d433a500a6eaf6a786f4 2021-08-21 07:38:02
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) ポインタ渡しのstring型引数で文字列の部分的操作方法 https://teratail.com/questions/355359?rss=all ポインタ渡しのstring型引数で文字列の部分的操作方法関数にポインタでstring型の引数を渡し、その引数の文字列を操作したいです。 2021-08-21 07:54:56
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) PHP 応答ヘッダのX-Powered-Byを開発ツールの表示上から消すには https://teratail.com/questions/355358?rss=all 2021-08-21 07:41:01
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) css_selectorでブラウザにあるクラス名(空白なし)をコピペしても、「そのようなelementはありません」と出てしまいます。 https://teratail.com/questions/355357?rss=all cssselectorでブラウザにあるクラス名空白なしをコピペしても、「そのようなelementはありません」と出てしまいます。 2021-08-21 07:18:10
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 単体テストで引数がnullのパターンを実施する理由がわかりません https://teratail.com/questions/355356?rss=all 単体テスト 2021-08-21 07:09:46
GCP gcpタグが付けられた新着投稿 - Qiita GCP ; API GCPのText to Speech API を利用しナレーションを作成する https://qiita.com/sf9/items/d433a500a6eaf6a786f4 2021-08-21 07:38:02
技術ブログ Developers.IO SnowflakeでJSONをフラット化するビューを自動で作成する https://dev.classmethod.jp/articles/snowflake-auto-json-to-relational/ snowflake 2021-08-20 22:40:39
海外TECH Ars Technica Report: Pfizer’s COVID-19 vaccine may get full FDA approval Monday https://arstechnica.com/?p=1788948 approval 2021-08-20 22:38:28
海外TECH Ars Technica US sees jump in vaccinations amid devastating delta surge https://arstechnica.com/?p=1788941 vaccine 2021-08-20 22:03:53
海外TECH DEV Community Computer networking in 5 minutes: Static IP vs dynamic IP https://dev.to/educative/computer-networking-in-5-minutes-static-ip-vs-dynamic-ip-1pen Computer networking in minutes Static IP vs dynamic IPIP addresses are an essential part of computer networking They play an important role in sending and receiving information on the internet Every device that connects to an internet network has an IP address which means there are billions of IP addresses that exist Today we re going to discuss IP addresses how they work static IP vs dynamic IP and more We ll cover What is an IP address How does an IP address work Static IP addressesDynamic IP addressesStatic IP vs dynamic IPWrapping up and next steps What is an IP address An Internet Protocol address or IP address is a unique identifier assigned to every device on a TCP IP network The Internet Protocol is the set of rules that outlines how data should be transported across the internet or local networks IP addresses help identify devices and allow them to communicate with each other Internally IP addresses are stored as numbers The Domain Name System DNS allows us to use words to identify different servers on the internet such as an application server or website When we type a URL into our search bar DNS looks up that domain s IP address and returns it to our network device There are two main versions of IP addresses IPv and IPv IP addresses are strings of four numbers separated by characters For example an IP address could look like this They re produced by a division of the Internet Corporation for Assigned Names and Numbers to help make the internet more secure and accessible We can think of IP addresses as physical home addresses We can exchange addresses with friends and family Those addresses give us a destination that allows us to communicate with friends and family through different communication methods like birthday cards letters and more How does an IP address work All devices communicate with one another using the Internet Protocol IP Here s how it works Before our devices connect to the internet they connect to a network that s connected to the internet This network gives us access to the internet For example the network that we use at home will most likely be our Internet Service Provider ISP After this our ISP will assign an IP address to our device Our internet activity will go through the ISP and then be routed back to us using our assigned IP address If we leave our home and take our personal device with us our IP address from our home network doesn t come with us Let s say we go to a hotel When we want to use the internet at the hotel we d probably connect to their Wi Fi network Since we re using a new network we re temporarily assigned a new IP address This temporary IP address is assigned to us by the hotel s ISP Can our IP addresses change Yes they can If we turn our modem or router off our IP address may change We can also contact our ISP to change our IP address This is one of the reasons why DNS is so important Instead of directly informing others when our IP address changes we can directly inform our DNS server This means that any other device that contacts the DNS server will get the updated information for the new IP address Static IP addressesA static IP address is an IP address that doesn t change Our static IP addresses usually stay the same unless our network architecture changes or our devices are out of commission Static IP addresses are typically used for servers or other important networking equipment They re popular within business settings because they ensure that the devices connected to them keep a consistent address They also work well for remote access solutions A static IP address is assigned to a device by an ISP Typically static IP addresses add to the cost of your internet service Dynamic IP addressesA dynamic IP address is an IP address that can regularly change An ISP will buy a large number of dynamic IP addresses and assign them to their customer s devices Dynamic IP addresses are often reassigned Reassigning IP addresses helps internet providers save money and ensure a higher level of security It also means that they don t need to take the time to reestablish any network connections if we go on a vacation or move to a new location Dynamic IP addresses are more common for consumer equipment and personal use A dynamic IP address is assigned to a device by our ISP s Dynamic Host Configuration Protocol DHCP servers The DHCP server typically uses network routers to assign addresses to devices Static IP vs dynamic IPThere s not always a clear answer when it comes to deciding between a static or a dynamic IP address When choosing between the two it s important to consider your connection environment In other words static IP addresses tend to be better for businesses while dynamic IP addresses tend to be better for personal or home networks Let s take a look at some of the pros and cons of static and dynamic IP addresses Static IP addressesProsRemote access Static IP addresses make it easy for us to work remotely using a Virtual Private Network VPN Server hosting Static IP addresses make it easy for people to find us using DNS DNS support With static IP it s easier to manage DNS servers Geolocation services With static IP addresses our geolocation services are more accurate This is because our services will match the IP address to its physical location Reliable connection A static IP address is fixed which typically results in a more reliable connection Easy to find A static IP address can make it easier to find specific devices on a network ConsSecurity concerns With a static IP address anyone with the proper tools can find where our devices are located VPNs can help with this Cost Static IP addresses are not as cost effective as dynamic IP addresses Typically ISPs charge more for them Dynamic IP addressesProsEasy configuration DHCP servers automatically assign IP addresses to our devices so we don t need to worry about setting it up ourselves Cost Dynamic IP addresses are usually cheaper than static IP addresses Unlimited IP addresses Dynamic IP addresses can be reused Whenever our devices need a new dynamic IP address our network or router can automatically configure them for us Security Dynamic IP addresses make it more difficult for potential attackers to locate our networked devices This is because dynamic IP addresses can change frequently so it s harder to track a device This helps with physical and online security We can also increase our security measures by using a VPN ConsDNS compatibility If we wanted to host an email server for example it may be difficult to use a dynamic IP address because DNS doesn t work well with dynamic IP addresses We could use a dynamic DNS service but those tend to be expensive Remote connectivity If we don t have the proper remote access software it ll be difficult to connect using a dynamic IP address A VPN can help with this Increased downtime Sometimes our ISP can t assign us a dynamic IP address This can slow down our internet connection Inaccurate geolocation Dynamic IP addresses may affect our geolocation services because our IP address may not reflect our physical location Wrapping up and next stepsToday we took a closer look at IP addresses and discussed what they are and how they work IP addresses are an important part of computing networking because they allow our devices to properly communicate with other devices Static and dynamic IP addresses are the two types of IP addresses with different purposes It s often said that static IP addresses are better for businesses and dynamic IP addresses are better for personal use We covered a lot today but there s still so much more to learn Some recommended topics to cover next include DNS serversNetwork addressesFirewallsRouting in IPTo get started learning these concepts and a lot more check out Educative s course Grokking Computer Networking for Software Engineers This hands on course will teach you the fundamentals of networks socket programming in Python command line tools and much more By the end you ll have a deeper understanding of computer networking essentials Happy learning Continue reading about networkingWhat is the OSI model layers explained in detailComputer networking Terms tools and getting startedBehind the scenes What happens when you type a URL in a browser 2021-08-20 22:29:29
海外TECH DEV Community JavaScript Execution Context https://dev.to/harshvardhan22/javascript-execution-context-57gc JavaScript Execution ContextJavaScript is a beautiful language since it is loosely typed it is super easy to start coding with it But to take full advantage of this powerful language one should always know the basics and what else is a better place to start than the execution context I am writing this article to help people who are beginners or at intermediate level so I will try to explain everything in the simplest way possible Let s begin Execution context is a box that is created every time a javascript code is executed The box is divided into two parts memory creation and code execution Lets take a simple code to understand what goes inside these parts of execution context box var x calculates the cubic value of input function cube input var result input input input return var var cubeFive cube x var cubeTwo cube Step A global execution context is created which has the global object window global variable this and functions inside it JavaScript is a synchronous single threaded language means the code is executed line by line one at a time you can think of this as a pointer that moves from top to down the code file and the line at which this pointer is pointing gets executed All the variables are assigned a value undefined in memory creation phase and all the function definitions are stored the way they are written i e the exact code of the function is stored against the function name Step Our pointer starts the memory creation phase Step Pointer points at line finds a variable x and assigns undefined to it Step Pointer points to line finds a function definition cube and it stores the code as a value of cube Step Pointer points at line finds a variable cubeFive and assigns undefined to it Step Pointer points at line finds a variable cubeTwo and assigns undefined to it Step Now code execution phase begins and the code is executed line by line Step Our pointer starts executing the code first it points at line of code where the value of x which was assigned undefined in step is now assigned its original value i e Step Pointer comes at line where it finds a function definition so it does nothing and moves further ahead Step Pointer comes at line again finds a variable cubeFive but here the value is nothing but a function call So a very interesting thing happens here a new box i e execution context is created which again has two parts memory creation and code execution Step Now the pointer goes to the function definition at line and starts to do the same steps from inside the newly created execution context Step Now when the function returns the value at line that particular value is stored in the variable cubeFive at line Step After this step the new box that was created is now destroyed and all the things inside it like variables and function definitions are also destroyed Step Pointer comes at line again finds a variable cubeTwo and same steps are repeated again A new box is created the pointer goes to the function definition After it returns a value to the variable at line the box is deleted and pointer is now again pointing at line Step Since there is no code left to be executed the global execution that was created at step is also deleted now and yes all the variables and function definitions are also deleted with it Congratulations now you know the concept of execution context And this is how a JavaScript code is executed This very concept of execution context the forms the fundamental logic behind more advanced concepts like hoisting call stack closures etc Keep learning Cheers 2021-08-20 22:18:47
海外TECH DEV Community Some soft skills that we should keep in mind and remember often ✨ https://dev.to/antoomartini/some-soft-skills-that-we-should-keep-in-mind-and-remember-often-2da7 Some soft skills that we should keep in mind and remember often Some things I learned and some things I am still learning Once my mentor told me that soft skills are very important and before programmers we are people we are humans So it s good to remember these tips often Ask dummy questions There are a million technologies And you re not expected to know them all so ask I don t understand what these words mean From what source can I read about this Remember there are no dummy questions only fools who don t ask Be kindThe IT world is full of hostile opinions and we all want the best results That is not why you have to become an unpleasant and arrogant person Radiate kindness You re going to go far Take advantage of what other people are doingLook for existing solutions before starting a task Understand the coding paradigms used Look at your team s code Present your solution in the best way Fight for diversityIt is important the participation of women in IT an Tech It s vital to add diversity and a new perspective in the area Encourage the participation of diversity in your team This makes the technology more reliable and not reflect only the world and the view from men Do the right thingCode is art And you are the artist of course Every task is an opportunity to write beautiful and elegant code Take the opportunity and become a professional Take pride in your work don t just make it work Make it work the best way you can Find your way fight for yourselfSome tasks have a big impact on job advancement or promotions Others not so much You have to do your best at both But your day should start with the high impact task Fight for yourself make yourself grow no one else will do it for you Look for critics in your code Make code review Review your code as much as possible the more constructive feedback you get the faster you will learn and grow Put your ego asideYour colleagues are unique and talented with experiences and super smart Be empathetic be open minded learn from your team even when they are wrong Take initiativeLook for opportunities to improve process and experience development of your team and project Improve documentation learn from your mentors and teach others Be a mentor too Become the person you wanted to have as a mentor when you started as a junior Throw yourself into the fireWe will never be ready to work on large projects or new features deploy in production manage implementations the best way to prepare for them is to do them You will expand your comfort zone And you ll grow a lot Intention always intention It doesn t matter if you spent hours to solve something and you did it wrong Maybe it takes so much time Delete and start again And again Make sure that behind every line of code there is purpose intention and clarity What other advice would you give 2021-08-20 22:14:08
海外TECH DEV Community Open sourced react eccomerce web app with PayPal checkout https://dev.to/abodmicheal/open-sourced-react-eccomerce-web-app-with-paypal-checkout-404b Open sourced react eccomerce web app with PayPal checkoutGithub live project 2021-08-20 22:12:58
海外TECH DEV Community Rails on Kubernetes with Minikube and Tilt https://dev.to/ndrean/rails-on-kubernetes-with-minikube-and-tilt-25ka Rails on Kubernetes with Minikube and TiltWe expose lengthy notes on Kubernetes manifests We use them to deploy a full stack Rails app on a local Kubernetes cluster powered by Minikube with the help of Tilt no Helm charts just plain Kubernetes yaml manifests To orchestrate the containers with Kubernetes you build and push images and then deploy manually on the local cluster We will use Tilt to orchestrate the local deployment it just needs the Dockerfiles the Kubernetes manifests and a Tiltfile to conduct the deployment It also automatically builds the images and recompiles them on code change a cool tool You can also add Starlark code In a following post we will use another tool GruCloud It is designed to go live in the cloud you can deploy on Minikube as well You can select the main providers AWS EKS or GCC or Azure for example It uses the more familiar Javascript language instead Demo app Vocabulary Local Kubernetes cluster with persistent volumes Postgres Web Server Nginx Redis Rails Cable and Sidekiq Access to the Kubernetes API Run with Tilt on a Minikube cluster TiltfileJobTilt UIMetrics amp Kubernetes dashboardAuto scaling Misc files The Demo appWe want to run on Kubernetes a very simple app to visualise the load balancing of the pods as scaled It uses the classic full stack tooling PostgreSQL Redis background job framework Sidekiq web sockets with ActionCable and a web server Nginx in front of Rails It broadcasts the number of page hits and a click counter to any other connected browser It also connects to the Kubernetes API to broadcast the existing pods ID on every new connection or page refresh the counters of the existing pods are refreshed and broadcasted Vocabulary DeploymentWe use a Deployment for a stateless processes This wraps the ReplicaSet controller it guarantees the number of living pods and enables rolling updates or rolling back The pods englobe the containers This Russian doll nesting explains the way manifests are built with matching labels When a pod is deployed with a Deployment then if you try to delete a pod a new one will be created because of the ReplicaSet It will aim to recreate one unless you set the count to zero You should delete the Deployment instead StatefulSetStateful processes typically databases should be deployed as a StatefulSet We will use local storage here but in real life we would use network attached storage or cloud volumes or managed database services as databases should be clustered for high availability and disaster recovery This is used because there is a master slave relation to sync the pods with a unique indexing A StatefulSet comes with a PersistentVolumeClaim and a PersistentVolume ServicesA pod needs a service to be able to communicate with the cluster s network Every service is a load balancer but unless described with spec type NodePort all are internal services of default type ClusterIP meaning no access from outside the cluster We don t use an Ingress controller The entry point of the app is via Nginx thus we want the Nginx service to be external Ephemeral volumes with podsWe can illustrate the host based ephemeral volume emptyDir with the side car pattern where Nginx and Rails are in the same pod They also share the same network spec volumes name shared data emptyDir spec containers name nginx image nginx alpine volumeMounts name shared data mountPath usr share nginx html name rails image usr rails base volumeMounts name shared data mountPath publicWe then just use the naked Nginx official image since the config will be passed with another volume the ConfigMap We will use a separate pod for Nginx in front of Rails ConfigsAll environment variables and configs will be set by Kubernetes thus externalised Data is passed to the pods with volumes such as ConfigMap and Secret Readiness and LivenessA pod may need a readiness and or liveness probe The first means that we have a signal when the pod is ready to accept traffic and the second is when a pod is dead or alive By default everything is green For example the readiness probe of the Rails pod sends an HTTP request to an internal endpoint The method ready is render json status readinessProbe httpGet path ready port scheme HTTP initialDelaySeconds periodSeconds timeoutSeconds Ks EVENT Pod rails dep bbbb kxp ns test Readiness probe failed Get ready dial tcp connect connection refused ResourcesYou can monitor the resources with the Kubernetes dashboard They are CPU consumption measured in vCPU Core m lt gt memory measured in mega bytes or use the command kubectl describe node minikube VSCode Kubernetes extension parser complains if you don t set up limits You may find the correct values by retroaction For example resources requests memory Mi cpu m limits cpu m memory Mi ScalingsourceIf you wish to modify the number of replicas of a process you simply run scale kubectl scale deploy sidekiq dep replicas kubectl get rs wand you watch the ReplicaSet working With these measures but not only Kubernetes can perform horizontal autoscaling kubectl autoscale deploy rails dep min max cpu percent This means that Kubernetes can continuously determine if there is a need for more or fewer pods running We can use external metrics a popular example is monitoring with Prometheus and the usage of a Redis queue length to monitor processes like Sidekiq No log collector is implemented here Rolling update and backYou can change for example the image used by a container named backend below kubectl set image deploy rails dep backend usr rails base then check kubectl rollout status deploy rails dep orkubectl get rs wand in case of crash looping for example you can roll back kubectl rollout undo deploy rails depWe can also make canary deployments by putting labels ️ Local Kubernetes cluster with persistent volumesWe will use one image named usr rails base here For production deployment we would use the URL of a repository in a container registry e g ECR This image is a two stage built image It is used by Rails Sidekiq and Cable with different commands The Nginx pod will also use it to extract the static assets and the migration Job will use it too It is run without root privileges In the development mode we won t tag it since Tilt will timestamp it We will also use a local Role i e not a ClusterRole to access to the k API All the env variables are passed with a ConfigMap or a Secret We will set up local volumes Postgres The standard PV available on the cluster is returned by the command kubectl get storageClass on the system This is an important topic in real life We will make two PVC and set two StatefulSet We bind a Persistent Volume PV admin role with a Persistent Volume Claim PVC dev role pg dep ymlapiVersion vkind Servicemetadata name pg svc labels app pg lt must match with the podspec ports protocol TCP port lt service port opened for Rails selector the set of pods with the name pg is targeted by this service app pg DeploymentapiVersion apps vkind StatefulSetmetadata about the deployment itself Gives a name of the DEPLOYMENT name pg dep labels app pgspec of the deployment serviceName pg dep replicas selector the deployment must match all pods with the label app pg matchLabels the label for the POD that the deployment is targeting app pg match spec template labels for the pod template blue print of a pod metadata name pg pod label for the POD that the deployment is deploying labels app pg match spec selector matchlabels spec volumes name pg pv must match PV persistentVolumeClaim claimName pg pvc must match PVC containers name pg container image postgres alpine imagePullPolicy IfNotPresent resources limits memory Mi cpu m ports containerPort volumeMounts mountPath PGDATA name pg pv must match pv readOnly false envFrom configMapRef name config secretRef name secrets we bind the resource PV to the podapiVersion vkind PersistentVolumeClaimmetadata name pg pvcspec storageClassName standard accessModes ReadWriteMany resources requests storage Miand the volume pg db pv ymlapiVersion vkind PersistentVolumemetadata name pg pv labels app pgspec storageClassName standard capacity storage Mi accessModes ReadWriteMany hostPath for Minikube emulate net attached vol path tmp data ️ Webserver Nginx We use the web server image and set an external service for the Nginx deployment since this is the entry point of the app nginx dep ymlapiVersion apps vkind Deploymentmetadata name nginx dep labels app nginxspec replicas selector matchLabels app nginx strategy type RollingUpdate rollingUpdate maxUnavailable maxSurge template metadata labels app nginx spec containers image usr nginx ws imagePullPolicy Always name frontend ports containerPort resources limits cpu m memory Mi volumeMounts mountPath etc nginx conf d mount nginx conf volume to etc nginx readOnly true name nginx conf volumes name nginx conf configMap name nginx conf place ConfigMap nginx conf on etc nginx items key myconfig conf path default conf apiVersion vkind Servicemetadata name nginx svc labels app nginxspec type LoadBalancer NodePort LoadBalancer lt external service selector app nginx ports protocol TCP port exposed by the container port the port the app is listening on targetPort targetPort nodePort This illustrates the use of a ConfigMap volume to pass the Nginx config via a mountPath into the pod source nginx conf ymlapiVersion vkind ConfigMapmetadata name nginx confdata myconfig conf upstream puma server rails svc keepalive access log dev stdout main error log dev stdout info server listen default server root usr share nginx html try files uri puma access log off gzip static on expires max add header Cache Control public add header Last Modified add header Etag location puma proxy set header X Forwarded For proxy add x forwarded for proxy set header X Forwarded Host http host proxy set header Host http host proxy pass header Set Cookie proxy redirect off proxy pass http puma location cable proxy http version proxy set header Upgrade http upgrade proxy set header Connection Upgrade proxy pass http cable svc error page html error page html location x html root usr share nginx html ️ Redis For the Redis store we didn t pass a config here We should have used a ConfigMap redis dep ymlapiVersion vkind Servicemetadata name redis svcspec ports port targetPort name client selector app redis apiVersion apps vkind StatefulSetmetadata name redis dep labels app redis match spec template labelsspec serviceName redis selector matchLabels app redis replicas template metadata name redis pod labels app redis match spec selector matchLabels spec containers name redis image redis alpine imagePullPolicy IfNotPresent ports containerPort command redis server resources limits cpu m memory Mi readinessProbe exec command redis cli ping initialDelaySeconds periodSeconds timeoutSeconds volumeMounts name data mountPath data readOnly false volumeClaimTemplates metadata name data spec accessModes ReadWriteMany storageClassName standard resources requests storage Miand the PersistentVolume redis pv ymlapiVersion vkind PersistentVolumemetadata name data labels type local app dataspec storageClassName hostpath capacity storage Mi accessModes ReadWriteMany hostPath for Minikube to emulate net attached vol path data ️ Rails Again all ENV vars and credentials will be set within Kubernetes We will use two volumes a ConfigMap for the ENV vars and a Secret for credentials config yml rails dep ymlapiVersion vkind ConfigMapmetadata name configdata POSTGRES HOST pg svc lt name of the service that exposes the Postgres pod POSTGRES DB kubedb RAILS ENV production RAILS LOG TO STDOUT true RAILS SERVE STATIC FILES false REDIS DB redis redis svc REDIS SIDEKIQ redis redis svc REDIS CACHE redis redis svc REDIS CABLE redis redis svc The credentials need to be converted with echo n un coded value base This can be documented with a manifest secrets ymlapiVersion vkind Secretmetadata name secretstype Opaquedata POSTGRES USER cGzdGdyZXM postgres POSTGRES PASSWORD ZGjaVycGFzcdvcmQ dockerpassword RAILS MASTER KEY NWEYmUMzVjNmViODdhMWENTAMYYTRjYWNjYTg The manifest of the Rails deployment and its service rails dep ymlapiVersion apps vkind Deploymentmetadata name rails dep labels must match the service app railsspec replicas selector matchLabels which pods are we deploying app rails strategy type RollingUpdate rollingUpdate maxUnavailable maxSurge template metadata labels must match service and replicaset matchlabel app rails spec containers name backend image usr rails base imagePullPolicy Always command bundle args exec rails server b ports containerPort resources limits cpu m memory Mi envFrom configMapRef name config secretRef name secrets readinessProbe httpGet path ready port scheme HTTP initialDelaySeconds periodSeconds timeoutSeconds apiVersion vkind Servicemetadata name rails svc labels app railsspec selector app rails type ClusterIP default type ports protocol TCP port exposed by the service port the port the app is listening on targetPort targetPort name http️ Cable and Sidekiq The deployment of the cable is identical except for the args for the command and port It has its service to expose the cable pod The worker deployment is also based on the same image with its own command and args but no service is required for the worker since it communicates with Rails via a Redis queue Cable cable dep ymlspec containers name cable image usr rails base imagePullPolicy Always command bundle args exec puma p cable config ru ports containerPort envFrom configMapRef name config secretRef name secrets resources limits cpu m memory Mi apiVersion vkind Servicemetadata name cable svc labels app cablespec selector app cable type ClusterIP default type ports protocol TCP port exposed by the service port the port the app is listening on targetPort targetPort name http Sidekiq sidekiq dep ymlspec containers name sidekiq image usr rails base imagePullPolicy Always command bundle args exec sidekiq C config sidekiq yml envFrom configMapRef name config secretRef name secrets resources limits cpu m memory Mi We can add a liveness probe by using the gem sidekiq alive ️ Calling the Kubernetes API As a normal user we have an admin user Service Account and an associated Cluster Role Binding Within a pod by default everything is closed so we need to set a ServiceAccount credential with the RBAC policy with Role RoleBinding and ServiceAccount to the Sidekiq deployment If we want to call the Kubernetes API the endpoint of kubectl get to get data from the cluster within our app we can directly access to the REST API The credentials are present in each pod so that we can read them within a thread or Sidekiq job we execute a CURL call to the apiserver whose result is parsed and filtered curl cacert cacert H Authorization Bearer token Note that the cacert is at the TLS level not at the HTTPS level do it from within a pod by tunnelling with kubectl proxy Since we need an endpoint we need to run a side car pod with a Kubernetes server This solution is more expensive a Kubernetes server is a Mb image running kubectl proxy port You run a side car k server with Sidekiq and call the endpoint from a Job URI open http localhost api v namespaces namespace pods Note that you may take profit from using the gem Oj for speeding up the JSON parsing We now can run async Ruby code to fetch the data within a thread Then to render in the browser we broadcast the result through a web socket and the listener will mutate a state to render with React Run this with TILTWe have Docker the Kubernetes CLI and Minikube installed A normal workflow is to build and push images from Dockerfiles and then let Kubernetes pull and run the manifests that use the images We can let Tilt do all this for us and be reactive to changes in the code Note that as a Rails user you may have the gem tilt present so alias tilt with usr local bin tilt Launch MinikubeWe may want to namespace the project so that you can isolate different versions or modes staging prod and also clean everything easily We used the utilities kubectx kubens to set the namespace kubectl create namespace test use the utility kubens from kubectx to assign a namespacekubens stage v check kubens gt stage v markedkubectl config get contexts gt Minikube markedA good practice is to apply kind NamespaceapiVersion vmetadata name stage vand then use namespace stage v in the metadata of each kind Now the project is isolated within a namespace we can launch Minikube with minikube start ️ List of filesOur files are app config public dckf builder Dockerfile alpine Dockerfile nginx DockefileTiltfile kube config yml secrets yml nginx config yml pg pv yml postgres dep yml redis pv yml redis dep yml rails dep yml sidekiq dep yml cable dep yml nginx dep yml migrate yml Deploy To deploy on the Minikube cluster once we have built and pulled the images we run the following commands against all our manifests in an orderly manner first run the configs and secrets needed by the others processes kubectl apply f kube config ymlkubectl apply f kube secrets yml kubectl apply f kube rails dep yml kubectl apply f kube migrate ymlminikube service nginx svc lt our app entry pointWe will automate all this with Tilt The Tilt engine will read a Tiltfile and build the full project It only needs the code the Dockerfiles and the Kubernetes manifests and one command In this Tiltfile we describe all the actions we want Tilt and Kubernetes to perform building images running manifests and managing dependencies The one below is a very basic image builder and runner Tilfile apply configs and create volumesks yaml kube config yml kube secrets yml kube nginx config yml kube pg db pv yml apply databases adaptersks yaml kube postgres dep yml kube redis dep yml lt building images and live changesdocker build builder lt Bob dockerfile dckf builder Dockerfile build args RUBY VERSION alpine NODE ENV production RAILS ENV production BUNDLER VERSION live update sync app app app docker build usr rails base lt uses Bob build args RUBY VERSION alpine RAILS ENV production RAILS LOG TO STDOUT true dockerfile docker rails Dockerfile live update sync app app app docker build usr nginx ws lt uses Bob dockerfile dckf nginx split Dockerfile build args RUBY VERSION alpine RAILS ENV production live update sync app app app gt end images dependenciesks resource sidekiq dep resource deps redis dep ks resource rails dep resource deps pg dep redis dep ks resource cable dep resource deps redis dep ks resource nginx dep resource deps rails dep apply processesks yaml kube rails dep yml kube sidekiq dep yml kube cable dep yml ks yaml kube nginx dep yml lt creates manual auto action button in the Tilt GUI migrationks resource db migrate resource deps rails dep pg dep trigger mode TRIGGER MODE MANUAL auto init False ks yaml kube split migrate yml auto amp manual display pods in GUIlocal resource All pods kubectl get pods resource deps rails dep sidekiq dep cable dep nginx dep gt allow ks contexts minikube ks resource nginx dep port forwards Notice the two stage build the image is only build once even if reused four times Notice also the live update to synchronise the code between the host and the container To run this tilt upor all in one unless you need to create the Postgres database run the Docker daemon open a Docker on OSX minikube start amp amp kubectl create ns test amp amp kubens test amp amp tilt upThen we need to migrate see below and with our settings we can navigate to http localhost to visualise the app For a quick clean up run as docker compose down tilt down orkubectl delete ns test Dependencies orderingWe specified resources dependencies with ks resource ️ Migration Job The topic of performing safe migrations is a very important subject of its own new migration on old code old migration with new code Every time you stop Minikube and Tilt you need to run a migration You can an initContainer that waits for the db or a Job migrate ymlapiVersion batch vkind Jobmetadata name db migratespec template spec restartPolicy Never containers name db migrate image usr rails base imagePullPolicy IfNotPresent command bundle exec rails db migrate envFrom secretRef name secrets configMapRef name configYou can run ks yaml kube migrate yml to apply this Alternatively you can do this programatically with Tilt with ks resource where you specify the needed dependencies and then apply with ks yaml Below is an example of the manual custom db migrate action With the two last flags we have an action button in the GUI to trigger this migration when ready ks resource db migrate resource deps rails dep pg dep trigger mode TRIGGER MODE MANUAL auto init False ks yaml kube split migrate yml Ks EVENT Pod db migrate vh ns test Successfully pulled image rails base in sMigrating to CreateCounters CreateCounters migrating create table counters gt s CreateCounters migrated s If needed run kubectl delete job db migrate to be able to run the job Using local resourceIf we want to list automatically the Rails pods we add a local resource in the Tiltfile As such it will be run automatically when Rails is ready This will also add a button in the UI that we can rerun on demand local resource Rails pods kubectl get pods l app rails o go template template range items metadata name n end o name resource deps rails dep ️ Tilt UI The Tilt UI comes in two flavours a terminal essentially an easy log collectora nice GUI at http localhost from which you can for example easily read the logs or trigger rebuilds ️ Kubernetes dashboard To enable the Kubernetes dashboard run minikube addons listminikube addons enable dashboardminikube addons enable metrics serverThe command minikube dashboard shows the full state of the cluster Just select the namespace We can see the logs for each pod and the resource consumption globally and per process Resources with kubectlThe command kubectl describe node minikubegives the details of the resource usage of the cluster HPA Once we have the measures we can start to autopilot selected processes with HorizontalPodAutoscaler We can run the command kubectl autoscalelocal resource hpa kubectl autoscale deployment rails dep cpu percent min max resource deps rails dep trigger mode TRIGGER MODE MANUAL auto init False or apply the manifest rails hpa ymlapiVersion autoscaling vkind HorizontalPodAutoscalermetadata name rails hpaspec scaleTargetRef apiVersion apps v kind Deployment name rails dep minReplicas maxReplicas targetCPUUtilizationPercentage metrics type Resource resource name cpu target type Utilization averageUtilization withks yaml kube rails hpa yml ks resource rails hap resource deps rails dep We can use simple load tests to check ️ Misc files Cheat sheet waiting pods checkingkubectl get pods w o wide follow the logs of a podkubectl logs rails nginx dep c rails f delete a deployment pod svc replicaset or jobkubectl delete deploy rails depkubectl delete job db migrate launch a browserminikube service rails nginx svc OSX launch the Kubernetes dashboardminikube dashboard ssh into the VM user docker private key minikube ssh generate a token which grants admin permissions kubectl namespace kubernetes dashboard describe secret kubectl n kubernetes dashboard get secret grep admin user awk print sshssh i minikube machines minikube id rsa docker minikube ip get programmatically infokubectl get service nginx svc o jsonpath spec ports nodePort execute a command in a pod with several containers name it with c kubectl exec it rails nginx dep c rails irb irb main gt require socket Socket gethostname gt rails nginx dep bcfdc wg execute a command in a pod kubectl exec it pg dep psql w U postgreskubectl exec it redis dep redis cli rolling update by setting a new image to a deploymentkubectl set image deployment rails dep usr rails base checkkubectl rollout status deployment rails dep undo in case of a problemkubectl rollout undo depoyment rails dep️ Builder ARG RUBY VERSION alpineFROM ruby RUBY VERSION alpine AS builderARG BUNDLER VERSIONARG NODE ENVARG RAILS ENVRUN apk U upgrade amp amp apk add no cache postgresql dev nodejs yarn build base tzdataENV PATH app bin PATHWORKDIR appCOPY Gemfile Gemfile lock package json yarn lock ENV LANG C UTF BUNDLE JOBS BUNDLE RETRY BUNDLE PATH vendor bundle RUN gem install bundler BUNDLER VERSION no document amp amp bundle config set without development test amp amp bundle install quiet RUN yarn check files silent production amp amp yarn cache cleanCOPY RUN bundle exec rails webpacker compile assets clean Rails Dockerfile FROM builder AS bobFROM ruby RUBY VERSION alpine ARG RAILS ENVARG NODE ENVARG RAILS LOG TO STDOUTRUN apk U upgrade amp amp apk add no cache libpq tzdata netcat openbsd amp amp rm rf var cache apk disabled password doesn t assign a password so cannot loginRUN adduser disabled password app userUSER app userCOPY from bob chown app user app app COPY from builder app appENV RAILS ENV RAILS ENV RAILS LOG TO STDOUT RAILS LOG TO STDOUT BUNDLE PATH vendor bundle WORKDIR appRUN rm rf node modules Web server Dockerfile nginx ws DockerfileFROM ndrean builder AS bobFROM nginx alpineCOPY from bob app public usr share nginx html️ Simple load test You can run a simple load test kubectl run i tty load generator rm image busybox restart Never bin sh c while sleep do wget q O http localhost done If we have a domain we can also use the ab Apache Bench we test here how fast the app can handle requests with a maximum of requests running concurrently ab n c ️ sources DockerKubernetesYoutube Marcel Dempers and Youtube Techworld with NanaHappy coding 2021-08-20 22:09:25
Apple AppleInsider - Frontpage News 'Tetris Beat' for Apple Arcade brings new twist to classic tile-matching gameplay https://appleinsider.com/articles/21/08/20/tetris-beat-for-apple-arcade-brings-new-twist-to-classic-tile-matching-gameplay?utm_medium=rss x Tetris Beat x for Apple Arcade brings new twist to classic tile matching gameplayApple Arcade scored another enviable exclusive this week with the launch of Tetris Beat a fresh take on the classic tile matching game that introduces new rhythm mechanics clean graphics and an eclectic lineup of music The game features three game modes the first of which ーDrop mode ーhas players rotate and drop Tetriminos to the beat with the goal of building large combos to achieve high scores Tap mode offers more casual rhythm based gameplay with players tasked with tapping on the most strategic piece to drop in time with the beat Marathon mode presents traditional Tetris gameplay with an option to customize the backing soundtrack Read more 2021-08-20 22:16:30
海外TECH Engadget Rhythm game 'Tetris Beat' is now available on Apple Arcade https://www.engadget.com/tetris-beat-available-today-apple-arcade-225345729.html?src=rss Rhythm game x Tetris Beat x is now available on Apple ArcadeIn the nearly years since Alexey Pajitnov created Tetris the game has inspired many permutations The latest example is Tetris Beat an Apple Arcade exclusive that adds rhythm elements to the title s classic line clearing formula In the game s beat mode the more you keep to the rhythm of a song the more points you ll earn However if you want a more traditional Tetris experience the included Marathon mode offers that As with all Apple Arcade titles Tetris Beat does not include any in app ads or purchases With today s launch the game features exclusive songs with more to come every month Some of the current contributors include well known artists like Alison Wonderland Hannah Diamond and my personal favorite among the group Dauwd What s more if you own a pair of AirPods Pro or Max the game supports Apple s Spatial Audio technology so you can look forward to a more immersive experience You can download Tetris Beat on iPhone iPad Mac and Apple TV starting today An Apple Arcade subscription costs per month It s also included in the company s Apple One membership 2021-08-20 22:53:45
海外科学 NYT > Science Maker of Rapid Covid Tests Told Factory to Destroy Inventory https://www.nytimes.com/2021/08/20/us/abbott-covid-tests.html Maker of Rapid Covid Tests Told Factory to Destroy InventoryOne of the leading producers of rapid tests purged supplies and laid off workers as sales dwindled Weeks later the U S is facing a surge in infections with diminished capacity 2021-08-20 22:58:02
金融 金融総合:経済レポート一覧 FX Daily(8月19日)~ドル円、上値重く109円台後半で推移 http://www3.keizaireport.com/report.php/RID/465721/?rss fxdaily 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 米国における私募市場へのアクセス改善:(2)自衛力認定投資家の定義の見直し:ディスカッションペーパー http://www3.keizaireport.com/report.php/RID/465726/?rss 日本証券経済研究所 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 日米株の道標「どうなる?今後のグローバル株式相場~テーパリングの影響は限定的に~」 http://www3.keizaireport.com/report.php/RID/465730/?rss 岡三証券 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 スリランカ中銀、新型コロナ禍後のアジアで最初の利上げ実施を決定~感染悪化が続くなかでの「追い込まれ感」は否めず、対外収支構造は極めて厳しい状況に直面:Asia Trends http://www3.keizaireport.com/report.php/RID/465734/?rss asiatrends 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 ALiNKインターネット(東証マザーズ)~天気予報専門の大手メディア「tenki.jp」を運営。新型コロナウイルス禍の影響の見通しが立ちにくく22年2月期会社計画は「未定」:アナリストレポート http://www3.keizaireport.com/report.php/RID/465736/?rss alink 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 GA technologies (マザーズ)~得意のDXの積極活用により不動産テック総合サービス「RENOSY」を運営:アナリストレポート:アナリストレポート http://www3.keizaireport.com/report.php/RID/465737/?rss gatechnologies 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 投資INSIDE-OUT vol.159「米国に負けず劣らず、高値更新が続く欧州株式~語られざる投資の真実(43)~」 http://www3.keizaireport.com/report.php/RID/465745/?rss insideoutvol 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 新興国通貨は各国の金融政策や景気格差が焦点に:新興国レポート http://www3.keizaireport.com/report.php/RID/465747/?rss 新興国通貨 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 トヨタショックと日本株:市川レポート http://www3.keizaireport.com/report.php/RID/465748/?rss 三井住友 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 【キーワード】『東証再編』に向け、企業の取り組みが加速 http://www3.keizaireport.com/report.php/RID/465749/?rss 三井住友 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 楽読 Vol.1734~米量的緩和、年内にも縮小開始との見方が拡がる http://www3.keizaireport.com/report.php/RID/465750/?rss 日興アセットマネジメント 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 KAMIYAMA Seconds!:アフガニスタン情勢とリスク http://www3.keizaireport.com/report.php/RID/465751/?rss kamiyamaseconds 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 資金循環の日米欧比較(2021年第1四半期) http://www3.keizaireport.com/report.php/RID/465755/?rss 日本銀行 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 FX Weekly(2021年8月20日号)~来週の為替相場見通し(1)ドル円:改めて金融政策正常化の影響をよむ http://www3.keizaireport.com/report.php/RID/465756/?rss fxweekly 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 (1)8月雇用統計も強そう(米労働市場) (2)不気味なシグナルは「銅金相対価格」:Market Flash http://www3.keizaireport.com/report.php/RID/465760/?rss marketflash 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 経済政策の不確実性が企業投資と現金保有に与える影響:日本における検証【概要:日本語、全文:英語】 http://www3.keizaireport.com/report.php/RID/465782/?rss 不確実性 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 Weekly金融市場 2021年8月20日号~来週の注目材料、経済指標... http://www3.keizaireport.com/report.php/RID/465794/?rss weekly 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 KPMG FAS Newsletter “Driver” Vol.08 ~資本市場 変革の波への対応... http://www3.keizaireport.com/report.php/RID/465795/?rss drivervol 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 Close-up 1:米国SPACの動向 日本企業にとっての選択肢とは:KPMG FAS Newsletter “Driver” Vol.08 http://www3.keizaireport.com/report.php/RID/465796/?rss closeup 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 Close-up 3:東証市場改革を契機としたコーポレート・アクション:KPMG FAS Newsletter “Driver” Vol.08 http://www3.keizaireport.com/report.php/RID/465798/?rss closeup 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 【注目検索キーワード】オルタナティブデータ http://search.keizaireport.com/search.php/-/keyword=オルタナティブデータ/?rss 検索キーワード 2021-08-21 00:00:00
金融 金融総合:経済レポート一覧 【お薦め書籍】もう価格で闘わない〜非価格経営を実現した24社の取り組み https://www.amazon.co.jp/exec/obidos/ASIN/4866672781/keizaireport-22/ 価格競争 2021-08-21 00:00:00
ニュース BBC News - Home Newspaper headlines: Evacuation efforts in Kabul and Al-Qaeda warning https://www.bbc.co.uk/news/blogs-the-papers-58288462 front 2021-08-20 22:22:28
ニュース BBC News - Home Trump out of British Open and loses number one ranking - on his birthday https://www.bbc.co.uk/sport/snooker/58287485 number 2021-08-20 22:29:47
サブカルネタ ラーブロ 鶏白湯そば 岸良。。 http://feedproxy.google.com/~r/rablo/~3/ZJdVHypr-Rk/single_feed.php 大阪府吹田市五月が丘北 2021-08-20 23:25:09
北海道 北海道新聞 野村2発も杉浦まさかの九回押し出し 日本ハム https://www.hokkaido-np.co.jp/article/580468/ 押し出し 2021-08-21 07:09:36
北海道 北海道新聞 コンサドーレ、21日に敵地で大分戦 https://www.hokkaido-np.co.jp/article/580459/ 試合 2021-08-21 07:08:57
ビジネス 東洋経済オンライン 「新型BRZ」旧型よりも“落ち着き"を感じる訳 スバルらしさを強めてGR86との違いも明確に | 森口将之の自動車デザイン考 | 東洋経済オンライン https://toyokeizai.net/articles/-/448600?utm_source=rss&utm_medium=http&utm_campaign=link_back 共同開発 2021-08-21 08:00:00
ビジネス 東洋経済オンライン 「大炎上でもお粗末謝罪」謝れない人の深層心理 大騒動「あの3人」は、なぜ謝罪を嫌がったのか? | リーダーシップ・教養・資格・スキル | 東洋経済オンライン https://toyokeizai.net/articles/-/449543?utm_source=rss&utm_medium=http&utm_campaign=link_back 上場企業 2021-08-21 07:30:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)