Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Commit 7c506f3

Browse files
committed
Basic skeleton
Bootstrap a basic project skeleton for using mkdocs to generate a static site. This includes a Blubber generated, docker compose v2 managed, container for running mkdocs and the basic bits needed to make it output a content page.
0 parents  commit 7c506f3

File tree

12 files changed

+1251
-0
lines changed

12 files changed

+1251
-0
lines changed

.dockerignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Exclude everything by default
2+
*
3+
4+
# Conditionally include things we know we want in the container
5+
# Copy .git/refs/heads/* into the container
6+
!.git
7+
.git/*
8+
!.git/HEAD
9+
!.git/refs/heads/*
10+
!.pipeline
11+
!COPYING
12+
!docs
13+
!poetry.lock
14+
!pyproject.toml
15+
!README.md

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
*.pyc
3+
/*.egg-info/

.pipeline/blubber.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: v4
2+
3+
base: docker-registry.wikimedia.org/python3-buster:latest
4+
5+
runs:
6+
environment:
7+
PYTHONBUFFERED: "1"
8+
PYTHONDONTWRITEBYTECODE: "1"
9+
PIP_NO_CACHE_DIR: "off"
10+
PIP_DISABLE_PIP_VERSION_CHECK: "on"
11+
12+
variants:
13+
base-python:
14+
# Provides the basic foundation for all other python runtime containers
15+
# needed to develop, test, and run.
16+
apt:
17+
packages:
18+
- gettext
19+
- git
20+
- python3-dev
21+
# The python3-venv package is needed to supply the `ensurepip`
22+
# command. Having ensurepip available is a requirement of Poetry.
23+
- python3-venv # FIXME: should be in the base image OR added by Blubber
24+
python:
25+
version: python3
26+
poetry:
27+
version: ==1.1.11
28+
requirements:
29+
- pyproject.toml
30+
- poetry.lock
31+
32+
dev-python:
33+
# Development/testing shared base for python runtime containers
34+
includes:
35+
- base-python
36+
runs:
37+
# Mark as insecure so that the runtime user can modify content. This is
38+
# needed so that we can use the container's runtime for our local
39+
# development needs such as updating poetry.lock and running tox.
40+
insecurely: true
41+
python:
42+
poetry:
43+
devel: true
44+
copies:
45+
- from: local
46+
source: .
47+
destination: .

.pipeline/dev-python.Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Dockerfile for *local development*.
2+
# Generated by Blubber from .pipeline/blubber.yaml
3+
FROM docker-registry.wikimedia.org/python3-buster:latest AS dev-python
4+
USER 0
5+
ENV HOME="/root"
6+
ENV DEBIAN_FRONTEND="noninteractive"
7+
RUN apt-get update && apt-get install -y "gettext" "git" "python3-dev" "python3-venv" && rm -rf /var/lib/apt/lists/*
8+
RUN python3 "-m" "easy_install" "pip" && python3 "-m" "pip" "install" "-U" "setuptools" "wheel" "tox" "pip"
9+
ENV POETRY_VIRTUALENVS_PATH="/opt/lib/poetry"
10+
RUN python3 "-m" "pip" "install" "-U" "poetry==1.1.11"
11+
RUN (getent group "65533" || groupadd -o -g "65533" -r "somebody") && (getent passwd "65533" || useradd -l -o -m -d "/home/somebody" -r -g "somebody" -u "65533" "somebody") && mkdir -p "/srv/app" && chown "65533":"65533" "/srv/app" && mkdir -p "/opt/lib" && chown "65533":"65533" "/opt/lib"
12+
RUN (getent group "900" || groupadd -o -g "900" -r "runuser") && (getent passwd "900" || useradd -l -o -m -d "/home/runuser" -r -g "runuser" -u "900" "runuser")
13+
USER 65533
14+
ENV HOME="/home/somebody"
15+
WORKDIR "/srv/app"
16+
ENV PIP_DISABLE_PIP_VERSION_CHECK="on" PIP_NO_CACHE_DIR="off" PYTHONBUFFERED="1" PYTHONDONTWRITEBYTECODE="1"
17+
COPY --chown=65533:65533 ["pyproject.toml", "poetry.lock", "./"]
18+
RUN mkdir -p "/opt/lib/poetry"
19+
RUN poetry "install" "--no-root"
20+
COPY --chown=65533:65533 [".", "."]
21+
22+
LABEL blubber.variant="dev-python" blubber.version="0.8.0+a6bf87e"

COPYING

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright (c) 2021 Wikimedia Foundation and contributors.
2+
# All Rights Reserved.
3+
#
4+
# This file is part of Wikimedia Developer Portal.
5+
#
6+
# Wikimedia Developer Portal is free software: you can redistribute it and/or
7+
# modify it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or (at your
9+
# option) any later version.
10+
#
11+
# Wikimedia Developer Portal is distributed in the hope that it will be
12+
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14+
# Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License along with
17+
# Wikimedia Developer Portal. If not, see <http://www.gnu.org/licenses/>.
18+
19+
this := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
20+
PROJECT_DIR := $(dir $(this))
21+
PIPELINE_DIR := $(PROJECT_DIR)/.pipeline
22+
BLUBBEROID := https://blubberoid.wikimedia.org
23+
DOCKERFILES := $(PIPELINE_DIR)/dev-python.Dockerfile
24+
25+
help:
26+
@echo "Make targets:"
27+
@echo "============="
28+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
29+
awk 'BEGIN {FS = ":.*?## "}; {printf "%-20s %s\n", $$1, $$2}'
30+
.PHONY: help
31+
32+
start: $(DOCKERFILES) ## Start the docker-compose stack
33+
docker compose up --build --detach
34+
.PHONY: start
35+
36+
stop: ## Stop the docker-compose stack
37+
docker compose stop
38+
.PHONY: stop
39+
40+
restart: stop start ## Restart the docker-compose stack
41+
.PHONY: restart
42+
43+
status: ## Show status of the docker-compose stack
44+
docker compose ps
45+
.PHONY: status
46+
47+
shell: ## Get an interactive shell inside the container
48+
docker compose exec portal bash
49+
.PHONY: shell
50+
51+
tail: ## Tail logs from the docker-compose stack
52+
docker compose logs -f
53+
.PHONY: tail
54+
55+
clean: ## Clean up Docker images and containers
56+
yes | docker image prune
57+
yes | docker container prune
58+
.PHONY: clean
59+
60+
%.Dockerfile: $(PIPELINE_DIR)/blubber.yaml
61+
echo "# Dockerfile for *local development*." > $@
62+
echo "# Generated by Blubber from .pipeline/blubber.yaml" >> $@
63+
curl -sH 'content-type: application/yaml' --data-binary @$^ \
64+
$(BLUBBEROID)/v1/$(*F) >> $@

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Wikimedia Developer Portal
2+
==========================
3+
4+
Static site generator for a portal to Wikimedia technical documentation.
5+
6+
License
7+
-------
8+
Wikimedia Developer Portal code and configuration is licensed under the [GNU GPLv3+][] license. Textual content is licensed under the [CC-BY-SA 3.0][] license.
9+
10+
[GNU GPLv3+]: https://www.gnu.org/copyleft/gpl.html
11+
[CC-BY-SA 3.0]: https://creativecommons.org/licenses/by-sa/3.0/

docker-compose.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
version: "3.2"
3+
services:
4+
portal:
5+
build:
6+
context: .
7+
dockerfile: .pipeline/dev-python.Dockerfile
8+
image: "wmdevportal:dev-python"
9+
user: somebody
10+
working_dir: /srv/app
11+
command: >
12+
poetry run mkdocs serve --dev-addr 0.0.0.0:9000
13+
volumes:
14+
- type: bind
15+
source: .
16+
target: /srv/app
17+
consistency: cached
18+
ports:
19+
- "${PORTAL_HTTP_PORT:-9000}:9000"
20+
restart: always

docs/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Discover Wikimedia technical documentation and communities
2+
3+
Learn about, interact with, and contribute to the open source technology that
4+
powers [Wikipedia](https://www.wikipedia.org/) and other [Wikimedia projects](https://wikimediafoundation.org/our-work/wikimedia-projects/).

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
site_name: Wikimedia Developer Portal

0 commit comments

Comments
 (0)