Skip to content

Commit 66b1fc3

Browse files
ilovepinkpony1en-verzhuravelsergii.kostiuk
authored
[PR-23724][FE] Add some fancy theme (#355)
Co-authored-by: en-ver <[email protected]> Co-authored-by: Bohdan Zhuravel <[email protected]> Co-authored-by: sergii.kostiuk <[email protected]>
1 parent 5d1b1ab commit 66b1fc3

File tree

121 files changed

+1792
-2059
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1792
-2059
lines changed

.circleci/config.yml

Lines changed: 6 additions & 10 deletions
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

Lines changed: 10 additions & 0 deletions
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=docs.bastion.talkable.com
10+
PRODUCTION_HOST=docs.talkable.com

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 4 deletions
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

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
/build
2-
/.bundle
3-
Gemfile.lock
4-
source/_static/test
5-
.pivotalrc
1+
# IDE
62
.idea
3+
.vscode
4+
5+
# Local
76
*.log
7+
.env
8+
9+
# Sphinx
10+
_build
11+
build
12+
13+
# Python
14+
.venv
15+
__pycache__
16+
17+
# Ruby
18+
.bundle
19+
Gemfile.lock

.ruby-gemset

Lines changed: 0 additions & 1 deletion
This file was deleted.

.ruby-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

Dockerfile

Lines changed: 14 additions & 0 deletions
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

Lines changed: 0 additions & 11 deletions
This file was deleted.

Guardfile

Lines changed: 0 additions & 14 deletions
This file was deleted.

Procfile

Lines changed: 0 additions & 2 deletions
This file was deleted.

README-devops.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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+
89+
- Generated by Sphinx and stored in a shared volume.
90+
- Served by Nginx without regeneration.
91+
92+
- **Volume Management**:
93+
- Shared volumes allow seamless access and updates between containers.
94+
- Ensures efficient and consistent behavior across environments.

README-maintainer.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Talkable Documentation Maintenance Routine
2+
3+
This documentation provides instructions for maintaining the Sphinx Builder **framework** used to generate the Talkable Documentation.
4+
5+
It outlines the routine for maintaining the framework and associated workflows.
6+
7+
> [!NOTE]
8+
> This guide does not cover updating the documentation content.
9+
> Refer to [README.md](README.md) for details on updating the Talkable documentation source, which is available at [https://docs.talkable.com/](https://docs.talkable.com/).
10+
11+
## Scope
12+
13+
The maintenance routine includes the following tasks:
14+
15+
- Updating dependencies:
16+
- Sphinx and other Python packages
17+
- Python container
18+
- Adding new extensions
19+
- Introducing Talkable-specific customizations (Python scripts)
20+
21+
## Preparations
22+
23+
1. Clone the documentation repository.
24+
25+
```bash
26+
git clone [email protected]:talkable/talkable-docs.git
27+
cd talkable-docs
28+
```
29+
30+
2. Create a new branch from `master`.
31+
32+
```bash
33+
git checkout -b new-branch
34+
```
35+
36+
3. Generate a `.env` file from the `.env.template`.
37+
38+
```bash
39+
cp .env.template .env
40+
```
41+
42+
## Updating Packages
43+
44+
The goal is to update `requirements.txt` with the latest versions of dependencies.
45+
46+
1. Replace `requirements.txt` with the `packages.txt` file.
47+
48+
```bash
49+
cp packages.txt requirements.txt
50+
```
51+
52+
2. Build the Sphinx container.
53+
54+
```bash
55+
docker compose up -d --build
56+
```
57+
58+
This starts the framework and allows you to load the documentation at http://localhost:8080.
59+
60+
If the documentation fails to load, check the container logs:
61+
62+
```bash
63+
docker logs -f docs-sphinx-development
64+
```
65+
66+
3. Test and freeze `requirements.txt`.
67+
68+
Ensure everything works as expected locally. Once confirmed, update `requirements.txt` to include all installed dependencies with their versions.
69+
70+
Save the dependencies with the following command:
71+
72+
```bash
73+
docker exec docs-sphinx-development pip freeze > requirements.txt
74+
```
75+
76+
4. Stop the containers.
77+
78+
Once the documentation is fully functional, stop the containers:
79+
80+
```bash
81+
docker compose down -v
82+
```
83+
84+
5. Push the updated `requirements.txt` to GitHub.
85+
86+
Commit and push the updated `requirements.txt` for testing and production.
87+
88+
## Updating the Python Container
89+
90+
The Sphinx framework uses a Python Docker image from DockerHub.
91+
92+
1. Check for the latest Python image on DockerHub: https://hub.docker.com/_/python.
93+
94+
2. Update the image name in the [Dockerfile](./Dockerfile):
95+
96+
```dockerfile
97+
FROM python:3.13-alpine3.21
98+
```
99+
100+
3. Test the deployment.
101+
102+
Deploy the Sphinx container to verify the updates:
103+
104+
```bash
105+
docker compose up -d --build
106+
```
107+
108+
Confirm that the documentation loads at http://localhost:8080.
109+
110+
4. Finalize the update.
111+
112+
Commit the updated `Dockerfile` to the repository for testing and production.
113+
114+
Stop the containers:
115+
116+
```bash
117+
docker compose down -v
118+
```
119+
120+
## Adding New Extensions
121+
122+
Sphinx is a highly customizable documentation framework. You can extend its functionality with official or third-party extensions.
123+
124+
Here are some resources:
125+
126+
- https://sphinx-extensions.readthedocs.io/en/latest/
127+
- https://www.sphinx-doc.org/en/master/development/index.html
128+
- https://github.com/sphinx-contrib
129+
130+
To add extensions, follow these steps:
131+
132+
1. [Install additional Python packages](#installing-additional-packages).
133+
2. [Adjust the conf.py file](#modifying-configuration-files).
134+
3. Add Python scripts to the [./source/](./source/) directory if necessary.
135+
136+
Start by deploying the framework container:
137+
138+
```bash
139+
docker compose up -d --build
140+
```
141+
142+
### Installing Additional Packages
143+
144+
Add the package to `requirements.txt`.
145+
146+
Append the package name to `requirements.txt` (version specification is optional at this stage).
147+
148+
> [!NOTE]
149+
> Version pinning can be done later.
150+
151+
Rebuild the container after modifying `requirements.txt`:
152+
153+
```bash
154+
docker compose up -d --build
155+
```
156+
157+
### Modifying Configuration Files
158+
159+
Most changes involve editing the [./source/conf.py](./source/conf.py) file or other files in the [./source/](./source/) directory.
160+
161+
> [!NOTE]
162+
> Rebuilding the container is unnecessary for changes to [./source/conf.py](./source/conf.py) or [./source/](./source/). These changes are applied automatically within 1 second.

0 commit comments

Comments
 (0)