Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

circle_ci_setup.sh 3.0 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
  1. # Setup Docker and update system
  2. sudo apt-get update
  3. sudo apt-get upgrade -y
  4. sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
  5. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  6. echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  7. sudo apt update
  8. curl -fsSL https://get.docker.com -o get-docker.sh
  9. sudo sh get-docker.sh
  10. # Add cloud user to docker group
  11. sudo usermod -aG docker ubuntu
  12. sudo usermod -aG docker $USER
  13. newgrp docker
  14. # Start configuration of self-hosted machine
  15. # Download the launch agent binary and verify the checksum
  16. mkdir configurations
  17. cd configurations
  18. curl https://raw.githubusercontent.com/CircleCI-Public/runner-installation-files/main/download-launch-agent.sh > download-launch-agent.sh
  19. export platform=linux/amd64 && sh ./download-launch-agent.sh
  20. # Create the circleci user & working directory
  21. id -u circleci &>/dev/null || sudo adduser --disabled-password --gecos GECOS circleci
  22. sudo mkdir -p /var/opt/circleci
  23. sudo chmod 0750 /var/opt/circleci
  24. sudo chown -R circleci /var/opt/circleci /opt/circleci/circleci-launch-agent
  25. # Create a CircleCI runner configuration
  26. sudo mkdir -p /etc/opt/circleci
  27. sudo touch /etc/opt/circleci/launch-agent-config.yaml
  28. sudo nano /etc/opt/circleci/launch-agent-config.yaml
  29. # Add API in the file and change permissions
  30. api:
  31. auth_token: a504e0150ab038d7414dff32ea67085acb19dd8aa32507955e5fdba0db0128565f09dbb05543cd9e
  32. runner:
  33. name: self-hosted
  34. working_directory: /var/opt/circleci/workdir
  35. cleanup_working_directory: true
  36. sudo chown circleci: /etc/opt/circleci/launch-agent-config.yaml
  37. sudo chmod 600 /etc/opt/circleci/launch-agent-config.yaml
  38. # Enable the systemd unit
  39. sudo touch /usr/lib/systemd/system/circleci.service
  40. sudo nano /usr/lib/systemd/system/circleci.service
  41. # Put Content in the circleci.service
  42. [Unit]
  43. Description=CircleCI Runner
  44. After=network.target
  45. [Service]
  46. ExecStart=/opt/circleci/circleci-launch-agent --config /etc/opt/circleci/launch-agent-config.yaml
  47. Restart=always
  48. User=circleci
  49. NotifyAccess=exec
  50. TimeoutStopSec=18300
  51. [Install]
  52. WantedBy = multi-user.target
  53. sudo chown root: /usr/lib/systemd/system/circleci.service
  54. sudo chmod 644 /usr/lib/systemd/system/circleci.service
  55. # Start CircleCI
  56. sudo systemctl enable circleci.service
  57. sudo systemctl start circleci.service
  58. ## Add circleci to sudo group
  59. sudo usermod -aG docker circleci
  60. sudo usermod -a -G docker circleci
  61. newgrp docker
  62. sudo systemctl status circleci.service
  63. ## Install AWS CLI
  64. curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
  65. sudo apt install unzip
  66. unzip awscliv2.zip
  67. sudo ./aws/install
  68. sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update
  69. # add them inside environment variables
  70. AWS_ACCESS_KEY_ID
  71. AWS_SECRET_ACCESS_KEY
  72. AWS_REGION
  73. AWS_ECR_REGISTRY_ID
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...