Sign inSign up

freshflow/php

By freshflow

•Updated about 1 year ago

basic php repo

Image
Languages & frameworks
0

215

freshflow/php repository overview

FF4C -- FreshFlow For

⁠Development enviroment

  • install Docker from get.docker.com
  • init swarm
docker swarm init
  • define contexts via:
docker context create --help

docker context create fra3 --description "FF Frankfurt" --docker "host=ssh://<username>@ssdnodes3.freshflow.cz"
docker context create metal --description "FF Metal" --docker "host=ssh://<username>@metal209.freshflow.cz" 
docker context create ffcloud --description "FF Cloud" --docker "host=ssh://<username>@ff-ubuntu-02.freshflow.cz"
docker context create freshflow-dev --description "FF Dev" --docker "host=ssh://<username>@ssdnodes3.freshflow.cz"

  • define path to your code in ./app-config/local/deploy.sh
  • run stack
./app-config/local/stack.sh deploy

První text >⁠

⁠Host Machines

⁠A. Host VPS spec

  • Ubuntu 18.04 LTS
  • Docker installed
  • opened ports for docker swarm
  • docker swarm init / join

⁠B. Host Management

  • add server. Edit .sh file and set variables, then run it on remote:
  ssh [email protected] \ 
  "sudo su - -c bash -s" -- < cloud-init/docker-init.sh

⁠C. TODO

  • periodic server update
  • security test
  • 2FA for hosting (SSDnodes)
  • password management

⁠Docker Swarm

⁠A. Base System Stacks

  • traefik.yml
  • portainer.yml
  • swarmprom.yml
  • TODO: ELK for logging

⁠B. App Stacks

  • db.yml

    • TODO: slave
  • app.yml

    • local development: see above
    • stage/prod: app.yml, app.redis.yml, app.cluster.yml
  • run

    docker stack deploy -c db.yml db --with-registry-auth
    docker stack deploy -c app.yml -c app.redis.yml -c app.cluster.yml app --with-registry-auth
    
  • app.notifier.yml

⁠C. Environment vars

  • FF_APP_ID
  • FF_CONFIG_LOCAL_FILE
  • FF_APPLICATION_MODE
  • FF_NEW_RELIC
  • FF_ELASTIC_PASSWORD
  • FF_CONFIG_NEON
  • FF_PLUGIN

⁠D. YAML/NEON configs

  • stored in git
    • protected/config.neon
    • resources/PLUGIN/protected/config.neon
    • protected/config.d/FF_APP_ID.neon //from ID of app
  • should be defined as secret
    • protected/config.local.neon OR from ENV FF_CONFIG_LOCAL_FILE

Env variables can be read when parsing .neon files. If Yaml extension is loaded, yaml is used, otherwise neon Syntax:

  • NEON:
    • env(VAR_NAME)
    • env(VAR_NAME,default)
  • YAML:
    • !ENV VAR_NAME
    • !ENV [ VAR_NAME , default ]

⁠E. Early PHP configs

Are loaded before $app->run(); PLUGIN is defined from env FF_PLUGIN or GENERAL:

  • protected/config.php
  • resources/PLUGIN/protected/config.php
  • protected/config.local.php

Will be stored in git, if credentials necessary, define as constants with (name is prefixed FF_ to get variable name)

defineWithEnv($name,$default);
⁠How to fix
  1. MySQL won't start
110509 12:04:27 [ERROR] Plugin 'InnoDB' init function returned error.
110509 12:04:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

Solution:

  • set mysql deploy - replicas to 0
  • mount volume in any container - for example php-fpm
  • go to /var/lib/mysql
  • move or remove both ./ib_logfile0 and ./ib_logfile1
⁠Restore db dump from host ssh
docker exec -i db_mysql.1.rhpcjax4916p53wcoiukld4w3 sh -c 'mysql -u root -pXXXX' < 2020-07-15T201709Z.app_ff_cz.sql

Tag summary

Content type

Image

Digest

sha256:c5853cc6c…

Size

141.1 MB

Last updated

about 1 year ago

docker pull freshflow/php:8.4-fpm