Skip to content

Commit 88d583c

Browse files
authored
Merge pull request #47 from rackerlabs/more-fix
fix: formatting
2 parents 7d1b3b4 + 5e4d0db commit 88d583c

File tree

3 files changed

+563
-318
lines changed

3 files changed

+563
-318
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
date: 2024-07-15
3+
title: Installing Github actions on a Openstack-Flex Instance
4+
authors:
5+
- dereknoblej
6+
description: >
7+
Fortify Installing Github actions on a Openstack-Flex Instance
8+
categories:
9+
- General
10+
- Application
11+
- Server
12+
---
13+
# Installing Github actions on a Openstack-Flex Instance
14+
15+
## Introduction
16+
17+
Welcome! In this blog post we are going to go over connecting our Openstack-Flex instance to GitHub-actions through the use of self-hosted runners. We will be using an small Ubuntu image for our example, but if you would like a more in-depth look into setting up your environment please check out James’ blog post [here](https://blog.rackspacecloud.com/blog/2024/06/18/getting_started_with_rackspace_openstack_flex).
18+
19+
<!-- more -->
20+
21+
## Creating our Openstack-Flex Server
22+
23+
Fist we are going to create our Flex router.
24+
25+
``` shell
26+
openstack --os-cloud {cloud_name} router create flex-router
27+
```
28+
29+
Second we are we wil create our flex network
30+
31+
``` shell
32+
openstack --os-cloud {cloud_name} network create flex-network
33+
```
34+
35+
Next we are going to set our router's external gateway to PUBLICNET to grant access to the internet.
36+
37+
``` shell
38+
openstack --os-cloud {cloud_name} router set --external-gateway PUBLICNET flex-router
39+
```
40+
41+
Now we are going to set up our subnet, you can choose between ipv4 and ipv6. The ip range is also up to you. For the DNS name server you will need to ping cachens1.sjc3.rackspace.com and cachens2.sjc3.rackspace.com.
42+
43+
``` shell
44+
ping cachens1.sjc3.rackspace.com -c2
45+
ping cachens2.sjc3.rackspace.com -c2
46+
47+
openstack --os-cloud {cloud_name} subnet create --ip-version 4 --subnet-range 172.18.107.0/24 --dns-nameserver 216.109.154.188 --dns-nameserver 216.109.154.189 --network flex-network flex-subnet
48+
```
49+
50+
Connect the subnet to our flex-router
51+
52+
``` shell
53+
openstack --os-cloud {cloud_name} router add subnet flex-router flex-subnet
54+
```
55+
56+
Now we need to create our security group, this is the group which specify the network access rules. For our example now we are only going to allow SSH access.
57+
58+
``` shell
59+
openstack --os-cloud {cloud_name} security group create flex-sg
60+
```
61+
62+
``` shell
63+
openstack --os-cloud {cloud_name} security group rule create --ingress --remote-ip 0.0.0.0/0 --dst-port 22 --protocol tcp flex-sg
64+
```
65+
66+
Now we need to create our floating ip.
67+
68+
!!! note
69+
70+
Save this ip for later we will need to connect it to our server.
71+
72+
``` shell
73+
openstack --os-cloud {cloud_name} floating ip create --subnet PUBLICNET_SUBNET PUBLICNET
74+
```
75+
76+
Now we are going to create our Public and Private ssh keys so we can securely connect to our server. I am naming my key wordpress-key
77+
78+
``` shell
79+
ssh-keygen
80+
```
81+
This will prompt you store and name your private key. I did something like this /home/{username}/.ssh/flex-key.
82+
83+
After that we will create our public key using the command below then we will assign it using the the openstack cli tools.
84+
85+
``` shell
86+
ssh-keygen -f ~/.ssh/flex-key -y > ~/.ssh/flex-key.pub
87+
openstack —os-cloud {cloud_name} keypair create --public-key ~/.ssh/flex-key.pub flex-key
88+
```
89+
90+
Now we create our server! This should include the flavor you'd like to use, the image, memory, network, key-name, and security group for this example.
91+
92+
``` shell
93+
openstack --os-cloud {cloud_name} server create --flavor m1.medium --image Ubuntu-22.04 --boot-from-volume 40 --network flex-network --key-name flex-key --security-group flex-sg flex-server
94+
```
95+
96+
Assigning our floating ip. We can do this by adding it to our port for the server. If you get the fixed ip from our newly create server you can find the port ID by searching through the port list.
97+
98+
``` shell
99+
openstack --os-cloud {cloud_name} port list
100+
openstack --os-cloud {cloud_name} floating ip set --port {port id} {floating-ip}
101+
```
102+
103+
SSH into your new Server!
104+
105+
``` shell
106+
ssh -i ~/.ssh/flex-key ubuntu@{floating-ip}
107+
```
108+
109+
##Getting started with Github-Actions and Runners
110+
111+
For this example I created a github organization called Flex-git-actions, once you have your organization set-up you will need to go to settings and find the drop down menu “actions” and click “runners”. Once you have done that you should be looking at window like this.
112+
113+
![alt text](assets/images/2024-07-15/github-actions1.jpg)
114+
115+
Now I am using Linux for my server so that is the option I chose.
116+
117+
First thing we are going to do is create our actions-runner directory
118+
119+
``` shell
120+
mkdir actions-runner && cd actions-runner
121+
```
122+
123+
Then we are going to download the latest runner package, this can be found on GitHub under your organization as seen in the screenshot earlier. This example is just for convenience.
124+
125+
``` shell
126+
curl -o actions-runner-linux-x64-2.317.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.317.0/actions-runner-linux-x64-2.317.0.tar.gz
127+
```
128+
129+
``` shell
130+
tar xzf ./actions-runner-linux-x64-2.317.0.tar.gz
131+
```
132+
133+
Create the runner and start the configuration experience
134+
135+
``` shell
136+
./config.sh --url https://github.com/flex-git-actions --token ALTQQFVZPJW3L2WHXVR2RYTGSWHD6
137+
```
138+
139+
This last command should bring you to this screen.
140+
141+
![alt text](assets/images/2024-07-15/github-actions2.jpg)
142+
143+
Congratulations, you have installed github actions on your Openstack-Flex server!

0 commit comments

Comments
 (0)