Skip to content

Commit a90ef13

Browse files
authored
fix: use official ghcr.io/webcodex1/x0-app and x0-db container images
1 parent 65cadfe commit a90ef13

4 files changed

Lines changed: 58 additions & 88 deletions

File tree

README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,23 @@ psql -U postgres -d x0 -f database/03-insert-text.sql
8686
Copy the `static/` directory so it is served at `/static/github2sf/`:
8787

8888
```bash
89-
cp -r static/ /var/www/x0/static/github2sf/
89+
cp -r static/ /var/www/vhosts/x0/static/github2sf/
9090
```
9191

9292
### 5. Deploy Python backend
9393

9494
Copy the `python/` directory into the x0 Python directory:
9595

9696
```bash
97-
cp python/*.py /var/www/x0/python/github2sf/
97+
cp python/*.py /var/www/vhosts/x0/python/github2sf/
9898
```
9999

100100
### 6. Configure Apache2
101101

102-
Add the WSGI aliases from `docker/apache2.conf` to your Apache virtual host, then reload:
102+
Copy `docker/apache2.conf` to `/etc/apache2/conf-enabled/github2sf.conf` and reload:
103103

104104
```bash
105+
cp docker/apache2.conf /etc/apache2/conf-enabled/github2sf.conf
105106
apache2ctl graceful
106107
```
107108

@@ -113,20 +114,26 @@ Navigate to `http://your-server/?appid=github2sf` in your browser.
113114

114115
## Docker (quick start)
115116

