IT |
ITmedia 総合記事一覧 |
[ITmedia PC USER] サンワ、長時間でも快適に座れるメッシュ生地採用のビジネスチェア |
https://www.itmedia.co.jp/pcuser/articles/2206/13/news131.html
|
itmediapcuser |
2022-06-13 14:45:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] 軽BEV「日産サクラ」、発表から3週間で受注1万1000台以上に |
https://www.itmedia.co.jp/business/articles/2206/13/news130.html
|
itmedia |
2022-06-13 14:40:00 |
IT |
情報システムリーダーのためのIT情報専門サイト IT Leaders |
鹿島建設、基幹システムをERP「HUE」で刷新、年間100万枚の書類を削減 | IT Leaders |
https://it.impress.co.jp/articles/-/23314
|
hueac |
2022-06-13 14:19:00 |
Linux |
Ubuntuタグが付けられた新着投稿 - Qiita |
dockerコンテナを立ち上げたときに発生する`kernel BUG at include/linux/fs.h:3104!`の対応 |
https://qiita.com/raw8bridge/items/83ab32fc488631e52d1b
|
catetcissue |
2022-06-13 14:19:58 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
S3APIを使用してLocalStackにデータをPUTしてみる |
https://qiita.com/y5347M/items/537c540f82d476646bf3
|
httpsqi |
2022-06-13 14:58:00 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
dockerコンテナを立ち上げたときに発生する`kernel BUG at include/linux/fs.h:3104!`の対応 |
https://qiita.com/raw8bridge/items/83ab32fc488631e52d1b
|
catetcissue |
2022-06-13 14:19:58 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
dockerコンテナを立ち上げたときに発生する`kernel BUG at include/linux/fs.h:3104!`の対応 |
https://qiita.com/raw8bridge/items/83ab32fc488631e52d1b
|
catetcissue |
2022-06-13 14:19:58 |
GCP |
gcpタグが付けられた新着投稿 - Qiita |
dockerコンテナを立ち上げたときに発生する`kernel BUG at include/linux/fs.h:3104!`の対応 |
https://qiita.com/raw8bridge/items/83ab32fc488631e52d1b
|
catetcissue |
2022-06-13 14:19:58 |
技術ブログ |
Developers.IO |
What is Amazon SQS? |
https://dev.classmethod.jp/articles/what-is-amazon-sqs/
|
What is Amazon SQS When two services needed to communicate in the past one service would make an api call to notify the other se |
2022-06-13 05:39:51 |
海外TECH |
DEV Community |
Create a Docker based Self Hosted GitHub runner Linux container |
https://dev.to/pwd9000/create-a-docker-based-self-hosted-github-runner-linux-container-48dh
|
Create a Docker based Self Hosted GitHub runner Linux container OverviewAll the code used in this tutorial can be found on my GitHub project docker github runner linux Welcome to Part of my series Self Hosted GitHub Runner containers on Azure In part one of this series we looked at how we can create a windows container image using docker and then running our self hosted GitHub runners as containers In this part we will focus on building a Linux based Ubuntu image instead In subsequent parts we will look at how we can utilize Azure to store and run our containers in the cloud using Azure Container Registry ACR Azure Container Instances ACI and Azure Container Apps ACA to run and scale our self hosted GitHub runners instead of using a VM based approach with docker running inside of a VM Setup environmentAs also described in part one before building and running docker images we need to set a few things up first For my environment I will be using a Windows virtual machine running WSL Here is more information on running docker on Windows Server Things that we will need on our VM are Install a code editor such as VSCodeInstall and enable WSL For more information see how to enable WSL Open PowerShell as administrator and run wsl installAfter WSL is installed run Enable WindowsOptionalFeature Online FeatureName Microsoft Hyper V Containers AllNOTE You will need to reboot the system after adding the relevant features above Download and Install Docker Desktop For Windows This will automatically also install Docker Compose Once Docker Desktop For Windows is installed you need to switch to Linux containers Use the Docker item in the Windows system tray NOTE Linux containers is the default setting so if you skipped part one of this series Docker Desktop For Windows will already be set to use Linux Containers by default Prepare Bash Scripts used in image creationNow that we have Docker Desktop as well as Docker Compose installed and set to use Linux Containers we can start to build out our self hosted GitHub runner docker image Open VSCode you can clone the repo found on my GitHub project docker github runner linux which contains all the files or simply follow along with the following steps We will prepare a script that will be needed as part of our docker image creation Create a root folder called docker github runner linux and then another sub folder called scripts Inside of the scripts folder you can create the following script start shThis script will be used as our ENTRYPOINT script and will be used to bootstrap our docker container when we start run a container from the image we will be creating The main purpose of this script is to register a new self hosted GitHub runner instance on the repo we pass into the docker environment each time a new container is spun up or scaled up from the image bin bashGH OWNER GH OWNERGH REPOSITORY GH REPOSITORYGH TOKEN GH TOKENRUNNER SUFFIX cat dev urandom tr dc a z fold w head n RUNNER NAME dockerNode RUNNER SUFFIX REG TOKEN curl sX POST H Accept application vnd github v json H Authorization token GH TOKEN GH OWNER GH REPOSITORY actions runners registration token jq token raw output cd home docker actions runner config sh unattended url GH OWNER GH REPOSITORY token REG TOKEN name RUNNER NAME cleanup echo Removing runner config sh remove unattended token REG TOKEN trap cleanup exit INTtrap cleanup exit TERM run sh amp wait Prepare dockerfile to build image Linux Now with our scripts ready we can get to the fun part Building the linux docker image Navigate back to the root folder and create a file called dockerfile dockerfileThis dockerfile contains the instructions to build our container image base imageFROM ubuntu input GitHub runner version argumentARG RUNNER VERSIONENV DEBIAN FRONTEND noninteractiveLABEL Author Marcel L LABEL Email pwd hotmail co uk LABEL GitHub LABEL BaseImage ubuntu LABEL RunnerVersion RUNNER VERSION update the base packages add a non sudo userRUN apt get update y amp amp apt get upgrade y amp amp useradd m docker install the packages and dependencies along with jq so we can parse JSON add additional packages as necessary RUN apt get install y no install recommends curl nodejs wget unzip vim git azure cli jq build essential libssl dev libffi dev python python venv python dev python pip cd into the user directory download and unzip the github actions runnerRUN cd home docker amp amp mkdir actions runner amp amp cd actions runner amp amp curl O L RUNNER VERSION actions runner linux x RUNNER VERSION tar gz amp amp tar xzf actions runner linux x RUNNER VERSION tar gz install some additional dependenciesRUN chown R docker docker amp amp home docker actions runner bin installdependencies sh add over the start sh scriptADD scripts start sh start sh make the script executableRUN chmod x start sh set the user to docker so all subsequent commands are run as the docker userUSER docker set the entrypoint to the start sh scriptENTRYPOINT start sh Let s take a closer look and see what this docker build file will actually do step by step base imageFROM ubuntu The FROM instruction will tell our docker build to fetch and use an Ubuntu OS base image We will add additional configuration to this base image next input GitHub runner version argumentARG RUNNER VERSIONENV DEBIAN FRONTEND noninteractiveLABEL Author Marcel L LABEL Email pwd hotmail co uk LABEL GitHub LABEL BaseImage ubuntu LABEL RunnerVersion RUNNER VERSION We define an input argument using ARG This is so that we can instruct the docker build command to load a specific version of the GitHub runner agent into the image when building the image Because we are using a linux container ARG will create a system variable RUNNER VERSION which will be accessible to Bash inside the container We also set an Environment Variable called DEBIAN FRONTEND to noninteractive with ENV this is so that we can run commands later on in unattended mode In addition we can also label our image with some metadata using LABEL to add more information about the image You can change these values as necessary NOTE LABEL RunnerVersion RUNNER VERSION this label is dynamically updated from the build argument we will be passing into the docker build command later update the base packages add a non sudo userRUN apt get update y amp amp apt get upgrade y amp amp useradd m docker install the packages and dependencies along with jq so we can parse JSON add additional packages as necessary RUN apt get install y no install recommends curl nodejs wget unzip vim git azure cli jq build essential libssl dev libffi dev python python venv python dev python pipThe first RUN instruction will update the base packages on the Ubuntu image and add a non sudo user called docker The second RUN will install packages and dependencies such as git Azure CLI python along with jq so we can parse JSON for the token in our ENTRYPOINT script NOTE You can add additional packages as necessary at this stage but try not to install too many packages at build time to keep the image as lean compact and re usable as possible You can always use a GitHub Action later in a workflow when running the container and use actions to install more tooling I will be showing how we can add more software and tooling e g Terraform later on when we run our container using a GitHub Action cd into the user directory download and unzip the github actions runnerRUN cd home docker amp amp mkdir actions runner amp amp cd actions runner amp amp curl O L RUNNER VERSION actions runner linux x RUNNER VERSION tar gz amp amp tar xzf actions runner linux x RUNNER VERSION tar gz install some additional dependenciesRUN chown R docker docker amp amp home docker actions runner bin installdependencies shThe next RUN instruction will create a new folder called actions runner and download and extract a specific version of the GitHub runner binaries based on the build argument ARG value passed into the container build process that sets the environment variable RUNNER VERSION as described earlier A few more additional dependencies are also installed from the extracted GitHub runner files add over the start sh scriptADD scripts start sh start sh make the script executableRUN chmod x start sh set the user to docker so all subsequent commands are run as the docker userUSER docker set the entrypoint to the start sh scriptENTRYPOINT start sh The last section will ADD the ENTRYPOINT script named start sh to the image The entrypoint script will run each time a new container is created It acts as a bootstrapper that will based on specific environment variables we pass into the Docker Run command such as GH OWNER GH REPOSITORY and GH TOKEN to register the containers self hosted runner agent against a specific repository in the GitHub organisation we specify Now that we have our scripts as well as our dockerfile ready we can build our image NOTE We can build and run the linux container images using docker desktop or docker compose I will show both methods next Building the Docker Image Docker Desktop Linux In VSCode terminal or a PowerShell session navigate to the root folder containing the docker file and run the following command Remember we need to pass in a build argument to tell docker what version of the GitHub runner agent to use in the image creation GitHub Runner Releases Build container docker build OPTIONS PATHdocker build build arg RUNNER VERSION tag docker github runner lin The build process can take a little while to complete Once the process is complete you will see the new image in Docker Desktop for Windows under images Run the Docker Image Docker Desktop Linux To run and provision a new self hosted GitHub runner linux container from the image we just created run the following command We have to pass in some environment variables using the e option to specify the PAT Personal Access Token GitHub Organisation and Repository to register the runner against Run container from image docker run e GH TOKEN myPatToken e GH OWNER orgName e GH REPOSITORY repoName d image nameSee creating a personal access token on how to create a GitHub PAT token PAT tokens are only displayed once and are sensitive so ensure they are kept safe The minimum permission scopes required on the PAT token to register a self hosted runner are repo read org Tip I recommend only using short lived PAT tokens and generating new tokens whenever new agent runner registrations are required After running this command under the GitHub repository settings you will see a new self hosted GitHub runner This is our docker container You will also be able to see the running container under Docker Desktop for Windows under Containers Lets test our new docker container self hosted GitHub runner by creating a GitHub workflow to run a few GitHub Actions by installing Terraform on the running container You can use this test workflow from my GitHub project docker github runner linux Create a new workflow under the GitHub repository where you deployed the self hosted runner where it s running name Local runner teston workflow dispatch jobs testRunner runs on self hosted steps uses actions checkout v name Install Terraform uses hashicorp setup terraform v name Display Terraform Version run terraform version name Display Azure CLI Version run az versionNotice that the workflow runs on self hosted We can now use the following step to install Terraform steps name Install Terraform uses hashicorp setup terraform v name Display Terraform Version run terraform versionTo add additional docker runners containers we just simply re run the docker command we ran earlier Each run will create an additional runner instance container Run container from image docker run e GH TOKEN myPatToken e GH OWNER orgName e GH REPOSITORY repoName d image nameNext we will look at stopping destroying our running docker instances and cleaning up the registrations for all the self hosted runners registered against our GitHub repository To stop and remove all running containers simply run docker stop docker ps aq amp amp docker rm docker ps aq You will notice that all the running containers under Docker Desktop for Windows are no longer there as well as the docker node registrations against our GitHub repository has also been cleaned up and removed The reason our GitHub runner registrations are also removed is because of the cleanup code inside of our ENTRYPOINT script start sh that will automatically trigger a cleanup of the runner registration when the docker container is stopped and destroyed cleanup echo Removing runner config sh remove unattended token REG TOKEN trap cleanup exit INTtrap cleanup exit TERMNext we will look how we can build the image and also run our image at scale using docker compose Building the Docker Image Docker Compose Linux As we saw earlier it is pretty easy to build our image using docker commands but we can also use docker compose with a configuration file to make things a bit easier So following on navigate to the root folder again that contains the dockerfile we created earlier and create a new YAML file called docker compose yml version services runner image pwd github runner lin latest build context args RUNNER VERSION environment GH TOKEN GH TOKEN GH OWNER GH OWNER GH REPOSITORY GH REPOSITORY In the docker compose configuration file we can set out the parameters for our docker image by specifying things like the image name GitHub runner version as well as our environment variables Note that we have to set these environment variables on our host windows machine in order for docker compose to be able to interpret the values specified on the YAML file inside of the symbols This can easily be done by running the following PowerShell commands on the windows host set system environment with env or use env file to pass GH TOKEN GH OWNER GH REPOSITORY env GH OWNER Org Owner env GH REPOSITORY Repository env GH TOKEN myPatToken NOTE You can also use an environment file instead to pass environment variables onto the docker compose build process using a docker compose yml file like this instead version services runner image pwd github runner lin latest build context args RUNNER VERSION env file variables envThis method however requires us to create another file in the root of our working folder called variables env and populating this file with our environment variables like so GH OWNER orgNameGH REPOSITORY repoNameGH TOKEN myPatTokenIMPORTANT Don t use this method and don t commit this file to source control if you are using sensitive values and storing your code in a remote source control repository Add this environment file to your gitignore file if needed so that it is not pushed into source control Which ever method you decide to use you can kick off the build process after creating this docker compose yml file by running the following PowerShell command docker compose buildOnce the process is complete you will see the new image in Docker Desktop for Windows under images Run and scale the Docker Image Docker Compose Windows What s nice about using docker compose is that we can easily scale the amount of runners we want to use simply by running the following command docker compose up scale runner dBecause all of our configuration and details are kept in environment variables and the docker compose YAML file we don t really have to run long docker commands as we did earlier and we simply scale the amount of runners we want by specifying the scale parameter NOTE The scale runner d parameter is based on the docker compose file services setting which in our case is called runner services runner To scale down to one runner we can simply rerun the command as follow docker compose up scale runner dTo stop and remove all running containers simply run docker compose stopdocker rm docker ps aq As described earlier you will notice that all the running containers under Docker Desktop for Windows are no longer there as well as the registrations against our GitHub repository have been cleaned up In this part of the blog series we have covered how you can build and run self hosted Github runners as linux containers using docker desktop and docker compose In the next part of this blog series we will take a look at hosting our GitHub runner containers in a remote registry in Azure using Azure Container Registry ACR I hope you have enjoyed this post and have learned something new You can find the code samples used in this blog post on my Github page ️ AuthorLike share follow me on GitHub Twitter LinkedIn Marcel LFollow Microsoft DevOps MVP Cloud Solutions amp DevOps Architect Technical speaker focussed on Microsoft technologies IaC and automation in Azure Find me on GitHub |
2022-06-13 05:37:25 |
海外TECH |
DEV Community |
FoalTS 2022 survey is open! |
https://dev.to/loicpoullain/foalts-2022-survey-is-open-117c
|
FoalTS survey is open FoalTS survey is now open yes a few months late Your responses to these questions are really valuable as they help me better understand what you need and how to improve the framework going forward I read every response carefully so feel free to say anything you have to say The link to the survey The survey closes on June |
2022-06-13 05:31:38 |
金融 |
ニッセイ基礎研究所 |
数字の「13」に関わる各種の話題-「13」は西洋では忌み数として嫌われているようだが- |
https://www.nli-research.co.jp/topics_detail1/id=71411?site=nli
|
各カードが枚となっている理由については、いろいろな説があるが、基本的にはトランプが年を表しているからと言われているようだ。 |
2022-06-13 14:02:45 |
海外ニュース |
Japan Times latest articles |
U.S. gun deal is less than Democrats wanted, but more than they expected |
https://www.japantimes.co.jp/news/2022/06/13/world/politics-diplomacy-world/us-gun-deal-congress/
|
serious |
2022-06-13 14:32:44 |
ニュース |
BBC News - Home |
Rwanda asylum plan: Number of people on first flight in 'single figures' |
https://www.bbc.co.uk/news/uk-61779845?at_medium=RSS&at_campaign=KARANGA
|
asylum |
2022-06-13 05:43:34 |
ニュース |
BBC News - Home |
Northern Ireland Protocol: Legislation to scrap parts to be published |
https://www.bbc.co.uk/news/uk-northern-ireland-61779169?at_medium=RSS&at_campaign=KARANGA
|
brandon |
2022-06-13 05:53:15 |
ニュース |
BBC News - Home |
Operose Health: UK’s biggest GP chain replacing doctors with less qualified staff |
https://www.bbc.co.uk/news/health-61759643?at_medium=RSS&at_campaign=KARANGA
|
operose |
2022-06-13 05:00:55 |
ニュース |
BBC News - Home |
The Papers: PM warned over NI plans and death of Ukraine hero |
https://www.bbc.co.uk/news/blogs-the-papers-61779212?at_medium=RSS&at_campaign=KARANGA
|
papers |
2022-06-13 05:11:36 |
ニュース |
BBC News - Home |
Catholic Church sexual abuse survivor wants Pope Francis to listen |
https://www.bbc.co.uk/news/uk-wales-61747519?at_medium=RSS&at_campaign=KARANGA
|
priest |
2022-06-13 05:19:36 |
ニュース |
BBC News - Home |
Darwin Nunez: Liverpool reach agreement with Benfica for Uruguay striker |
https://www.bbc.co.uk/sport/football/61780578?at_medium=RSS&at_campaign=KARANGA
|
portuguese |
2022-06-13 05:36:19 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
客船クルーズ値下げ、コスト高でも続くワケ - WSJ発 |
https://diamond.jp/articles/-/304747
|
客船 |
2022-06-13 14:04:00 |
北海道 |
北海道新聞 |
ヤクルト村上、初の交流戦MVP 大山と杉本に日本生命賞 |
https://www.hokkaido-np.co.jp/article/692785/
|
日本生命 |
2022-06-13 14:37:00 |
北海道 |
北海道新聞 |
別姓の婚姻届、不受理に 東京家裁に不服申し立てへ |
https://www.hokkaido-np.co.jp/article/692760/
|
想田和弘 |
2022-06-13 14:15:03 |
北海道 |
北海道新聞 |
阿寒湖「カムイルミナ」18日開幕 11月まで夜の遊歩道 映像で彩る |
https://www.hokkaido-np.co.jp/article/692611/
|
体験型観光 |
2022-06-13 14:01:22 |
IT |
週刊アスキー |
特別に蒸溜所より用意した原酒などをテイスティング! 京王プラザホテルが1日限りの「イチローズモルト~秩父蒸溜所を味わう~」8月7日開催 |
https://weekly.ascii.jp/elem/000/004/094/4094466/
|
京王プラザホテル |
2022-06-13 14:30:00 |
海外TECH |
reddit |
Mom found a vibrator in ma room charging. now dont know what to do. tips? |
https://www.reddit.com/r/AskReddit/comments/vb4j8b/mom_found_a_vibrator_in_ma_room_charging_now_dont/
|
Mom found a vibrator in ma room charging now dont know what to do tips submitted by u katediz to r AskReddit link comments |
2022-06-13 05:10:06 |
ニュース |
THE BRIDGE |
Z世代特化スタートアップ支援「Culture Z Park」注目の4社決定、7月9日に最終発表会 |
https://thebridge.jp/2022/06/culture-z-park-finalist
|
Z世代特化スタートアップ支援「CultureZPark」注目の社決定、月日に最終発表会Z世代に特化した起業家コミュニティCultureZParkを運営するduocは月日、支援プログラム「CultureZInnovation」の最終選考に残った社を発表している。 |
2022-06-13 05:37:11 |
コメント
コメントを投稿