Comments (16)
@snussik thank you for the discovery!
In the meantime, @lielran found that the Docker container actions don't run on the self-hosted runner and created PR #11 for that.
So I will check both your ideas together as the action should be a bit updated in order to run any kind of action on it.
yes, I've tried to install docker via user-data and also used ready-made AMI with docker.
but the action wasn't able to access docker-engine due to permissions issues.
from ec2-github-runner.
@machulav yep, it's a common "problem" with this bash script. Dumb working receipt is:export RUNNER_ALLOW_RUNASROOT=1
and then run ./run.sh
from ec2-github-runner.
@machulav yep, it's a common "problem" with this bash script. Dumb working receipt is:
export RUNNER_ALLOW_RUNASROOT=1
and then run./run.sh
Boom! works like magic.
Thanks for the comment on this "Dumb" workaround that saves me hours of debugging
from ec2-github-runner.
Wow, very nice! 🎉
@lielran May I ask you to describe your use case a bit? What do you use the self-hosted runner for and why is it important in your CD pipeline?
Sure,
we are using flyway to align our DB schema (rds,pg). the db is running in isolated subnet without(direct) internet access. the easist thing to do is run the migration from within the vpc on a public subnet(application subnet).
from ec2-github-runner.
@snussik have you found the issue?
As I see, you set up the workflow for the master
branch. But there is no master
branch for this repository. The main branch here is the main
. I hope it helps.
from ec2-github-runner.
@machulav hi! Yep, I've discovered it. And I have a new problem now )) When I create remote runner on aws and try to run npm ci
(or npm install
), I get:
npm ERR! correctMkdir failed to make directory /home/github/.npm/_locks
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /home/github
npm ERR! errno -13
The commands: whoami
shows that bash runs under the github
user.
The part of workflow file, is:
# Test WF for GA
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
start-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_RUNNER }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_RUNNER }}
aws-region: ${{ secrets.AWS_REGION_RUNNER }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/[email protected]
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ami-02501629bfc260e9c
ec2-instance-type: t2.micro
subnet-id: subnet-04850abda92c62906
security-group-id: sg-0fda70c804d158ece
do-the-job:
name: Do the job on the runner
runs-on: ${{needs.start-runner.outputs.label}} # run the job on the newly created runner
needs: start-runner # required to start the main job when the runner is ready
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.18.2
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Build
run: |
whoami
npm ci
Is that related to AWS Credentials? I thought that github user runs ints workflow under needed permissons inside the runner instance?
from ec2-github-runner.
@machulav found out with npm config list
that npm HOME
variable is set in /home/github
. That is why npm tries to mkdir in /home/github and meets EACCES
error in this dir.
I think that it's a problem of self-hosted runners when you create new users in them, as on GitHub hosted runner or even sell-hosted, created in order with official GitHub doc doesn't have such problem.
from ec2-github-runner.
I think that in aws.js (on line 11) it should be something like:
useradd -m -d /home/actions-runner && cd /home/actions-runner
from ec2-github-runner.
@snussik thank you for the discovery!
In the meantime, @lielran found that the Docker container actions don't run on the self-hosted runner and created PR #11 for that.
So I will check both your ideas together as the action should be a bit updated in order to run any kind of action on it.
from ec2-github-runner.
Yeah, as both of you pointed, there is a general issue with permissions. So I renamed the issue to correspond to that.
The main reason why I create github
user is the following: all the bootstrap scripts from ./src/aws.js
entered as user data and run as the root user. At the same time, GitHub's run.sh
can not be run as a root.
from ec2-github-runner.
The RUNNER_ALLOW_RUNASROOT
fixed the issue!
Also, I've made a couple of additional improvements. See more details in PR #14. I hope it helps.
Later I will create a new release with these changes.
Please note that to reduce the scope of changes and testing, I limited supported Linux distributive to only Amazon Linux 2.
In the future, I'm going to add support for the other distributive if required.
@lielran @snussik thank you for your support and contributions! It means a lot!
You, folks, really motivate me to continue working on the action! 🙌
from ec2-github-runner.
The
RUNNER_ALLOW_RUNASROOT
fixed the issue!
Also, I've made a couple of additional improvements. See more details in PR #14. I hope it helps.
Later I will create a new release with these changes.Please note that to reduce the scope of changes and testing, I limited supported Linux distributive to only Amazon Linux 2.
In the future, I'm going to add support for the other distributive if required.@lielran @snussik thank you for your support and contributions! It means a lot!
You, folks, really motivate me to continue working on the action! 🙌
here is the final result, we are already using it in our CD pipeline.
from ec2-github-runner.
Wow, very nice! 🎉
@lielran May I ask you to describe your use case a bit? What do you use the self-hosted runner for and why is it important in your CD pipeline?
from ec2-github-runner.
Cool! Thank you for the information!
from ec2-github-runner.
@lielran I am slo planning to use this and flyway. Can you please share an example action and your flyway setup?
from ec2-github-runner.
@lielran I am slo planning to use this and flyway. Can you please share an example action and your flyway setup?
I personally moved to use hosted Github runners on the VPC and also plan to move to GitHub action code build
from ec2-github-runner.
Related Issues (20)
- stop action fails to find Github runner though the labeled runner does exist HOT 2
- Runners fail to register when IPs/hostnames are reused HOT 4
- Instance role when added not working HOT 2
- update the options for github runner setup script (config.sh)
- Runner is up and running but job isn't running on selfhosted runner HOT 2
- Support for c7g instances. HOT 1
- Add missing library to README / Arm64
- Make ec2-github-runner working with GITHUB_TOKEN generated into the Github Action workflow HOT 3
- EBS Volume doesn't get deleted HOT 1
- [feature request] make to be installed github runner version configurable
- [feature request] Make configurable pre-commands in user-data possible HOT 1
- is there a way to pass additional parameter to ec2 instance, like enable detail monitor? HOT 2
- Github Runner - not able to register itself in GitHub as a new self-hosted runner HOT 1
- [feature request] Allow use of Fine-grained personal access tokens
- Issue starting runner HOT 1
- [feature request] Allow requesting spot instance instead of an on-demand instance. HOT 7
- Error regarding ec2 os input HOT 1
- Unable to register self-hosted runner HOT 6
- Support node 20 HOT 2
- Setting up GitHub Self-Hosted Runner On-Demand: Permission Denied Error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ec2-github-runner.