Skip to content

Commit 2a3f572

Browse files
en-verzhuravel
andauthored
[PR-23781] Migrate docs to Jenkins (#358)
Co-authored-by: Bohdan Zhuravel <[email protected]>
1 parent 97b67e1 commit 2a3f572

25 files changed

+666
-316
lines changed

.circleci/config.yml

+6-10
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ executors:
66
- auth:
77
username: $DOCKERHUB_USERNAME
88
password: $DOCKERHUB_ACCESS_TOKEN
9-
image: cimg/python:3.12
9+
image: cimg/python:3.13
10+
environment:
11+
ENVIRONMENT: production
1012

1113
orbs:
12-
python: circleci/python@2.1.1
14+
python: circleci/python@3.0.0
1315

1416
jobs:
1517
build:
@@ -18,21 +20,15 @@ jobs:
1820
steps:
1921
- checkout
2022

21-
- python/install-packages:
22-
app-dir: ~/project
23+
- python/install-packages
2324

2425
- run:
2526
name: Build documentation
26-
command: sphinx-build -nW -b html -d build/doctrees source build/html
27+
command: sphinx-build -nW -b dirhtml -d build/doctrees source build/html
2728

2829
workflows:
2930
workflow:
3031
jobs:
3132
- build:
3233
context:
3334
- org-global
34-
filters:
35-
branches:
36-
ignore:
37-
- gh-pages
38-
- /.*-gh-pages/

.env.template

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# The port to use to populate the documentation on your local machine or server
2+
LOCAL_PORT=8080
3+
4+
# Possible values: development, staging, production
5+
ENVIRONMENT=development
6+
7+
# Base urls used for the canonical urls compilation
8+
DEVELOPMENT_HOST=localhost
9+
STAGING_HOST=staging-docs.talkable.com
10+
PRODUCTION_HOST=docs.talkable.com

.github/PULL_REQUEST_TEMPLATE.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<!--- Provide a general summary of your changes in the Title above -->
22

3-
## Demo
4-
<!--- Please provide a link to a demo -->
5-
https://deploy-preview-{{id}}--talkable-docs.netlify.app/
6-
73
## Related Stories
84
<!--- If this pull request is related to JIRA story, please link to the story here -->
95
[![](http://proxies.talkable.com/talkable/PR-1234)](https://talkable.atlassian.net/browse/PR-1234)

.gitignore

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1+
# IDE
2+
.idea
3+
.vscode
4+
5+
# Local
6+
*.log
7+
.env
8+
9+
# Sphinx
10+
_build
11+
12+
# Python
13+
.venv
14+
__pycache__
15+
16+
# Ruby
117
/build
218
/.bundle
319
Gemfile.lock
4-
source/_static/test
5-
.pivotalrc
6-
.idea
7-
*.log

.ruby-gemset

-1
This file was deleted.

.ruby-version

-1
This file was deleted.

CNAME

-1
This file was deleted.

Dockerfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM python:3.13-alpine3.21
2+
3+
# Install dependencies
4+
WORKDIR /docs
5+
ADD requirements.txt /docs
6+
RUN python3 -m pip install -r requirements.txt
7+
8+
CMD if [ "$ENVIRONMENT" = "development" ]; then \
9+
echo "Running Sphinx in Development mode"; \
10+
sphinx-autobuild -b dirhtml /docs/source /docs/_build; \
11+
else \
12+
echo "Running Sphinx in Staging/Production mode"; \
13+
sphinx-build -b dirhtml /docs/source /docs/_build; \
14+
fi

Gemfile

-11
This file was deleted.

Guardfile

-14
This file was deleted.

Procfile

-2
This file was deleted.

README-devops.md

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
## Overview
2+
3+
The Talkable documentation stack is a containerized system that uses Docker to simplify deployment and management. It is designed to generate, serve, and manage static documentation across multiple environments, such as staging and production.
4+
5+
## Key Features
6+
7+
1. **Containerized Components**:
8+
9+
- **Nginx**: Handles HTTP requests, serves static HTML files, manages URL redirection, and dynamically serves environment-specific `robots.txt` files.
10+
- **Sphinx Autobuilder**: Generates static HTML files from source documentation and stores them in a persistent volume shared with Nginx.
11+
12+
2. **Environment-Specific Behavior**:
13+
14+
- Configured via a `.env` file for flexibility.
15+
- Supports dynamic environment-specific behavior, such as serving different `robots.txt` files based on the `ENVIRONMENT` variable.
16+
17+
3. **Efficient Architecture**:
18+
19+
- Deployed on Amazon AWS Virtual Private Servers (VPS) with an AWS load balancer directing user traffic to the appropriate environment.
20+
- Sphinx generates content on a persistent volume that Nginx serves directly.
21+
22+
## Deployment Process
23+
24+
### Prerequisites
25+
26+
- Ensure Docker and Docker Compose are installed on the target VPS.
27+
- Clone the repository containing the stack configuration.
28+
29+
### Steps
30+
31+
1. **Clone the Repository**:
32+
33+
```bash
34+
git clone [email protected]:talkable/talkable-docs.git
35+
```
36+
37+
2. **Switch to the Appropriate Branch**:
38+
39+
- Use the `master` branch for production.
40+
41+
```bash
42+
git checkout master
43+
```
44+
45+
- Use the `staging` branch for staging.
46+
47+
```bash
48+
git checkout staging
49+
```
50+
51+
3. **Create and Configure the `.env` File**:
52+
53+
- Copy `.env.template` to `.env`:
54+
55+
```bash
56+
cp .env.template .env
57+
```
58+
59+
- Update the following variables:
60+
61+
- **`ENVIRONMENT`**: Set to `development`, `staging`, or `production`.
62+
- **`LOCAL_PORT`**: Adjust if the default port (`8080`) is already in use.
63+
- Leave `_HOST` variables unchanged unless domain names for staging or production servers are updated.
64+
65+
4. **Deploy the Stack**:
66+
67+
```bash
68+
docker compose up -d --build
69+
```
70+
71+
## Environment-Specific Configuration
72+
73+
### Handling `robots.txt`
74+
75+
- The repository includes separate `robots.txt` files for each environment.
76+
- The correct file is dynamically selected based on the `ENVIRONMENT` variable and mapped to the container:
77+
78+
```yaml
79+
volumes:
80+
- ./nginx/robots/${ENVIRONMENT}.txt:/var/www/robots.txt
81+
```
82+
83+
- Nginx serves the file at `/var/www/robots.txt` in response to `robots.txt` requests.
84+
85+
## Persistent Data Sharing
86+
87+
- **Static HTML Files**:
88+
- Generated by Sphinx and stored in a shared volume.
89+
- Served by Nginx without regeneration.
90+
91+
- **Volume Management**:
92+
- Shared volumes allow seamless access and updates between containers.
93+
- Ensures efficient and consistent behavior across environments.

0 commit comments

Comments
 (0)