API for fetching data from CFDE Chemical Database (CFChemDb).
- Docker
- Docker Compose
- Copy
app/.env.exampletoapp/.env - Edit the
app/.envcredentials to point to thecfchemdatabase - Run
docker compose --env-file ./app/.env -f compose-development.yml up --build
The API should now be accessible from localhost:8000
If one finds they need to update dependencies (requirements.txt), the following steps can be followed:
- If a new package is required, add it to
requirements.in - Setup and activate a Python (v3.14) virtual environment. For example, with conda use:
conda create -n cfchem-api python=3.14 && conda activate cfchem-api - Install pip-tools:
pip install pip-tools - Compile new requirements:
pip-compile --upgrade- Make sure you are in the
app/directory:cd app/
- Make sure you are in the
- (Optional) Test the update locally in your environment:
pip-sync
Note: If you need to update the Python version, make sure to adjust the steps above accordingly and to update the Python image in Dockerfile.
- A full set of Swagger documentation can be found at http://localhost:8000/apidocs
- Copy production_env.example to
.env:cp production_env.example .env - Fill in/edit the
.envcredentials as needed - Update apache2 config:
- Create a new file for apache2 config:
/etc/apache2/sites-available/cfchemapi.conf - Add the following line to
/etc/apache2/apache2.conf:Include /etc/apache2/sites-available/cfchemapi.conf - Update the apache2 virtual config file:
/etc/apache2/sites-enabled/000-default.conf - Run config check:
sudo apachectl configtest - (If config check passed) reload apache:
sudo systemctl reload apache2
- Create a new file for apache2 config:
- (If server was previously up):
docker-compose down - Run
docker-compose up --build -d
If you only need to update a single service (e.g., the UI) you don't need to do a full restart (with down + up). Instead, you can use this approach:
- Run
docker-compose build cfchem_ui - Then
docker-compose up cfchem_ui - (Recommended) Restart nginx:
docker-compose restart nginx