117+
The application uses the official x0 container images:
118+
119+
- **`ghcr.io/webcodex1/x0-app`** — Apache2 + mod_wsgi web application server with the x0 JavaScript framework pre-installed ([packages page](https://github.com/WEBcodeX1/x0/pkgs/container/x0-app))
120+
- **`ghcr.io/webcodex1/x0-db`** — PostgreSQL 16 database with the x0 schema pre-installed ([packages page](https://github.com/WEBcodeX1/x0/pkgs/container/x0-db))
121+
122+
The `docker/Dockerfile` extends `ghcr.io/webcodex1/x0-app` and adds the github2stackfield Python backend dependencies on top.
123+
116124
```bash
117125
cd docker
118126
docker compose up --build
119127
```
120128

121129
Then open [http://localhost:8080/?appid=github2sf](http://localhost:8080/?appid=github2sf).
122130

123-
> **Note:** The Docker image fetches x0 and python-micro-esb from GitHub at build time.
124-
> You still need to run the database SQL scripts against the PostgreSQL container:
131+
> **Database setup:** After the containers are running, execute the SQL scripts against the x0-db container:
125132
>
126133
> ```bash
127-
> docker exec -i github2sf-db psql -U postgres -d x0 < database/01-create-schema.sql
128-
> docker exec -i github2sf-db psql -U postgres -d x0 < database/02-insert-config.sql
129-
> docker exec -i github2sf-db psql -U postgres -d x0 < database/03-insert-text.sql
134+
> docker exec -i github2sf-db psql -U postgres -d x0 -f /dev/stdin < database/01-create-schema.sql
135+
> docker exec -i github2sf-db psql -U postgres -d x0 -f /dev/stdin < database/02-insert-config.sql
136+
> docker exec -i github2sf-db psql -U postgres -d x0 -f /dev/stdin < database/03-insert-text.sql
130137
> ```
131138
132139
---

docker/Dockerfile

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,13 @@
1-
FROM python:3.12-slim
1+
FROM ghcr.io/webcodex1/x0-app
22

3-
RUN apt-get update && apt-get install -y \
4-
apache2 \
5-
libapache2-mod-wsgi-py3 \
3+
# Install github2stackfield Python backend dependencies
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
python3-pip \
66
git \
77
&& rm -rf /var/lib/apt/lists/*
88

9-
# Install Python dependencies
10-
RUN pip install --no-cache-dir \
9+
RUN pip3 install --no-cache-dir --break-system-packages \
1110
requests \
1211
psycopg2-binary \
13-
pgdbpool
14-
15-
# Install python-micro-esb from source
16-
RUN pip install --no-cache-dir \
12+
pgdbpool \
1713
git+https://github.com/clauspruefer/python-micro-esb.git
18-
19-
# Install x0 framework Python modules
20-
RUN pip install --no-cache-dir \
21-
git+https://github.com/WEBcodeX1/x0.git
22-
23-
WORKDIR /var/www/x0
24-
25-
# Apache configuration
26-
COPY docker/apache2.conf /etc/apache2/sites-available/github2sf.conf
27-
RUN a2ensite github2sf && a2dissite 000-default && a2enmod wsgi
28-
29-
EXPOSE 80
30-
31-
CMD ["apache2ctl", "-D", "FOREGROUND"]

docker/apache2.conf

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,17 @@
1-
<VirtualHost *:80>
2-
ServerName github2sf.local
3-
DocumentRoot /var/www/x0/www
1+
# github2stackfield supplementary Apache configuration
2+
# Mounted into /etc/apache2/conf-enabled/ inside the x0-app container.
3+
# The x0-app base image already configures Apache2 + mod_wsgi and sets
4+
# DocumentRoot /var/www/vhosts/x0 with WSGI handling for the python/ tree.
5+
# This snippet grants explicit directory access to the app-specific paths.
46

5-
# Static assets: x0 framework JS/CSS + app-specific JSON config
6-
Alias /static /var/www/x0/www/static
7-
Alias /static/github2sf /var/www/x0/static/github2sf
7+
<Directory /var/www/vhosts/x0/static/github2sf>
8+
Options -Indexes
9+
Require all granted
10+
</Directory>
811

9-
<Directory /var/www/x0/www/static>
10-
Options -Indexes
11-
Require all granted
12-
</Directory>
13-
14-
<Directory /var/www/x0/static/github2sf>
15-
Options -Indexes
16-
Require all granted
17-
</Directory>
18-
19-
# x0 framework index / main entry-point
20-
WSGIScriptAlias / /var/www/x0/python/Index.py
21-
22-
# github2stackfield backend service endpoints
23-
WSGIScriptAlias /python/VerifyGitHubCredentials.py /var/www/x0/python/github2sf/VerifyGitHubCredentials.py
24-
WSGIScriptAlias /python/VerifyStackfieldCredentials.py /var/www/x0/python/github2sf/VerifyStackfieldCredentials.py
25-
WSGIScriptAlias /python/SearchGitHubIssues.py /var/www/x0/python/github2sf/SearchGitHubIssues.py
26-
WSGIScriptAlias /python/GetGitHubIssueDetails.py /var/www/x0/python/github2sf/GetGitHubIssueDetails.py
27-
WSGIScriptAlias /python/CreateStackfieldTask.py /var/www/x0/python/github2sf/CreateStackfieldTask.py
28-
29-
<Directory /var/www/x0/python>
30-
Require all granted
31-
</Directory>
32-
33-
ErrorLog ${APACHE_LOG_DIR}/github2sf-error.log
34-
CustomLog ${APACHE_LOG_DIR}/github2sf-access.log combined
35-
</VirtualHost>
12+
<Directory /var/www/vhosts/x0/python/github2sf>
13+
AddHandler wsgi-script .py
14+
Options ExecCGI
15+
AllowOverride None
16+
Require all granted
17+
</Directory>

docker/docker-compose.yml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
services:
22

33
# ---------------------------------------------------------------------------
4-
# PostgreSQL database (shared with x0 framework)
4+
# x0 database container (PostgreSQL with x0 schema pre-installed)
5+
# Official image: https://github.com/WEBcodeX1/x0/pkgs/container/x0-db
56
# ---------------------------------------------------------------------------
6-
postgres:
7-
image: postgres:16-alpine
7+
x0-db:
8+
image: ghcr.io/webcodex1/x0-db
89
container_name: github2sf-db
910
restart: unless-stopped
10-
environment:
11-
POSTGRES_DB: x0
12-
POSTGRES_USER: postgres
13-
POSTGRES_PASSWORD: changeme
14-
volumes:
15-
- pg_data:/var/lib/postgresql/data
1611
ports:
1712
- "5432:5432"
1813
networks:
19-
- github2sf-net
14+
github2sf-net:
15+
ipv4_address: 172.20.0.20
16+
aliases:
17+
- mypostgres
2018

2119
# ---------------------------------------------------------------------------
22-
# x0 application server (Apache2 + mod_wsgi)
20+
# x0 application server (extends official x0-app with github2sf Python deps)
21+
# Official image: https://github.com/WEBcodeX1/x0/pkgs/container/x0-app
2322
# ---------------------------------------------------------------------------
2423
x0-app:
2524
build:
@@ -28,23 +27,23 @@ services:
2827
container_name: github2sf-app
2928
restart: unless-stopped
3029
depends_on:
31-
- postgres
32-
environment:
33-
DB_HOST: postgres
34-
DB_NAME: x0
35-
DB_USER: postgres
36-
DB_PASSWORD: changeme
30+
- x0-db
31+
extra_hosts:
32+
- "mypostgres:172.20.0.20"
3733
volumes:
38-
- ../static:/var/www/x0/static/github2sf:ro
39-
- ../python:/var/www/x0/python/github2sf:ro
34+
- ../static:/var/www/vhosts/x0/static/github2sf:ro
35+
- ../python:/var/www/vhosts/x0/python/github2sf:ro
36+
- ../docker/apache2.conf:/etc/apache2/conf-enabled/github2sf.conf:ro
4037
ports:
4138
- "8080:80"
4239
networks:
43-
- github2sf-net
44-
45-
volumes:
46-
pg_data:
40+
github2sf-net:
41+
ipv4_address: 172.20.0.10
4742

4843
networks:
4944
github2sf-net:
5045
driver: bridge
46+
ipam:
47+
config:
48+
- subnet: 172.20.0.0/24
49+
gateway: 172.20.0.1

0 commit comments

Comments
 (0)