Compare commits

...

2 Commits

  1. 3
      .env.example
  2. 32
      config/nginx/conf.d/z-python.conf.example
  3. 3
      config/supervisor/.gitignore
  4. 9
      config/supervisor/uvicorn.conf.example
  5. 3
      docker-compose.base.yml
  6. 27
      dockerfiles/workspace/.shell-aliases
  7. 74
      dockerfiles/workspace/workspace74.Dockerfile

3
.env.example

@ -22,6 +22,9 @@ WORKSPACE_NODE_VERSION=lts/hydrogen
WORKSPACE_PHP_OPT_MAX_EXECUTION_TIME=0 WORKSPACE_PHP_OPT_MAX_EXECUTION_TIME=0
WORKSPACE_PHP_OPT_MEMORY_LIMIT=-1 WORKSPACE_PHP_OPT_MEMORY_LIMIT=-1
WORKSPACE_INSTALL_SUPERVISOR=false
WORKSPACE_INSTALL_PYTHON=false
### PHP-FPM ############################################# ### PHP-FPM #############################################
PHP_OPT_SHORT_OPEN_TAG=Off PHP_OPT_SHORT_OPEN_TAG=Off
PHP_OPT_MAX_EXECUTION_TIME=600 PHP_OPT_MAX_EXECUTION_TIME=600

32
config/nginx/conf.d/z-python.conf.example

@ -0,0 +1,32 @@
map $http_host $python_upstream {
someproject.local.wpstudio.ru http://workspace74:8000;
}
map $http_host $python_root {
someproject.local.wpstudio.ru /usr/share/nginx/python/someproject;
}
server {
listen 80;
server_name
someproject.local.wpstudio.ru
;
location / {
resolver 127.0.0.11;
proxy_pass $python_upstream;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
}
root $python_root;
location ~ /media {
expires max;
}
location ~ /static {
expires max;
}
}

3
config/supervisor/.gitignore

@ -0,0 +1,3 @@
*
!*.example
!.gitignore

9
config/supervisor/uvicorn.conf.example

@ -0,0 +1,9 @@
[fcgi-program:uvicorn]
process_name=uvicorn-tourtennis-%(process_num)d
socket=tcp://localhost:8000
command=/var/python/tourtennis/.venv/bin/uvicorn --fd 0 main:App
autostart=true
autorestart=true
numprocs=1
user=laradock
redirect_stderr=true

3
docker-compose.base.yml

@ -40,9 +40,12 @@ services:
- PHP_OPT_SHORT_OPEN_TAG=${PHP_OPT_SHORT_OPEN_TAG} - PHP_OPT_SHORT_OPEN_TAG=${PHP_OPT_SHORT_OPEN_TAG}
- PHP_OPT_MAX_EXECUTION_TIME=${WORKSPACE_PHP_OPT_MAX_EXECUTION_TIME} - PHP_OPT_MAX_EXECUTION_TIME=${WORKSPACE_PHP_OPT_MAX_EXECUTION_TIME}
- PHP_OPT_MEMORY_LIMIT=${WORKSPACE_PHP_OPT_MEMORY_LIMIT} - PHP_OPT_MEMORY_LIMIT=${WORKSPACE_PHP_OPT_MEMORY_LIMIT}
- INSTALL_SUPERVISOR=${WORKSPACE_INSTALL_SUPERVISOR}
- INSTALL_PYTHON=${WORKSPACE_INSTALL_PYTHON}
restart: always restart: always
volumes: volumes:
- ${PROJECTS_DIR}:/var/www - ${PROJECTS_DIR}:/var/www
- ./config/supervisor:/etc/supervisor/conf.d
extra_hosts: extra_hosts:
- "dockerhost:${DOCKER_HOST_IP}" - "dockerhost:${DOCKER_HOST_IP}"
secrets: secrets:

27
dockerfiles/workspace/.shell-aliases

@ -1,27 +0,0 @@
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# Colors used for status updates
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"
COL_CYAN=$ESC_SEQ"36;01m"
# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
export LS_COLORS='no=00:fi=00:di=01;31:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
else # macOS `ls`
colorflag="-G"
export LSCOLORS='BxBxhxDxfxhxhxhxhxcxcx'
fi
# Always use color output for `ls`
alias ls="command ls ${colorflag}"
# Source global definitions
test -r ~/.bash_aliases && . ~/.bash_aliases

74
dockerfiles/workspace/workspace74.Dockerfile

@ -71,17 +71,72 @@ RUN composer self-update # Need for correctly update to actual old branch
RUN composer self-update --${COMPOSER_VERSION} RUN composer self-update --${COMPOSER_VERSION}
########################################################################### ###########################################################################
# Laradock Aliases
# YADM
########################################################################### ###########################################################################
USER root
SHELL ["/bin/bash", "-c"]
# once please
RUN apt update
RUN apt install -y direnv yadm
RUN curl -sS https://starship.rs/install.sh | sh -s -- -f
USER laradock
RUN yadm clone --bootstrap https://vcs.wpstudio.ru/gitea/dotfiles.git
RUN sed -i 's/#/\\$/g' ${HOME}/.config/starship.toml
###########################################################################
# SUPERVISOR:
###########################################################################
USER root
ARG INSTALL_SUPERVISOR=false
RUN if [ ${INSTALL_SUPERVISOR} = true ]; then \
apt install -y supervisor \
;fi
RUN apt install -y liblzma-dev libbz2-dev libffi-dev libreadline-dev
USER laradock USER laradock
COPY ./aliases.sh /home/laradock/aliases.sh
RUN curl https://pyenv.run | bash
RUN echo '' >> ~/.shell-env.local && \
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.shell-env.local && \
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.shell-env.local && \
echo 'eval "$(pyenv init -)"' >> ~/.shell-env.local && \
echo '' >> ~/.shell-env.local && \
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.shell-env.local && \
echo '' >> ~/.shell-env.local
RUN echo "" >> ~/.bashrc && \
echo "# Load Custom Aliases" >> ~/.bashrc && \
echo "source ~/aliases.sh" >> ~/.bashrc && \
echo "" >> ~/.bashrc
RUN $HOME/.pyenv/bin/pyenv install 3.9
ARG INSTALL_PYTHON=false
RUN if [ ${INSTALL_PYTHON} = true ]; then \
export PYENV_VERSION=3.9 && \
python -m pip install uvicorn \
;fi
RUN if [ false = true ]; then \
export PYENV_VERSION=3.9 && \
python -m pip install uvicorn && \
python -m pip install --upgrade supervisor && \
echo_supervisord_conf > /etc/supervisord.conf && \
sed -i 's/\;\[include\]/\[include\]/g' /etc/supervisord.conf && \
sed -i 's/\;files\s.*/files = supervisord.d\/*.conf/g' /etc/supervisord.conf \
;fi
USER root
RUN apt install -y htop
########################################################################### ###########################################################################
# Tune opts: # Tune opts:
@ -104,6 +159,13 @@ RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" /etc/ph
USER root USER root
# Clean up
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY ./crontab /etc/cron.d COPY ./crontab /etc/cron.d
RUN chmod -R 644 /etc/cron.d RUN chmod -R 644 /etc/cron.d
#ENTRYPOINT ["/bin/bash","-c","service supervisor start"]
Loading…
Cancel
Save