Skip to content

Commit 9be8dc0

Browse files
committed
awx
1 parent b7efb0b commit 9be8dc0

21 files changed

+774
-0
lines changed

apps/awx/.env

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
W9_VERSION=22.5.0
2+
W9_ID=awx
3+
W9_POWER_PASSWORD=jxEiaLzsNBLVRQcQwueJ
4+
W9_REPO=quay.io/ansible/awx
5+
6+
#### -- Not allowed to edit below environments when recreate app based on existing data -- ####
7+
W9_HTTP_PORT=8052
8+
W9_HTTP_PORT_SET=9001
9+
W9_URL=InternetIP
10+
W9_LOGIN_USER=admin
11+
W9_LOGIN_PASSWORD=$W9_POWER_PASSWORD
12+
W9_DB_EXPOSE="postgresql"
13+
W9_NETWORK=websoft9
14+
#### -------------------------------------------------------------------------------------- ####
15+
16+
PGDATA=/var/lib/postgresql/data/pgdata
17+
PASSWORD=$W9_POWER_PASSWORD
18+
RECEPTOR_RELEASE_WORK=False
19+
SDB_HOST=0.0.0.0
20+
SDB_PORT=7899
21+
AWX_GROUP_QUEUES=tower
22+
MAIN_NODE_TYPE="${MAIN_NODE_TYPE:-hybrid}"
23+
RECEPTORCTL_SOCKET=/var/run/awx-receptor/receptor.sock
24+
CONTROL_PLANE_NODE_COUNT=1
25+
EXECUTION_NODE_COUNT=0
26+
AWX_LOGGING_MODE=stdout
27+
UWSGI_MOUNT_PATH=/
28+
RUN_MIGRATIONS=1
29+

apps/awx/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CHANGELOG
2+
3+
## Release
4+
### Fixes and Enhancements
5+

apps/awx/Dockerfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
FROM quay.io/ansible/awx:22.5.0
2+
3+
ENV LANG en_US.UTF-8
4+
ENV LANGUAGE en_US:en
5+
ENV LC_ALL en_US.UTF-8
6+
ENV AWX_LOGGING_MODE stdout
7+
8+
9+
USER root
10+
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
11+
ADD https://copr.fedorainfracloud.org/coprs/ansible/Rsyslog/repo/epel-9/ansible-Rsyslog-epel-9.repo /etc/yum.repos.d/ansible-Rsyslog-epel-9.repo
12+
# Install runtime requirements
13+
RUN dnf -y update && dnf install -y 'dnf-command(config-manager)' && \
14+
dnf config-manager --set-enabled crb && \
15+
dnf -y install acl \
16+
git-core \
17+
git-lfs \
18+
glibc-langpack-en \
19+
krb5-workstation \
20+
nginx \
21+
"openldap >= 2.6.2-3" \
22+
postgresql \
23+
rsync \
24+
rsyslog-8.2102.0-106.el9 \
25+
subversion \
26+
sudo \
27+
vim-minimal \
28+
which \
29+
unzip \
30+
crun \
31+
gdb \
32+
gtk3 \
33+
gettext \
34+
hostname \
35+
procps \
36+
alsa-lib \
37+
libX11-xcb \
38+
libXScrnSaver \
39+
iproute \
40+
strace \
41+
vim \
42+
nmap-ncat \
43+
libpq-devel \
44+
nodejs \
45+
nss \
46+
make \
47+
patch \
48+
socat \
49+
tmux \
50+
wget \
51+
diffutils \
52+
unzip && \
53+
dnf -y clean all
54+
RUN rm -rf /root/.cache && rm -rf /tmp/*
55+
RUN dnf --enablerepo=baseos-debug -y install python3-debuginfo || :
56+
RUN dnf install -y epel-next-release && dnf install -y inotify-tools && dnf remove -y epel-next-release
57+
RUN dnf install -y podman && rpm --restore shadow-utils 2>/dev/null
58+
RUN sed -i -e 's|^#mount_program|mount_program|g' -e '/additionalimage.*/a "/var/lib/shared",' -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' /etc/containers/storage.conf
59+
RUN mkdir -p /etc/containers/registries.conf.d/ && echo "unqualified-search-registries = []" >> /etc/containers/registries.conf.d/force-fully-qualified-images.conf && chmod 644 /etc/containers/registries.conf.d/force-fully-qualified-images.conf
60+
ADD src/config/podman-containers.conf /var/lib/awx/.config/containers/containers.conf
61+
RUN /var/lib/awx/venv/awx/bin/pip install "ansible-core>=2.15.0rc2,<2.16" --no-cache-dir
62+
COPY --from=quay.io/ansible/awx-ee:22.5.0 /usr/bin/receptor /usr/bin/receptor
63+
ENV PATH="/var/lib/awx/venv/awx/bin/:${PATH}"
64+
ENTRYPOINT ["dumb-init", "--"]

