Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rdm edtd #8

Open
wants to merge 1 commit into
base: pyngrd
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 101 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,102 @@
**This is a docker-compose based application template.**
# **This is a docker-compose based application template.**

Supported platforms:
* Python 3.9.5
* NodeJS (on development stage)
**All used docker images are built on the basis of Alpine OS, it is unacceptable to use images built on the basis of other OS due to incompatibility with package managers.**

---

## **Virtual environment variables**
***Default values ​​specified***

**Items marked with (*) should only be changed if you understand what you are doing.**

### Base variables

Distributed for platform containers (Python, NodeJS)

Use the user and user ID under which the application is launched. This is necessary for correct access to files on mounted volumes.

USER_NAME=user1
USER_ID=1001

(*) You can specify the desired home directory in the container.

HOME_DIR=/home/app

Specify the necessary AlpineOS system dependencies separated by spaces. Will be used for all platforms.

OS_DEPS=

### NGINX

Select the desired version of NGINX (based on AlpineOS) at https://hub.docker.com

NGINX_IMAGE_VERSION=1.19-alpine

Specify comma-separated domain names for the web server.

VIRTUAL_HOST=localhost, 127.0.0.1

(*) You can specify the API port in the container.

API_PORT=8000

### Python

Select the desired version of Python (based on AlpineOS) at https://hub.docker.com

PYTHON_IMAGE_VERSION=3.9.5-alpine

(*) If PipENV is used, this variable enables --dev packages to be installed.

PIPENV_DEV=false

Specify the necessary AlpineOS system Python dependencies separated by spaces.

PYTHON_OS_DEPS=postgresql-dev gcc python3-dev musl-dev


### PostgreSQL

Select the desired version of PostgreSQL (based on AlpineOS) at https://hub.docker.com

POSTGRES_IMAGE_VERSION=13-alpine

(*) PostreSQL global settings. Will be used for all platforms.

POSTGRES_PASSWORD=postgres
POSTGRES_USER=postgres
POSTGRES_HOST=postgres
POSTGRES_DB=postgres

---
## **USAGE**

Let's take an example.
You have written an application using Python, NodeJS, Postgres, Redis and want to use NGINX as a web server. (pynongpgrd)
You can use the XTMPL wrapper https://github.com/LexxXell/xtmpl or work with the template directly.

Clone branch of the template into the project dir.

git clone --branch=pynongpgrd https://github.com/LexxXell/base_template.git .
git remote remove origin

Run a reverse proxy server from the proxy directory.

docker-compose -f proxy/docker-compose.yml up -d

Checking the work of the cloned branch:

docker-compose up --build

Check the output to the console, and for branches containing NGINX, we additionally go to the browser at http://localhost

Customize the database connection in your applications following the example in the python/code and nodejs/code directories.
Move your application code to the python/code and nodejs/code directories, after deleting the app,js/app.py files from there.
Customize .env file to your liking.

For security reasons, after making changes to the code, you need to rebuild the containers.
All management of starting, building and stopping containers is done using docker-compose.

To implement autostart, you need to add for the required services to the docker-compose.yml file

restart: always