Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.

Commit fdcafce

Browse files
committed
ansible: Add reposerver setup
1 parent 00194de commit fdcafce

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

ansible/main.yaml

+59
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,43 @@
100100
enabled: yes
101101
state: started
102102

103+
- name: Set up reposerver
104+
hosts: repos
105+
become: yes
106+
tasks:
107+
- name: Create application user
108+
ansible.builtin.user:
109+
name: reposerver
110+
create_home: false
111+
password: '!'
112+
shell: /usr/sbin/nologin
113+
umask: 0077
114+
- name: Install application
115+
ansible.builtin.copy:
116+
src: ./reposerver
117+
dest: /opt/reposerver/
118+
mode: 755
119+
- name: Allow nginx to read static files
120+
community.general.sefcontext:
121+
target: '/srv/staging.store.accrescent.app(/.*)?'
122+
setype: httpd_sys_content_t
123+
- name: Create static file directory
124+
ansible.builtin.file:
125+
path: /srv/staging.store.accrescent.app
126+
state: directory
127+
owner: reposerver
128+
group: reposerver
129+
mode: 0755
130+
- name: Install systemd service
131+
ansible.builtin.copy:
132+
src: ./reposerver.service
133+
dest: /usr/lib/systemd/system/reposerver.service
134+
- name: Enable and start systemd service
135+
ansible.builtin.systemd:
136+
name: reposerver
137+
enabled: yes
138+
state: started
139+
103140
- name: Set up nginx
104141
hosts: all
105142
become: yes
@@ -135,3 +172,25 @@
135172
ansible.builtin.systemd:
136173
name: nginx
137174
state: reloaded
175+
176+
- name: Set up nginx for reposerver
177+
hosts: repos
178+
become: yes
179+
tasks:
180+
- name: Allow nginx proxying
181+
ansible.posix.seboolean:
182+
name: httpd_can_network_connect
183+
persistent: yes
184+
state: yes
185+
- name: Install root config
186+
ansible.builtin.copy:
187+
src: nginx/reposerver.conf
188+
dest: /etc/nginx/nginx.conf
189+
- name: Install security config
190+
ansible.builtin.copy:
191+
src: nginx/security.conf
192+
dest: /etc/nginx/security.conf
193+
- name: Reload nginx
194+
ansible.builtin.systemd:
195+
name: nginx
196+
state: reloaded

ansible/reposerver.service

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[Unit]
2+
Description=Accrescent repo server
3+
4+
[Service]
5+
Environment="GIN_MODE=release"
6+
ExecStart=/opt/reposerver/reposerver
7+
WorkingDirectory=/srv/staging.store.accrescent.app
8+
9+
CapabilityBoundingSet=
10+
LockPersonality=yes
11+
MemoryDenyWriteExecute=yes
12+
NoNewPrivileges=yes
13+
PrivateDevices=yes
14+
PrivateTmp=yes
15+
PrivateUsers=yes
16+
ProtectClock=yes
17+
ProtectControlGroups=yes
18+
ProtectHome=yes
19+
ProtectHostname=yes
20+
ProtectKernelLogs=yes
21+
ProtectKernelModules=yes
22+
ProtectKernelTunables=yes
23+
ProtectProc=invisible
24+
ProtectSystem=strict
25+
ReadWritePaths=/srv/staging.store.accrescent.app
26+
RemoveIPC=yes
27+
RestrictAddressFamilies=AF_INET AF_INET6
28+
RestrictNamespaces=yes
29+
RestrictRealtime=yes
30+
RestrictSUIDSGID=yes
31+
SystemCallArchitectures=native
32+
UMask=0022
33+
User=reposerver
34+
35+
[Install]
36+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)