forked from riadvice/bbbeasy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa2f7a4
commit a30b682
Showing
12 changed files
with
274 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ | |
settings.json | ||
|
||
output/**/*.* | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,57 @@ | ||
version: "3.8" | ||
|
||
networks: | ||
hivelvet-network: | ||
ipam: | ||
config: | ||
- subnet: 172.55.0.0/24 | ||
hivelvet-network: | ||
ipam: | ||
config: | ||
- subnet: 172.55.0.0/24 | ||
|
||
services: | ||
webserver: | ||
restart: always | ||
image: nginx:1.23.2-alpine | ||
container_name: hv_nginx | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
networks: | ||
hivelvet-network: | ||
ipv4_address: 172.55.0.10 | ||
#installer: | ||
#webapp: | ||
#backend: | ||
db: | ||
restart: always | ||
image: perconalab/percona-distribution-postgresql:15.1 | ||
container_name: hv_db | ||
environment: | ||
POSTGRES_PASSWORD: hv | ||
networks: | ||
hivelvet-network: | ||
ipv4_address: 172.55.0.50 | ||
webserver: | ||
restart: always | ||
image: nginx:1.23.2-alpine | ||
container_name: hv_nginx | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
networks: | ||
hivelvet-network: | ||
ipv4_address: 172.55.0.10 | ||
volumes: | ||
- hivelvet-backend-repo:/var/www/hivelvet | ||
- ./docker/site_backend.conf:/etc/nginx/conf.d/site_backend.conf:ro | ||
backend: | ||
restart: always | ||
image: riadvice/hivelvet-backend | ||
container_name: hv_backend | ||
ports: | ||
- "9000:9000" | ||
networks: | ||
hivelvet-network: | ||
ipv4_address: 172.55.0.20 | ||
volumes: | ||
- hivelvet-backend-repo:/var/www/hivelvet | ||
- ./docker/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro | ||
- ./docker/www-hivelvet.conf:/usr/local/etc/php-fpm.d/www-hivelvet.conf:ro | ||
#installer: | ||
#webapp: | ||
db: | ||
restart: always | ||
image: perconalab/percona-distribution-postgresql:15.1 | ||
container_name: hv_db | ||
environment: | ||
POSTGRES_PASSWORD: hv | ||
networks: | ||
hivelvet-network: | ||
ipv4_address: 172.55.0.50 | ||
|
||
cache: | ||
restart: always | ||
image: redis:7.0.5-alpine | ||
container_name: hv_cache | ||
networks: | ||
hivelvet-network: | ||
ipv4_address: 172.55.0.60 | ||
cache: | ||
restart: always | ||
image: redis:7.0.5-alpine | ||
container_name: hv_cache | ||
networks: | ||
hivelvet-network: | ||
ipv4_address: 172.55.0.60 | ||
|
||
volumes: | ||
hivelvet-backend-repo: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apc.enable_cli = 1 | ||
date.timezone = Africa/Tunis | ||
session.auto_start = Off | ||
short_open_tag = Off | ||
post_max_size = 10M | ||
upload_max_filesize = 5M | ||
|
||
# http://symfony.com/doc/current/performance.html | ||
opcache.max_accelerated_files = 20000 | ||
opcache.memory_consumption = 256 | ||
realpath_cache_size = 4096K | ||
realpath_cache_ttl = 600 | ||
|
||
# hide version number php Http Header | ||
expose_php = Off | ||
|
||
#XDEBUG Config | ||
xdebug.start_with_request=no | ||
xdebug.discover_client_host=false | ||
xdebug.mode=off | ||
xdebug.idekey=PHPSTORM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
upstream hv_backend-upstream { server hv_backend:9000; } | ||
|
||
server { | ||
charset utf-8; | ||
sendfile off; | ||
|
||
listen 80; ## listen for ipv4 | ||
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6 | ||
|
||
server_name ${API_HOST}; | ||
|
||
root /var/www/hivelvet/public; | ||
index index.php; | ||
|
||
access_log /var/log/nginx/hivelvet-backend-access.log; | ||
error_log /var/log/nginx//hivelvet-backend-error.log; | ||
|
||
location / { | ||
# Checks whether the requested url exists as a file ($uri) or directory ($uri/) in the root, else redirect to /index.php. | ||
try_files $uri $uri/ @redirects; | ||
# try_files $uri /index.php?$query_string; | ||
} | ||
# Redirect mail bounce and ping | ||
location ~ ^/mailer-ping/(.*$) { | ||
try_files $uri $uri/ @redirects; | ||
} | ||
|
||
location @redirects { | ||
rewrite ^ /index.php; | ||
} | ||
|
||
location ~ \.php$ { | ||
try_files $uri =404; | ||
include fastcgi_params; | ||
fastcgi_pass hv_backend-upstream; | ||
fastcgi_index index.php; | ||
fastcgi_read_timeout 60; | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
} | ||
|
||
# Don't pollute the logs with common requests | ||
location = /robots.txt { | ||
access_log off; log_not_found off; | ||
} | ||
location = /favicon.ico { | ||
access_log off; log_not_found off; | ||
} | ||
|
||
########################## | ||
# Security | ||
########################## | ||
# Hide Nginx version in headers | ||
server_tokens off; | ||
|
||
# Deny access to dot-files. | ||
location ~ /\. { | ||
deny all; | ||
access_log off; | ||
log_not_found off; | ||
} | ||
|
||
# Enable this if you want custom error pages | ||
# error_page 500 502 503 504 /50x.html; | ||
# location = /50x.html { | ||
# root html; | ||
# } | ||
|
||
########################## | ||
# Additional Nginx Tweaks | ||
# Read more: https://www.digitalocean.com/community/tutorials/how-to-optimize-nginx-configuration | ||
# Read more: https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/ | ||
########################## | ||
# Buffers | ||
client_body_buffer_size 10K; # Handles the client buffer size, meaning any POST actions like form submissions. | ||
client_header_buffer_size 1k; # Handles the client header size. 1K is a decent size. | ||
client_max_body_size 50M; # The maximum allowed size of a request. If exceeded, Nginx throws a 413 Request Entity Too Large. | ||
large_client_header_buffers 4 512k; # The max number and size of buffers for large client headers. | ||
|
||
# Timeouts | ||
client_body_timeout 12; # Time a server will wait for a client body to be sent after request. | ||
client_header_timeout 12; # Time a server will wait for a client header to be sent after request. | ||
keepalive_timeout 15; # Timeout for keep-alive connections. After this period of time, the connection is closed. | ||
send_timeout 10; # If after this time, the client will take nothing, then Nginx shuts down the connection. | ||
|
||
# Gzip compression | ||
gzip on; | ||
gzip_comp_level 6; # Compression level, 1-9. Higher means smaller files, but wasting more CPU cycles. | ||
gzip_min_length 1000; # Minimum file size in bytes (really small files aren’t worth compressing) | ||
gzip_proxied expired no-cache no-store private auth; | ||
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml; | ||
gzip_buffers 4 32k; | ||
gzip_vary on; | ||
|
||
# Static file caching | ||
# Set expires headers for files that don't change often and are served regularly, and turn off 404 error logging. | ||
location ~* \.(?:ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|js|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { | ||
expires 1y; | ||
access_log off; | ||
log_not_found off; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[www] | ||
pm.max_children = 27 | ||
pm.start_servers = 8 | ||
pm.min_spare_servers = 4 | ||
pm.max_spare_servers = 12 | ||
pm.max_requests = 64 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
workspace/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
app/config/config-*.ini | ||
logs/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM keymetrics/pm2:latest-alpine | ||
|
||
LABEL authors="[email protected]" | ||
|
||
ENV TERM="xterm" | ||
|
||
# Update headers | ||
RUN apk add --update linux-headers | ||
|
||
# Minimal packages | ||
RUN apk update && apk upgrade && apk add --no-cache --virtual .persistent-deps \ | ||
acl \ | ||
bash \ | ||
curl | ||
|
||
COPY ecosystem/config ecosystem/config/ | ||
COPY ecosystem/package.json ecosystem/ | ||
COPY ecosystem/yarn.lock ecosystem/ | ||
COPY ecosystem/ecosystem.config.js ecosystem/ | ||
|
||
COPY ../hivelvet-frontend/build/installer . | ||
|
||
# Install app dependencies | ||
ENV NPM_CONFIG_LOGLEVEL warn | ||
RUN npm install -g yarn | ||
RUN yarn install --production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env bash | ||
|
||
# The real location of the script | ||
SCRIPT=$(readlink -f "$0") | ||
|
||
# Current unix username | ||
USER=$(whoami) | ||
|
||
# Directory where the script is located | ||
BASEDIR=$(dirname "$SCRIPT") | ||
|
||
# Build directory | ||
BUILD_WORKSPACE="$BASEDIR/workspace" | ||
|
||
# Formatted current date | ||
NOW=$(date +"%Y-%m-%d_%H.%M.%S") | ||
|
||
mkdir -p "$BASEDIR/logs" | ||
|
||
# | ||
# clean workspace | ||
# | ||
clean_workspace() { | ||
echo "Cleaning old workspace" | ||
rm -rf "$BUILD_WORKSPACE" | ||
mkdir -p "$BUILD_WORKSPACE" | ||
} | ||
|
||
build_backend() { | ||
clean_workspace | ||
cp -r "$BASEDIR/backend.Dockerfile" "$BUILD_WORKSPACE/Dockerfile" | ||
cp -r "$BASEDIR/backend.dockerignore" "$BUILD_WORKSPACE/.dockerignore" | ||
cp -r "$BASEDIR/../hivelvet-backend/app/" "$BUILD_WORKSPACE/app" | ||
cp -r "$BASEDIR/../hivelvet-backend/db/" "$BUILD_WORKSPACE/db" | ||
cp -r "$BASEDIR/../hivelvet-backend/logs/" "$BUILD_WORKSPACE/logs" | ||
cp -r "$BASEDIR/../hivelvet-backend/public/" "$BUILD_WORKSPACE/public" | ||
cp -r "$BASEDIR/../hivelvet-backend/tmp/" "$BUILD_WORKSPACE/tmp" | ||
cp -r "$BASEDIR/../hivelvet-backend/uploads/" "$BUILD_WORKSPACE/uploads" | ||
cp -r "$BASEDIR/../hivelvet-backend/composer.json" "$BUILD_WORKSPACE/composer.json" | ||
cp -r "$BASEDIR/../hivelvet-backend/composer.lock" "$BUILD_WORKSPACE/composer.lock" | ||
cp -r "$BASEDIR/../hivelvet-backend/phinx.yml" "$BUILD_WORKSPACE/phinx.yml" | ||
# Todo add tag to publish riadvice/hivelvet-backend:tagname | ||
open_workspace | ||
docker build -t riadvice/hivelvet-backend . | ||
} | ||
|
||
open_workspace() { | ||
cd "$BUILD_WORKSPACE" | ||
} | ||
|
||
run() { | ||
build_backend | ||
|
||
# Finally clean workspace | ||
clean_workspace | ||
} | ||
|
||
run 2>&1 | tee -a "$BASEDIR/logs/build-hivelvet-$NOW.log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
API_HOST= | ||
WEBAPP_HOST= | ||
|