IT |
ITmedia 総合記事一覧 |
[ITmedia PC USER] サンワ、自動ロッキング調整機能を備えたメッシュチェア |
https://www.itmedia.co.jp/pcuser/articles/2212/19/news138.html
|
itmediapcuser |
2022-12-19 16:08:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Confluenceへの移行を楽にしたい |
https://qiita.com/reonyanarticle/items/b680e12afbe1e95841b9
|
adventcalendar |
2022-12-19 16:38:11 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
シミュレーションにおける微分方程式の計算方法 |
https://qiita.com/SS310/items/ce580f2fb99e1d9c1f0c
|
微分方程式 |
2022-12-19 16:20:49 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Streamlit を Azure App Serviceで動かす! |
https://qiita.com/takashiuesaka/items/491b21e9afb34bbb6e6d
|
azureapp |
2022-12-19 16:00:41 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
devise.rbで記述されている内容について |
https://qiita.com/hirowaji/items/a21fc399a6bb6b5e7dc5
|
devise |
2022-12-19 16:29:30 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
【Datadog】Amazon AuroraのWriter, Readerロールを表示 |
https://qiita.com/_konishi_/items/a7d19817905e347758f9
|
amazon |
2022-12-19 16:42:46 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
CloudWatch Metrics 統計値で状態把握 |
https://qiita.com/f-koda/items/66bd589969b1410dc818
|
cloudwatchmetrics |
2022-12-19 16:23:43 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
ONLYOFFICEと統合されたNextcloudをDockerでインストールする方法 |
https://qiita.com/ONLYOFFICE/items/5ef57da7d7fc9a393d09
|
docker |
2022-12-19 16:38:23 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
Streamlit を Azure App Serviceで動かす! |
https://qiita.com/takashiuesaka/items/491b21e9afb34bbb6e6d
|
azureapp |
2022-12-19 16:00:41 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
Githubのアカウント切り替え方法決定版【windows Gitbash】 |
https://qiita.com/seroroon/items/67fe514b88297aff195d
|
https |
2022-12-19 16:25:41 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
devise.rbで記述されている内容について |
https://qiita.com/hirowaji/items/a21fc399a6bb6b5e7dc5
|
devise |
2022-12-19 16:29:30 |
技術ブログ |
Developers.IO |
CDK for TerraformでTypeScriptのLambda関数をデプロイするチュートリアルをやってみた |
https://dev.classmethod.jp/articles/cdktftutorial-cdktf-assets-stacks-lambda/
|
cdkforterraform |
2022-12-19 07:28:52 |
海外TECH |
DEV Community |
Web Application Deployment on AWS |
https://dev.to/aws-builders/web-application-deployment-on-aws-31a7
|
Web Application Deployment on AWS IntroductionWith the rapid evolution of the software industry in general developing and deploying web applications is not as easy as writing the code and deploying it on remote servers Today s software development lifecycle necessitates the collaboration of different teams e g developers designers managers system administrators etc working on different tools and technologies to serve the challenging application requirements in an organized and optimized matter Such collaboration may prove to be extremely complex and costly if not properly managed This tutorial provides an introduction to Web Applications and the different Infrastructure Types To put the information provided into good use a demo is applied on Amazon Web Services Moreover multiple infrastructure types exist to deploy and serve these web applications Each option possesses its advantages disadvantages and use cases This tutorial comprises a theoretical part which aims to list and describe different concepts related to web applications and infrastructure types followed by a practical part to apply and make sense of the information discussed What is Everything and Why Websites vs Web ApplicationsBy definition websites are a set of interconnected documents images videos or any other piece of information developed usually using HTML CSS and Javascript User interaction with websites is limited to the user fetching the website s information only Moreover websites are usually stateless and thus requests from different users yield the same results at all times Examples of websites include but are not limited to company websites blogs news websites etc Web applications on the other hand are more complex than websites and offer more functionalities to the user Google Facebook Instagram Online gaming and e commerce are all examples of web applications Such applications allow the user to interact with them in different ways such as creating accounts playing games buying and selling goods etc In order to provide such complex functionalities the architecture of the web application can prove to be much more complex than that of a website A web application is divided into three layers More layers can be added to the application design but for simplicity purposes this tutorial focuses on only three Presentation Layer Also known as the client side The client applications are designed for displaying the application information and for user interaction Frontend applications are developed using many technologies AngularJS ReactJS VueJS etc Application Business Logic Layer is part of the application s server side It accepts and processes user requests and interacts with the databases for data modification Such applications can be developed using NodeJS Python PHP Java etc Database Layer This is where all the data resides and is persisted Example Deployment on AWSThe diagram above displays an example deployment of a web application on AWS and how users can interact with it A database is deployed and served using AWS managed database service e g AWS RDS As a best practice it is recommended not to expose the database to the Internet directly and to properly secure the access The backend application is deployed on a server with a public IP The frontend application is deployed and served on AWS S All the application components reside within an AWS VPC in a region A typical HTTP request response cycle could be as follows The client sends an HTTP request to the front end application The frontend application code is returned and loaded on the client s browser The client sends an API call through the frontend application to the backend application The backend application validates and processes the requests The backend application communicates with the database for managing the data related to the request The backend application sends an HTTP response containing the information requested by the client Web Application ComponentsAs discussed a website is composed of a simple application developed entirely using HTML CSS and Javascript On the other hand web applications are more complex and are made of different components In its simplest form a web application is composed of Frontend Application Backend Application Database The components above are essential to creating web applications However the latter may require additional components to serve more complex functionalities In memory database For caching Message bus For asynchronous communication Content Delivery Network For serving and caching static content Workflow Management Platform For organizing processes As the application s use case grows in size and complexity so will the underlying web application Therefore a proper way to architect and organize the application is needed Below is a diagram representing the architecture of a web application deployed on AWS Infrastructure TypesThe diagram above lists different infrastructure options for deploying and managing applications Physical ServersIn this type of infrastructure hardware resources would have to be purchased configured and managed in a physical location e g a datacenter Once configured and an operating system is installed applications can be deployed on them The correct configuration and management of the servers and applications must be ensured throughout their lifecycle AdvantagesOwnership and Customization Full control over the server and application Performance Full dedication of server resources to the applications DisadvantagesLarge CAPEX and OPEX Setting up the required infrastructure components may require a large upfront investment in addition to another one for maintaining the resources Management overhead to continuously support and manage the resources Lack of scalability Modifying the compute resources is not intuitive and requires time and complicated labor work Resource Mismanagement Due to the lack of scalability Improper isolation between applications All the applications deployed on the same physical host share all the host s resources together Performance Degradation over time Hardware components will fail over time Virtual MachinesOne of the best practices when deploying web applications is to isolate the application components on dedicated environments and resources Consider an application composed of the following components A MySQL database A NodeJS backend API service A Dotnet backend consumer service A ReactJS frontend application RabbitMQ Typically each of these components must be properly installed and configured on the server with enough resources available Deploying and managing such an application on physical servers becomes cumbersome especially at scale Deploying all the components on one physical server may pose several risks Improper isolation for each application component Race conditions deadlocks and resource overconsumption by components The server represents a single point of failure Deploying the components on multiple physical servers is not an intuitive approach due to the disadvantages listed above especially those related to cost and lack of scalability Virtual Machines represent the digitized version of the physical servers Hypervisors e g Oracle VirtualBox Hyper v and VMWare are software solutions that allow the creation and management of one or more Virtual Machines on one Physical Server Different VMs with different flavors can be created and configured on the same physical host For instance one physical server may host three different VMs with the following specs VM ー gt vCPU ー gt GB RAM ー gt GB SSD ー gt Ubuntu VM ー gt vCPU ー gt GB RAM ー gt GB SSD ー gt Windows VM ー gt vCPU ー gt GB RAM ー gt GB SSD ー gt MAC OS Each virtual machine possesses its dedicated resources and can be managed separately from the other ones AdvantagesLow Capital Expenditure No need to buy and manage hardware components Flexibility The ability to quickly create destroy and manage different VM sizes with different flavors Disaster Recovery Most VM vendors are shipped with solid backup and recovery mechanisms for the virtual machines Reduced risk of resource misuse over and under provisioning Proper environment isolation for application components DisadvantagesPerformance issues Virtual machines have an extra level of virtualization before accessing the computing resources rendering them less performant than the physical machines Security issues Multiple VMs share the compute resources of the underlying host Without proper security mechanisms this may pose a huge security risk for the data in each VM Increased overhead and resource consumption Virtualization includes the Operating System As the number of VMs placed on a host more resources are wasted as overhead to manage each VM s requirements ContainersWhile Virtual Machines virtualize the underlying hardware containerization is another form of virtualization but for the Operating System only The diagram above visualizes containers Container Engines e g Docker are software applications that allow the creation of lightweight environments containing only the application and the required binaries for it to run on the underlying server All the containers on a single machine share the system resources and the operating system making containers a much more lightweight solution than virtual machines in general A container engine deployed on the server whether physical or virtual takes care of the creation and management of Containers on the server Similar function to hypervisors and VMs AdvantagesDecreased Overhead Containers require fewer resources than VMs especially since virtualization does not include the Operating System Portability Container Images are highly portable and can be easily deployed on different platforms a Docker image can be deployed on any Container Engine that supports it e g Docker Kubernetes AWS ECS AWS EKS Microsoft AKS Google Kubernetes Engine etc Faster build and release cycles Containers due to their nature enhance the Software development lifecycle from development to continuous delivery of software changes DisadvantagesData Persistence Containers although support data persistence through different mechanisms is still considered a bad solution for applications that require persistent data e g stateful applications databases etc Up until today it is not advised to deploy such applications as containers Cross Platform incompatibility Containers designed to work on one platform will not work on other platforms For instance Linux containers do not work on Windows Operating Systems and vice versa ServerlessServerless solutions e g AWS Lambda Functions Microsoft Azure Functions Google Functions mainly designed by cloud providers not long ago are also becoming greatly popular nowadays Despite the name serverless architectures are not really without servers Rather solution providers went deeper into the virtualization removing the need the focus on anything but writing the application code The code is packaged and deployed into specialized “functions that take care of managing and running it Serverless solutions paved the way for new concepts especially Function as a service FaaS which promotes the creation and deployment of a single function per serverless application e g one function to send verification emails as soon as a new user is created The diagram showcases the architecture of serverless solutions Application code is packaged and uploaded to a function which represents a virtualized environment that is completely taken care of by the provider Serverless architecture although alleviate a lot of challenges presented by the previous three infrastructure types is still unable to replace any of them due to its many limitations Serverless architectures do not meet the requirements of all use cases and therefore work best in conjunction with other infrastructure types Most serverless solutions are offered by providers rather than being a solution that can be deployed and managed by anyone thus making it a less favored solution AdvantagesCost Users only pay for the resources consumed during the time of execution Idle functions generally do not use any resources and therefore the cost of operation is greatly reduced as opposed to paying for a server that is barely used Scalability Serverless models are highly scalable by design and do not require the intervention of the user Faster build and release cycles Developers only need to focus on writing code and uploading it to a readily available infrastructure DisadvantagesSecurity The application code and data are handled by third party providers Therefore security measures are all outsourced to the managing provider The security concerns are some of the biggest for users of this serverless model especially when it comes to sensitive applications that have strict security requirements Privacy The application code and data are executed on shared environments with application codes which poses huge privacy and security concerns Vendor Lock in Serverless solutions are generally offered by third party providers e g AWS Microsoft Google etc Each of these solutions is tailored to the providers interests For instance a function deployed on AWS Lambda functions may not necessarily work on Azure functions without code modifications Excessive use and dependence on a provider may lead to serious issues of vendor lock ins especially as the application grows Complex Troubleshooting In contrast with the ease of use and deployment of the code troubleshooting and debugging the applications are not straightforward Serverless models do not provide access whatsoever to the underlying infrastructure and provide their generic troubleshooting tools which may not always be enough DockerDocker is a containerization software that aids in simplifying the workflow by enabling portable and consistent applications that can be deployed rapidly anywhere thus allowing software development teams to operate the application in a more optimized way Container ImagesA container image is nothing but a snapshot of the desired environment For instance a sample image may contain a MySQL database NGINX or a customized NodeJS RESTful service A Docker image is a snapshot of an isolated environment usually created by a maintainer and can be stored in a Container Repository ContainersA container is the running version of an image A container cannot exist without an image A container uses an image as a starting point for that process Container RegistriesA container registry is a service to store and maintain images Container registries can be either public allowing any user to download the public images or private requiring user authentication to manage the images Examples of Container Registries include but are not limited to Docker Hub Amazon Elastic Container Registry ECR and Microsoft Azure Container Registry DockerfilesA Dockerfile is a text document interpreted by Docker and contains all the commands required to build a certain Docker image A Dockerfile holds all the required commands and allows for the creation of the resulting image using one build command only Knowledge ApplicationTo better understand the difference between the concepts above this tutorial will perform the following Creation of the networking and compute resources on AWSDeployment of a simple application on an AWS EC machineContainerization of the applicationDeployment of the containerized application on an AWS EC machine AWS InfrastructureThe infrastructure resources will be deployed in the region of Ireland eu west in the default VPC Security GroupA Security group allowing inbound connection from anywhere to ports and is needed To create such a security group navigate to AWS EC ー gt Security Groups ー gt Create security group with the following parameters Security group name aws demoDescription Allows inbound connections to ports and from anywhereVPC default VPCInbound rules Rule Type SSHSource Anywhere IPvRule Type HTTPSource Anywhere IPv Key pairAn SSH key pair is required to SSH to Linux EC instances To create a key pair navigate to AWS EC ー gt Key pairs ー gt Create key pair with the following parameters Name aws demoPrivate key file format pemOnce created the private key is downloaded to your machine For it to properly work the key must be moved to a hidden directory and its permissions modified the commands below work on Mac OS The commands may be different for other operating systems Create a hidden directorymkdir keypairs aws demo Move the key to the created directorymv Downloads aws demo pem keypairs aws demo Change the permissions of the keysudo chmod keypairs aws demo aws demo pem IAM RoleAn IAM role contains policies and permissions granting access to actions and resources in AWS The IAM role is assigned to an AWS resource in this case the EC machine To create an IAM role navigate to IAM ー gt Roles ー gt Create Role with the following paramters Trusted entity type AWS ServiceCommon use cases ECPermissions policies AdministratorAccessRole Name aws demoCreate Role This role will be assigned to the EC machine during creation AWS EC MachineAn AWS EC machines with Ubuntu is required To create the EC machine navigate to AWS EC ー gt instances ー gt Launch instances with the following parameters Name aws demoAMI Ubuntu Server LTS HVM SSD Volume TypeInstance Type t medium t micro can be used for free tier but may suffer from performance issues Key pair name aws demoNetwork Settings Select existing security group aws demoConfigure storage x GiB gp Root volumeAdvanced details IAM instance profile aws demoLeave the rest as defaults and launch the instanceAn EC VM is created and is assigned both a private and a public IPv addresses In addition the security group created is attached correctly to the machine Telnet is one way to ensure the machine is accessible on ports and Make sure to replace the machine s IP with the one attributed to your machinetelnet telnet Finally SSH to the machine using the key pair created ssh ubuntu i aws demo pemThe last step would be to install the AWS CLI Update the package repositorysudo apt get update Install unzip on the machinesudo apt get install y unzip Download the zipped packagecurl o awscliv zip unzip the packageunzip awscliv zip Run the installersudo aws installEnsure the AWS CLI is installed by checking the version aws version Application Deployment on the EC machine Application CodeThe application to be deployed is a simple HTML document lt DOCTYPE html gt lt html gt lt head gt lt title gt My First Application lt title gt lt head gt lt body gt lt p gt I have no idea what I m doing lt p gt lt body gt lt html gt Apache InstallationA Webserver is needed to serve the web application To install Apache Update the local package index to reflect the latest upstream changes sudo apt get updateInstall the Apache package sudo apt get install y apacheCheck if the service is running sudo service apache statusVerify that the deployment worked by hitting the public IP of the machine Application DeploymentTo deploy the application perform the following steps Create a directorysudo mkdir var www myfirstapp Change the ownership to www datasudo chown R www data www data var www myfirstapp Change the directory permissionssudo chmod R var www myfirstapp Create the index html file and paste the code in itsudo nano var www myfirstapp index html Change the owership to www datasudo chown R www data www data var www myfirstapp index html Create the log directorysudo mkdir var log myfirstapp Change the ownership of the directorysudo chown R www data www data var log myfirstapp Virtual HostCreate the virtual host file sudo nano etc apache sites available myfirstapp confPaste the following lt VirtualHost gt DocumentRoot var www myfirstapp ErrorLog var log myfirstapp error log CustomLog var log myfirstapp requests log combined lt VirtualHost gt Enable the configuration Enable the site configurationsudo aensite myfirstapp conf Disable the default configurationsudo adissite default conf Test the configurationsudo apachectl configtest Restart apachesudo systemctl restart apachePerform a request on the server The response will now return the HTML document created In conclusion to deploy the application on the EC machine several tools had to be deployed and configured While this is manageable for one simple application things won t be as easy and straightforward when the application grows in size For instance assume an application of components must be deployed Managing each component on the server will be cumbersome The next part demonstrates how containerization can alleviate such problems Remove the apache webserver sudo apt get purge y apache Application Deployment using containers Docker InstallationInstall Docker on the machine Update the package index and install the required packagessudo apt get updatesudo apt get install y ca certificates curl gnupg lsb release Add Docker s official GPG key sudo mkdir p etc apt keyringscurl fsSL sudo gpg dearmor o etc apt keyrings docker gpg Set up the repositoryecho deb arch dpkg print architecture signed by etc apt keyrings docker gpg lsb release cs stable sudo tee etc apt sources list d docker list gt dev null Update the package index againsudo apt get update Install the latest version of dockersudo apt get install y docker ce docker ce cli containerd io docker compose plugin Add the Docker user to the existing User s group to run Docker commands without sudo sudo usermod aG docker USERTo validate that Docker is installed and the changes are all applied restart the SSH session and query the docker version docker ps a A response similar to the below indicates the success of the installation Base ImageThere exists several official Docker images curated and hosted on Docker Hub aiming to serve as starting points for users attempting to build on top of them There exists an official repository for the Apache server containing all the information necessary to deploy and operate the image Start by downloading the image to the server docker pull httpd alpine alpine is the image tag an identifier to distinguish the different image versions available After downloading the image successfully list the available images docker images The image below clearly shows the successful deployment of the image Next it is time to run an container from this image The goal is to run the apache server on port and have it accept requests Create a Docker container using the command docker run d name myfirstcontainer p httpd alpineThe command above is explained as follows run instructs docker to run a container d Flag to run the container in the background Detached mode Omitting this flag will cause the container to run in the foreground name A custom name can be given to the container If no name is given Docker will assign a random name for the container p Publish a container s port to the host by default if the ports are not exposed containers cannot be accessible from outside the Docker network To bypass this the p flag maps the container s internal ports to those of hosts allowing the containers to be reachable from outside the network In the example above The Apache server listens internally on port The command above instructs Docker to map the container s port to the host s port Now the container can be reached via the machine s public IP and on port which will translate it to the container s default port ensure that the container is successfully running docker ps a Monitor the container logs docker logs f myfirstcontainerUsing any browser attempt to make a request to the container using the machine s public IP and port http Customize the Base ImageNow that the base image is successfully deployed and running it is time to customize it The official documentation presents clear instructions on the different ways the image can be customized namely creating custom Virtual Hosts adding static content adding custom certificates etc In this example the following simple HTML page representing a website will be added thus creating a custom image lt DOCTYPE html gt lt html gt lt head gt lt title gt My First Dockerized Website lt title gt lt head gt lt body gt lt p gt I am inside a Docker Container lt p gt lt body gt lt html gt The official documentation on Docker Hub clearly states that the default location for adding static content is in usr local apache htdocs To do so create an interactive sh shell on the container docker exec it myfirstcontainer sh Once inside the container navigate to the designated directory cd usr local apache htdocs The directory already has a file named index html which contains the default Apache page loaded above Modify it to include the custom HTML page above and hit the container again http Clearly the image shows that the changes have been reflected Create a Custom ImageUnfortunately The changes performed will not persist especially when the container crashes As a matter of fact by default containers are ephemeral which means that custom data generated during runtime will disappear as soon as the container fails To verify it remove the container and start it again docker rm f myfirstcontainerdocker ps adocker run d name myfirstcontainer p httpd alpineNow hit the server again The changes performed disappeared To persist the changes a custom image must be built The custom image is a snapshot of the container after adding the custom website Repeat the steps above to add the HTML page and ensure the container is returning the new page again To create a new image from the customized running container perform the following create a local image from the running container docker commit myfirstcontainer Clearly a new image with no name and no tag has been just created using the docker commit command Name and tag the image docker tag lt image ID gt custom httpd v The image should be that created by Docker and the name and tag can be anything Remove the old container and create a new one using the new image docker rm f myfirstcontainerdocker run d name mysecondcontainer p custom httpd vA new docker container named mysecondcontainer is now running using the custom built image Hitting the machine on port should return the new HTML page now no matter how many times the container is destroyed and created The custom image is now located on the Virtual Machine However storing the image on the VM alone is not a best practice Inability to efficiently share the image with other developers working on it Inability to efficiently download and run the image on different servers Risk of losing the image especially if the VM is not well backed up A better solution would be to host the image in a Container Registry In this tutorial AWS ECR will be used to store the image To create a Container repository on AWS ECR navigate to Amazon ECR ー gt Repositories ー gt Private ー gt Create repository with the following parameters Visibility Settings PrivateRepository name custom httpdLeave the rest as defaults and create the repository Now that the repository is successfully created perform the following to push the image from the local server to the remote repository First login to the ECR from the machine aws ecr get login password region eu west docker login username AWS password stdin lt AWS ACCOUNT ID gt dkr ecr eu west amazonaws comThe repository created on AWS ECR possesses a different name than the one we created therefore we need to tag the image with the correct name and then push it Tag the image with the correct repository namedocker tag custom httpd v lt AWS ACCOUNT ID gt dkr ecr eu west amazonaws com custom httpd v Push the imagedocker push lt AWS ACCOUNT ID gt dkr ecr eu west amazonaws com custom httpd vClearly we were able to push the image to AWS ECR Now to finally test that the new custom image is successfully built and pushed attempt to create a container from the image located in the Container Registry Delete all the containers from the serverdocker rm f docker ps a Delete all the images from the serverdocker rmi f docker images List all the available images and containers should return empty docker imagesdocker ps a create a third container but this time reference the image located in the ECR docker run d name mythirdcontainer p lt AWS ACCOUNT ID gt dkr ecr eu west amazonaws com custom httpd vThe image clearly shows that the image was not found locally on the server and therefore fetched from the ECR Finally hit the server again The server returns the custom page created Cleaning up the server from the applications is as simple as deleting all the containers and all the images Delete all the containers from the serverdocker rm f docker ps a q Delete all the images from the serverdocker rmi f docker images List all the available images and containers should return empty docker imagesdocker ps a Create a Docker image using DockerfilesCreating images from existing containers is one intuitive way However such an approach may prove to be inefficient and inconsistent Docker images may require to be built several times a day A Docker image may require several complex commands to be built Difficult to maintain as the number of services and teams grows Dockerfiles are considered a better alternative capable of providing more consistency and allowing for automating the build steps To better understand Dockerfiles the rest of this tutorial attempts to Containerize the application using Dockerfiles To do so The application code and the Dockerfile must be placed together Create a temporary directory mkdir tempDirand place the application code inside the directory in a file called index html lt DOCTYPE html gt lt html gt lt head gt lt title gt My Final Dockerized Website lt title gt lt head gt lt body gt lt p gt I am Dockerized using a Dockerfile lt p gt lt body gt lt html gt Create a Dockerfile next to the index html file with the following content FROM httpd alpineCOPY index html usr local apache htdocs The Dockerfile above has two instructions Use httpd alpine as base imageCopy index html from the server to the usr local apache htdocs inside the containerThe resultant directory should look as follows To build the image using a Dockerfile perform the following command docker build f Dockerfile t lt AWS ACCOUNT ID gt dkr ecr eu west amazonaws com custom httpd v Dockerfile Breaking down the command above docker build Docker command to build a Docker image from a Dockerfile f Dockerfile The path and filename of the Dockerfile Can be named anything t lt AWS ACCOUNT ID gt dkr ecr eu west amazonaws com v dockerfile The name and tag of the resulting image The path to the context or the set of files to be built Push the image to the ECR docker push lt AWS ACCOUNT ID gt dkr ecr eu west amazonaws com custom httpd v DockerfileFinally to simulate a fresh installation of the image remove all the containers and images from the server and create a final container from the newly pushed image Remove existing containersdocker rm f docker ps a q Remove the imagesdocker rmi f docker images Create the final container docker run d name myfinalcontainer p lt AWS ACCOUNT ID gt dkr ecr eu west amazonaws com custom httpd v DockerfileHit the machine via its IP |
2022-12-19 07:09:30 |
海外TECH |
DEV Community |
Git merge - learn by example |
https://dev.to/mohsenkamrani/git-merge-learn-by-example-1lbf
|
Git merge learn by exampleGit merge is a powerful tool that allows developers to integrate changes from different branches into a single branch In this article I ll explain different ways to merge branches with Git using a simple example to illustrate each method Before we move on I suggest taking a look at an open source tool to visually build websites APIs and much more and publish them in no time To get started let s create a new Git repository and add a file to it git init echo Hello world gt greeting txt git add greeting txt git commit m Add greeting Next let s create a new branch and make some changes to the file git branch new feature git checkout new feature echo Bonjour le monde gt gt greeting txt git commit am Add French greeting Now we have two branches in our repository the master branch which contains the original Hello world greeting and the new feature branch which contains the additional Bonjour le monde greeting There are several ways to merge these changes back into the master branch One way is to use the git merge command with the no ff option which creates a new merge commit even if a fast forward merge is possible This is useful when you want to preserve the entire branch history rather than just fast forwarding the master branch to the latest commit in the new feature branch git checkout master git merge no ff new featureThe output of this command will look something like this Merge made by the recursive strategy greeting txt file changed insertion If we run git log we can see that a new merge commit has been created which brings together the changes from both branches git log onelineef HEAD gt master new feature Merge branch new feature bc Add French greetingea Add greetingAnother way to merge the new feature branch is to use the git merge command with the squash option This option combines all the commits in the new feature branch into a single commit which is then merged into the master branch This is useful when you want to clean up the commit history or when you want to merge a feature branch into a release branch and preserve a linear history git checkout master git merge squash new feature git commit m Merge new feature The output of this command will look similar to the previous example but if we run git log we can see that there is only one commit for the merged changes git log onelineef HEAD gt master Merge new featureea Add greetingOne tricky situation that can arise when merging branches is a conflict This occurs when the same lines of code have been modified in both branches and Git is unable to automatically resolve the differences In this case Git will mark the conflicting lines in the file and ask you to resolve the conflict manually To demonstrate this let s create another branch and make some changes to the same lines of code that we modified in the new feature branch git branch conflict git checkout conflict sed i s Hello world Hola mundo greeting txt git commit am Add Spanish greeting Now let s try to merge the conflict branch into master git checkout master git merge conflictGit will display a message indicating that there is a conflict and the greeting txt file will contain markers showing the conflicting lines Copy codeAuto merging greeting txtCONFLICT content Merge conflict in greeting txtAutomatic merge failed fix conflicts and then commit the result Copy code lt lt lt lt lt lt lt HEADBonjour le monde Hola mundo gt gt gt gt gt gt gt conflictTo resolve the conflict we need to edit the file and remove the markers For example we could keep both greetings by adding a line break between them Bonjour le monde Hola mundo Then we can commit the resolved conflict git add greeting txt git commit m Resolve conflict BonusOne trick for avoiding conflicts when merging branches is to ensure that each branch focuses on a separate aspect of the codebase For example if one branch is working on the front end interface and another branch is working on the back end logic there is less likelihood of conflicts occurring Another tricky situation can arise when merging a branch that contains a large number of commits In this case it may be difficult to review and understand the changes that are being merged One way to simplify the process is to use the git merge command with the squash option as we saw earlier This will combine all the commits into a single commit which can be easier to review and understand Finally I encourage you to join the open source movement to make a long lasting impact and contribute to the development of software that benefits society as a whole Participating in open source projects can also help boost your career progress by demonstrating your skills and expertise to potential employers and allowing you to collaborate with other experienced developers |
2022-12-19 07:02:42 |
金融 |
ニッセイ基礎研究所 |
ドル円は“日米金融政策の行方”を巡る思惑が交錯~マーケット・カルテ1月号 |
https://www.nli-research.co.jp/topics_detail1/id=73277?site=nli
|
ただし、利上げ長期化に伴う米景気後退懸念がドルの反発力を削いだほか、共同声明の改定を巡る報道を受けた日銀の緩和縮小観測が円高圧力となったため、足元でも円台前半に留まっている。 |
2022-12-19 16:32:17 |
金融 |
日本銀行:RSS |
GHOSが暗号資産に関する国際的な銀行の健全性基準等に関するプレス・リリースを公表 |
http://www.boj.or.jp/announcements/release_2022/rel221219a.htm
|
銀行 |
2022-12-19 17:00:00 |
ニュース |
@日本経済新聞 電子版 |
テーマ型ETF、インド・再エネ・消費株が躍進 成長で選別
https://t.co/2bL0UAFHDX |
https://twitter.com/nikkei/statuses/1604739221071089664
|
躍進 |
2022-12-19 07:23:39 |
ニュース |
BBC News - Home |
Elon Musk asks Twitter poll if he should stay as boss |
https://www.bbc.co.uk/news/business-your-money-64021412?at_medium=RSS&at_campaign=KARANGA
|
media |
2022-12-19 07:46:01 |
ニュース |
BBC News - Home |
Turbulence injures dozens on Hawaiian Airlines flight |
https://www.bbc.co.uk/news/world-us-canada-64024021?at_medium=RSS&at_campaign=KARANGA
|
condition |
2022-12-19 07:29:07 |
北海道 |
北海道新聞 |
「災害可能性低い」と県外へ出張 徳島市長、独自予測踏まえ |
https://www.hokkaido-np.co.jp/article/777319/
|
徳島市長 |
2022-12-19 16:50:00 |
北海道 |
北海道新聞 |
「セクハラに感覚まひ」 元自衛官の五ノ井さんが会見 |
https://www.hokkaido-np.co.jp/article/777305/
|
元自衛官 |
2022-12-19 16:31:41 |
北海道 |
北海道新聞 |
ジャンボ機生産、半世紀で幕 1574機製造、需要低迷 |
https://www.hokkaido-np.co.jp/article/777307/
|
需要 |
2022-12-19 16:26:09 |
北海道 |
北海道新聞 |
無病息災願い「ゆずみそ」づくり 空海が伝授、大阪の盛松寺 |
https://www.hokkaido-np.co.jp/article/777316/
|
大阪府河内長野市 |
2022-12-19 16:35:00 |
北海道 |
北海道新聞 |
山上容疑者の鑑定再延長へ 奈良地検、来年1月23日まで |
https://www.hokkaido-np.co.jp/article/777315/
|
奈良地検 |
2022-12-19 16:35:00 |
北海道 |
北海道新聞 |
道が江差の福祉施設へ立ち入り 障害者への不妊処置、調査へ |
https://www.hokkaido-np.co.jp/article/777294/
|
社会福祉法人 |
2022-12-19 16:25:59 |
北海道 |
北海道新聞 |
ハリケーンズが5連勝 NHL第11週 |
https://www.hokkaido-np.co.jp/article/777312/
|
連勝 |
2022-12-19 16:25:00 |
北海道 |
北海道新聞 |
日本生命営業職員の年収7%増へ 23年度、全国5万人 |
https://www.hokkaido-np.co.jp/article/777304/
|
日本生命 |
2022-12-19 16:03:00 |
ニュース |
Newsweek |
「大地に広がる観測網?」メキシコの遺跡に通じる道は、巨大な天体観測装置だった 農業専門家が発見 |
https://www.newsweekjapan.jp/stories/world/2022/12/post-100395.php
|
エスクラ氏は、この日を基準に日を数えることで、アステカ文明の天文学者たちが正確な日付を把握していた可能性があると指摘している。 |
2022-12-19 16:45:36 |
IT |
週刊アスキー |
アップル「M2 Max」、新たなベンチマークスコア登場 |
https://weekly.ascii.jp/elem/000/004/117/4117909/
|
macbookpro |
2022-12-19 16:45:00 |
IT |
週刊アスキー |
「FF ピクセルリマスター」シリーズがPS4とSwitchで来春配信決定! |
https://weekly.ascii.jp/elem/000/004/117/4117938/
|
nintendoswich |
2022-12-19 16:25:00 |
マーケティング |
AdverTimes |
JR SKISKI広告に南沙良「冬を取り戻すんだ。」テーマに今年もキャンペーン開始 |
https://www.advertimes.com/20221219/article407014/
|
jrskiski |
2022-12-19 07:51:04 |
マーケティング |
AdverTimes |
若手映像制作者を表彰「JAC AWARD 2022」6部門グランプリ決まる |
https://www.advertimes.com/20221219/article406999/
|
jacaward |
2022-12-19 07:43:33 |
コメント
コメントを投稿