apps/awx/Notes.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## AWX
2+
3+
AWX 官方为了用户更灵活的部署,提供了个性化比较强的 [docker 安装方法](ttps://github.com/ansible/awx/tree/22.5.0/tools/docker-compose)
4+
5+
本文档完全是基于ansible官方改造完成 [docker-compose](https://github.com/ansible/awx/tree/22.5.0/tools/docker-compose)
6+
7+
它主要包括两个步骤:
8+
9+
1. 构建镜像
10+
11+
![](https://img-1251935913.cos.ap-beijing.myqcloud.com/to/image-20230801004445721.png)
12+
13+
2. 利用 Ansible 生成 docker-compose.yml 文件以及其他配置文件
14+
3. 根据生成的docker-compose改造。
15+
16+
其中一些脚本和配置都是通过 [Makefile](https://github.com/ansible/awx/blob/22.5.0/Makefile))和[bootstrap_development.sh](https://github.com/ansible/awx/blob/22.5.0/tools/docker-compose/bootstrap_development.sh)改造而来的!
17+
18+
19+
20+
启动时记得修改 `.evn`中的PASSWORD的值,会自动生成admin管理员的账号密码和postgres的密码!
21+
22+
![image-20230801003911132](https://img-1251935913.cos.ap-beijing.myqcloud.com/to/image-20230801003911132.png)

apps/awx/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# AWX on Docker
2+
3+
This is an **Docker Compose solution** powered by [Websoft9](https://www.websoft9.com) based on Docker for AWX:
4+
5+
6+
- community: 22.5.0
7+
8+
9+
## System Requirements
10+
11+
The following are the minimal [recommended requirements](https://github.com/awx/docker#recommended-system-requirements):
12+
13+
* **RAM**: 4 GB or more
14+
* **CPU**: 2 cores or higher
15+
* **Disk**: at least 1 GB of free space
16+
* **bandwidth**: more fluent experience over 100M
17+
18+
## Install
19+
20+
You can install this AWX by [How to use it?](https://github.com/Websoft9/docker-library#how-to-use-it).
21+
22+
If you want use AWX with **Websoft9 Business Support** free, you can [subscribe AWX](https://www.websoft9.com/apps) on Cloud platform
23+
24+
## Documentation
25+
26+
[AWX Administrator Guide](https://support.websoft9.com/docs/awx) powered by Websoft9

apps/awx/docker-compose.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# AWX default user: admin password: 123456 port:80
2+
# postgres user: awx password: 123456
3+
4+
version: "3.8"
5+
services:
6+
web:
7+
image: ${W9_REPO}:${W9_VERSION}
8+
container_name: ${W9_ID}
9+
depends_on:
10+
- redis
11+
- rsyslog
12+
hostname: awxweb
13+
user: root
14+
restart: unless-stopped
15+
env_file: .env
16+
command: /usr/bin/launch_awx_web.sh
17+
volumes:
18+
- projects:/var/lib/awx/projects/
19+
- rsyslog-socket:/var/run/awx-rsyslog/
20+
- awx-receptor:/var/run/awx-receptor/
21+
- "./src/config/SECRET_KEY:/etc/tower/SECRET_KEY"
22+
- "./src/config/supervisord_web.conf:/etc/supervisord_web.conf"
23+
- "./src/config/settings.py:/etc/tower/settings.py"
24+
- "./src/config/local_settings.py:/etc/tower/local_settings.py"
25+
- "./src/config/websocket_secret.py:/etc/tower/websocket_secret.py"
26+
- "./src/config/nginx.conf:/etc/nginx/nginx.conf"
27+
- "./src/config/credentials.py:/etc/tower/conf.d/credentials.py"
28+
- "./src/config/receptor/receptor-awx.conf:/etc/receptor/receptor.conf"
29+
- "./src/config/receptor/receptor-awx-1.conf.lock:/etc/receptor/receptor.conf.lock"
30+
- redis-socket:/var/run/redis/
31+
- "/sys/fs/cgroup:/sys/fs/cgroup"
32+
- shared:/var/lib/shared
33+
privileged: true
34+
tty: true
35+
environment:
36+
http_proxy:
37+
https_proxy:
38+
no_proxy:
39+
ports:
40+
- "${W9_HTTP_PORT_SET}:${W9_HTTP_PORT}"
41+
42+
awx:
43+
# image: quay.io/ansible/awx:${W9_VERSION}
44+
build:
45+
context: ./
46+
dockerfile: Dockerfile
47+
container_name: ${W9_ID}-task
48+
depends_on:
49+
- redis
50+
- web
51+
- postgres
52+
- rsyslog
53+
command: sh /usr/bin/launch_awx_task.sh
54+
hostname: awx_1
55+
user: root
56+
restart: unless-stopped
57+
env_file: .env
58+
volumes:
59+
- "./src/config/supervisord_task.conf:/etc/supervisord_task.conf"
60+
- projects:/var/lib/awx/projects/
61+
- "./src/config/launch_awx_task.sh:/usr/bin/launch_awx_task.sh"
62+
- rsyslog-socket:/var/run/awx-rsyslog/
63+
- awx-receptor:/var/run/awx-receptor/
64+
- "./src/config/SECRET_KEY:/etc/tower/SECRET_KEY"
65+
- "./src/config/settings.py:/etc/tower/settings.py"
66+
- "./src/config/local_settings.py:/etc/tower/local_settings.py"
67+
- "./src/config/websocket_secret.py:/etc/tower/websocket_secret.py"
68+
- "./src/config/nginx.conf:/etc/nginx/nginx.conf"
69+
- "./src/config/credentials.py:/etc/tower/conf.d/credentials.py"
70+
- "./src/config/receptor/receptor-awx.conf:/etc/receptor/receptor.conf"
71+
- "./src/config/receptor/receptor-awx-1.conf.lock:/etc/receptor/receptor.conf.lock"
72+
- redis-socket:/var/run/redis/
73+
- "/sys/fs/cgroup:/sys/fs/cgroup"
74+
- shared:/var/lib/shared
75+
privileged: true
76+
tty: true
77+
environment:
78+
http_proxy:
79+
https_proxy:
80+
no_proxy:
81+
82+
rsyslog:
83+
image: quay.io/ansible/awx:${W9_VERSION}
84+
container_name: awx_rsyslog
85+
command: /usr/bin/launch_awx_rsyslog.sh
86+
hostname: awx_rsyslog
87+
user: root
88+
restart: unless-stopped
89+
env_file: .env
90+
volumes:
91+
- projects:/var/lib/awx/projects/
92+
- "./src/config/launch_awx_task.sh:/usr/bin/launch_awx_task.sh"
93+
- rsyslog-socket:/var/run/awx-rsyslog/
94+
- awx-receptor:/var/run/awx-receptor/
95+
- "./src/config/SECRET_KEY:/etc/tower/SECRET_KEY"
96+
- "./src/config/settings.py:/etc/tower/settings.py"
97+
- "./src/config/local_settings.py:/etc/tower/local_settings.py"
98+
- "./src/config/websocket_secret.py:/etc/tower/websocket_secret.py"
99+
- "./src/config/nginx.conf:/etc/nginx/nginx.conf"
100+
- "./src/config/credentials.py:/etc/tower/conf.d/credentials.py"
101+
- "./src/config/receptor/receptor-awx.conf:/etc/receptor/receptor.conf"
102+
- "./src/config/receptor/receptor-awx-1.conf.lock:/etc/receptor/receptor.conf.lock"
103+
- redis-socket:/var/run/redis/
104+
- "/sys/fs/cgroup:/sys/fs/cgroup"
105+
privileged: true
106+
tty: true
107+
environment:
108+
http_proxy:
109+
https_proxy:
110+
no_proxy:
111+
112+
redis:
113+
image: redis
114+
container_name: awx_redis
115+
restart: unless-stopped
116+
env_file: .env
117+
environment:
118+
http_proxy:
119+
https_proxy:
120+
no_proxy:
121+
entrypoint: ["redis-server"]
122+
command: ["/usr/local/etc/redis/redis.conf"]
123+
volumes:
124+
- redis-socket:/var/run/redis/:rw
125+
- "./src/config/redis.conf:/usr/local/etc/redis/redis.conf"
126+
127+
postgres:
128+
image: postgres:12
129+
container_name: awx_postgresql
130+
restart: unless-stopped
131+
env_file: .env
132+
volumes:
133+
- postgres_new-data:/var/lib/postgresql/data/pgdata/
134+
environment:
135+
POSTGRES_PASSWORD: ${PASSWORD}
136+
POSTGRES_DB: ${W9_ID}
137+
POSTGRES_USER: ${W9_ID}
138+
http_proxy:
139+
https_proxy:
140+
no_proxy:
141+
142+
volumes:
143+
supervisor-socket:
144+
rsyslog-socket:
145+
redis-socket:
146+
postgres_new-data:
147+
awx-receptor:
148+
projects:
149+
shared:
150+
151+
networks:
152+
default:
153+
name: ${W9_NETWORK}
154+
external: true

apps/awx/src/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# About
2+
3+
This folder includes files mount to container and used by Websoft9

apps/awx/src/config/SECRET_KEY

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
changeme

apps/awx/src/config/credentials.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import os
2+
DATABASES = {
3+
'default': {
4+
'ATOMIC_REQUESTS': True,
5+
'ENGINE': 'awx.main.db.profiled_pg',
6+
'NAME': os.getenv('W9_ID'),
7+
'USER': os.getenv('W9_ID'),
8+
'PASSWORD': os.getenv('PASSWORD'),
9+
'HOST': "postgres",
10+
'PORT': "5432",
11+
}
12+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
if [ `id -u` -ge 500 ]; then
3+
echo "awx:x:`id -u`:`id -g`:,,,:/var/lib/awx:/bin/bash" >> /tmp/passwd
4+
cat /tmp/passwd > /etc/passwd
5+
rm /tmp/passwd
6+
fi
7+
8+
if [ -n "${AWX_KUBE_DEVEL}" ]; then
9+
pushd /awx_devel
10+
make awx-link
11+
popd
12+
13+
export SDB_NOTIFY_HOST=$MY_POD_IP
14+
fi
15+
16+
set -e
17+
export DJANGO_SUPERUSER_PASSWORD=$W9_LOGIN_PASSWORD
18+
# 迁移数据库
19+
awx-manage migrate
20+
21+
wait-for-migrations
22+
23+
export PATH=$PATH:/var/lib/awx/venv/awx/bin
24+
25+
awx-manage create_preload_data
26+
awx-manage register_default_execution_environments
27+
# 创建admin账号密码
28+
if output=$(awx-manage createsuperuser --noinput --username=${W9_LOGIN_USER} --email=admin@localhost 2> /dev/null); then
29+
echo $output
30+
fi
31+
echo "Admin password: ${DJANGO_SUPERUSER_PASSWORD}"
32+
33+
awx-manage create_preload_data
34+
awx-manage register_default_execution_environments
35+
36+
awx-manage provision_instance --hostname="awx_1" --node_type="$MAIN_NODE_TYPE"
37+
awx-manage register_queue --queuename=controlplane --instance_percent=100
38+
awx-manage register_queue --queuename=default --instance_percent=100
39+
40+
if [[ -n "$RUN_MIGRATIONS" ]]; then
41+
for (( i=1; i<$CONTROL_PLANE_NODE_COUNT; i++ )); do
42+
for (( j=i + 1; j<=$CONTROL_PLANE_NODE_COUNT; j++ )); do
43+
awx-manage register_peers "awx_$i" --peers "awx_$j"
44+
done
45+
done
46+
47+
if [[ $EXECUTION_NODE_COUNT > 0 ]]; then
48+
awx-manage provision_instance --hostname="receptor-hop" --node_type="hop"
49+
awx-manage register_peers "receptor-hop" --peers "awx_1"
50+
for (( e=1; e<=$EXECUTION_NODE_COUNT; e++ )); do
51+
awx-manage provision_instance --hostname="receptor-$e" --node_type="execution"
52+
awx-manage register_peers "receptor-$e" --peers "receptor-hop"
53+
done
54+
fi
55+
fi
56+
57+
exec supervisord -c /etc/supervisord_task.conf

0 commit comments

Comments
 (0)