mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 06:02:32 -05:00
misc: add develop images (faster and debug ready images)
This commit is contained in:
parent
945e52b4f8
commit
d8e205ec25
7 changed files with 193 additions and 45 deletions
83
docker/docker-compose-develop.yml
Normal file
83
docker/docker-compose-develop.yml
Normal file
|
@ -0,0 +1,83 @@
|
|||
version: "3"
|
||||
|
||||
volumes:
|
||||
backend_m2:
|
||||
backend_data:
|
||||
db_data:
|
||||
|
||||
networks:
|
||||
default:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.177.13.0/24
|
||||
|
||||
services:
|
||||
uxdb:
|
||||
image: postgres:11
|
||||
# container_name: uxdb
|
||||
restart: always
|
||||
ports:
|
||||
- 5432
|
||||
environment:
|
||||
- POSTGRES_INITDB_ARGS="--data-checksums"
|
||||
- POSTGRES_DB=uxbox
|
||||
- POSTGRES_USER=uxbox
|
||||
- POSTGRES_PASSWORD=uxbox_postgres_password
|
||||
volumes:
|
||||
- db_data:/var/lib/postgresql/data
|
||||
# - /etc/localtime:/etc/localtime:ro
|
||||
# - /etc/timezone:/etc/timezone:ro
|
||||
|
||||
uxbackend:
|
||||
image: uxbox-production-backend:latest
|
||||
# container_name: uxbackend
|
||||
restart: always
|
||||
depends_on:
|
||||
- uxdb
|
||||
ports:
|
||||
- 6060
|
||||
volumes:
|
||||
- backend_data:/srv/uxbox/resources/public
|
||||
- backend_m2:/root/.m2
|
||||
# - /etc/localtime:/etc/localtime:ro
|
||||
# - /etc/timezone:/etc/timezone:ro
|
||||
|
||||
environment:
|
||||
# HTTP setup
|
||||
- UXBOX_HTTP_SERVER_DEBUG=false
|
||||
- UXBOX_MEDIA_URI="/media/"
|
||||
- UXBOX_ASSETS_URI="/static/"
|
||||
# Database setup
|
||||
- UXBOX_DATABASE_USERNAME="uxbox"
|
||||
- UXBOX_DATABASE_PASSWORD="uxbox_postgres_password"
|
||||
- UXBOX_DATABASE_NAME="uxbox"
|
||||
- UXBOX_DATABASE_SERVER="uxdb"
|
||||
- UXBOX_DATABASE_PORT=5432
|
||||
# Mail setup
|
||||
- UXBOX_EMAIL_REPLY_TO="no-reply@uxbox.io"
|
||||
- UXBOX_EMAIL_FROM="no-reply@uxbox.io"
|
||||
# STMP setup
|
||||
- UXBOX_SMTP_HOST="localhost"
|
||||
- UXBOX_SMTP_PORT=25
|
||||
- UXBOX_SMTP_USER="uxbox"
|
||||
- UXBOX_SMTP_PASSWORD="youshouldoverwritethiswithsomethingelse"
|
||||
- UXBOX_SMTP_SSL=false
|
||||
- UXBOX_SMTP_TLS=false
|
||||
- UXBOX_SMTP_ENABLED=false
|
||||
# Security setup
|
||||
- UXBOX_SECRET="foobar"
|
||||
|
||||
uxfrontend:
|
||||
image: uxbox-develop-frontend:latest
|
||||
# container_name: uxfrontend
|
||||
#hostname: uxbox.io
|
||||
restart: always
|
||||
depends_on:
|
||||
- uxbackend
|
||||
ports:
|
||||
- 8081:8080
|
||||
volumes:
|
||||
- backend_data:/srv/uxbox/
|
||||
# - /etc/localtime:/etc/localtime:ro
|
||||
# - /etc/timezone:/etc/timezone:ro
|
|
@ -15,10 +15,10 @@ networks:
|
|||
services:
|
||||
uxdb:
|
||||
image: postgres:11
|
||||
container_name: uxdb
|
||||
# container_name: uxdb
|
||||
restart: always
|
||||
ports:
|
||||
- "5432:5432"
|
||||
- 5432
|
||||
environment:
|
||||
- POSTGRES_INITDB_ARGS="--data-checksums"
|
||||
- POSTGRES_DB=uxbox
|
||||
|
@ -31,12 +31,12 @@ services:
|
|||
|
||||
uxbackend:
|
||||
image: uxbox-production-backend:latest
|
||||
container_name: uxbackend
|
||||
# restart: always
|
||||
# container_name: uxbackend
|
||||
restart: always
|
||||
depends_on:
|
||||
- uxdb
|
||||
ports:
|
||||
- 6060:6060
|
||||
- 6060
|
||||
volumes:
|
||||
- backend_data:/srv/uxbox/resources/public
|
||||
- backend_m2:/root/.m2
|
||||
|
@ -70,7 +70,7 @@ services:
|
|||
|
||||
uxfrontend:
|
||||
image: uxbox-production-frontend:latest
|
||||
container_name: uxfrontend
|
||||
# container_name: uxfrontend
|
||||
#hostname: uxbox.io
|
||||
restart: always
|
||||
depends_on:
|
||||
|
|
|
@ -15,11 +15,12 @@
|
|||
"dist:view": "clojure -Adev tools.clj dist view",
|
||||
"dist:worker": "clojure -Adev tools.clj dist worker",
|
||||
"dist:assets": "NODE_ENV=production gulp dist",
|
||||
"start": "npm run figwheel",
|
||||
"build:test": "clojure -Adev tools.clj build-tests",
|
||||
"build:main": "clojure -Adev tools.clj build main",
|
||||
"build:view": "clojure -Adev tools.clj build view",
|
||||
"build:worker": "clojure -Adev tools.clj build worker",
|
||||
"build:assets": "gulp dist",
|
||||
"start": "npm run figwheel",
|
||||
"build:test": "clojure -Adev tools.clj build-tests",
|
||||
"figwheel": "clojure -Adev tools.clj figwheel"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
10
frontend/scripts/build-develop.sh
Executable file
10
frontend/scripts/build-develop.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
source ~/.bashrc
|
||||
|
||||
npm install
|
||||
|
||||
npm run dist:clean || exit 1;
|
||||
npm run build:assets || exit 1;
|
||||
npm run build:main || exit 1;
|
||||
npm run build:view || exit 1;
|
||||
npm run build:worker || exit 1;
|
|
@ -2,6 +2,7 @@
|
|||
source ~/.bashrc
|
||||
|
||||
npm install
|
||||
|
||||
npm run dist:clean || exit 1;
|
||||
npm run dist:assets || exit 1;
|
||||
npm run dist:main || exit 1;
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
[[_ name]]
|
||||
(api/build (api/inputs "src")
|
||||
(merge default-build-options
|
||||
(get-output-options name false ::path)
|
||||
{:optimizations :simple})))
|
||||
(get-output-options name true true)
|
||||
{:optimizations :none})))
|
||||
|
||||
(defmethod task "build-tests"
|
||||
[& args]
|
||||
|
|
123
manage.sh
123
manage.sh
|
@ -84,26 +84,27 @@ function run-backend-tests {
|
|||
$CONTAINER ./scripts/run-tests-in-docker.sh
|
||||
}
|
||||
|
||||
function build-release-frontend-local {
|
||||
function build-frontend-local {
|
||||
build-devenv-if-not-exists;
|
||||
|
||||
mkdir -p $HOME/.m2
|
||||
rm -rf ./frontend/node_modules
|
||||
|
||||
CONTAINER=$IMGNAME:latest
|
||||
CONTAINER=$IMGNAME:latest;
|
||||
BUILD_TYPE=$1;
|
||||
|
||||
echo "Running development image $CONTAINER to build frontend release..."
|
||||
echo "Running development image $CONTAINER to build frontend $BUILD_TYPE ..."
|
||||
docker run -ti --rm \
|
||||
-w /home/uxbox/uxbox/frontend \
|
||||
-v `pwd`:/home/uxbox/uxbox \
|
||||
-v $HOME/.m2:/home/uxbox/.m2 \
|
||||
-e UXBOX_API_URL="/api" \
|
||||
-e UXBOX_VIEW_URL="/view" \
|
||||
$CONTAINER ./scripts/build-release.sh
|
||||
$CONTAINER ./scripts/build-$BUILD_TYPE.sh
|
||||
}
|
||||
|
||||
function build-release-frontend {
|
||||
build-release-frontend-local || exit 1;
|
||||
function build-release-frontend-image {
|
||||
build-frontend-local "release" || exit 1;
|
||||
rm -rf docker/release.frontend/dist || exit 1;
|
||||
cp -vr frontend/dist docker/release.frontend/ || exit 1;
|
||||
|
||||
|
@ -115,7 +116,20 @@ function build-release-frontend {
|
|||
rm -rf docker/release.frontend/dist || exit 1;
|
||||
}
|
||||
|
||||
function build-release-backend-local {
|
||||
function build-develop-frontend-image {
|
||||
build-frontend-local "develop" || exit 1;
|
||||
rm -rf docker/release.frontend/dist || exit 1;
|
||||
cp -vr frontend/dist docker/release.frontend/ || exit 1;
|
||||
|
||||
docker build --rm=true \
|
||||
-t uxbox-develop-frontend:$REV \
|
||||
-t uxbox-develop-frontend:latest \
|
||||
docker/release.frontend/;
|
||||
|
||||
rm -rf docker/release.frontend/dist || exit 1;
|
||||
}
|
||||
|
||||
function build-backend-local {
|
||||
echo "Prepare backend release..."
|
||||
|
||||
rm -rf ./backend/dist
|
||||
|
@ -129,8 +143,8 @@ function build-release-backend-local {
|
|||
./backend/ ./backend/dist/
|
||||
}
|
||||
|
||||
function build-release-backend {
|
||||
build-release-backend-local || exit 1;
|
||||
function build-release-backend-image {
|
||||
build-backend-local || exit 1;
|
||||
rm -rf docker/release.backend/dist || exit 1;
|
||||
cp -vr backend/dist docker/release.backend/ || exit 1;
|
||||
|
||||
|
@ -142,40 +156,65 @@ function build-release-backend {
|
|||
rm -rf docker/release.backend/dist || exit 1;
|
||||
}
|
||||
|
||||
function build-release {
|
||||
echo "Building frontend release..."
|
||||
build-release-frontend || exit 1;
|
||||
echo "Building backend release..."
|
||||
build-release-backend || exit 1;
|
||||
function build-release-images {
|
||||
echo "Building frontend release image ..."
|
||||
build-release-frontend-image || exit 1;
|
||||
echo "Building backend release image ..."
|
||||
build-release-backend-image || exit 1;
|
||||
}
|
||||
|
||||
function build-develop-images {
|
||||
echo "Building frontend develop image ..."
|
||||
build-develop-frontend-image || exit 1;
|
||||
|
||||
echo "Building backend develop image (same as release)..."
|
||||
build-release-backend-image || exit 1;
|
||||
}
|
||||
|
||||
function run-release {
|
||||
if [[ ! $(docker images uxbox-backend:latest) ]]; then
|
||||
build-release
|
||||
if [[ ! $(docker images uxbox-release-backend:latest) ]]; then
|
||||
build-release-backend-image
|
||||
fi
|
||||
|
||||
if [[ ! $(docker images uxbox-frontend:latest) ]]; then
|
||||
build-release
|
||||
if [[ ! $(docker images uxbox-release-frontend:latest) ]]; then
|
||||
build-release-frontend-image
|
||||
fi
|
||||
|
||||
echo "Running production images..."
|
||||
sudo docker-compose -f ./docker/docker-compose.yml up -d
|
||||
sudo docker-compose -p uxbox-release -f ./docker/docker-compose.yml up -d
|
||||
}
|
||||
|
||||
function run-develop {
|
||||
if [[ ! $(docker images uxbox-release-backend:latest) ]]; then
|
||||
build-release-backend-image
|
||||
fi
|
||||
|
||||
if [[ ! $(docker images uxbox-develop-frontend:latest) ]]; then
|
||||
build-develop-frontend-image
|
||||
fi
|
||||
|
||||
echo "Running production images..."
|
||||
sudo docker-compose -p uxbox-develop -f ./docker/docker-compose-develop.yml up -d
|
||||
}
|
||||
|
||||
function usage {
|
||||
echo "UXBOX build & release manager v$REV"
|
||||
echo "USAGE: $0 OPTION"
|
||||
echo "Options:"
|
||||
echo "- clean Stop and clean up docker containers"
|
||||
echo "- build-devenv Build docker container for development with tmux"
|
||||
echo "- run-devenv Run (and build if necessary) development container (frontend at localhost:3449, backend at localhost:6060)"
|
||||
echo "- run-all-tests Execute unit tests for both backend and frontend"
|
||||
echo "- run-frontend-tests Execute unit tests for frontend only"
|
||||
echo "- run-backend-tests Execute unit tests for backend only"
|
||||
echo "- build-release Build 'production ready' docker images for both backend and frontend"
|
||||
echo "- build-release-frontend Build a 'production ready' docker images for frontend only"
|
||||
echo "- build-release-backend Build a 'production ready' docker images for backend only"
|
||||
echo "- run-release Run 'production ready' docker images for both backend and frontend"
|
||||
echo "- clean Stop and clean up docker containers"
|
||||
echo "- build-devenv Build docker container for development with tmux"
|
||||
echo "- run-devenv Run (and build if necessary) development container (frontend at localhost:3449, backend at localhost:6060)"
|
||||
echo "- run-all-tests Execute unit tests for both backend and frontend"
|
||||
echo "- run-frontend-tests Execute unit tests for frontend only"
|
||||
echo "- run-backend-tests Execute unit tests for backend only"
|
||||
echo "- build-release-images Build 'production ready' docker images for both backend and frontend"
|
||||
echo "- build-release-frontend-image Build a 'production ready' docker images for frontend only"
|
||||
echo "- build-release-backend-image Build a 'production ready' docker images for backend only"
|
||||
echo "- build-develop-images Build 'develop' docker images for both backend and frontend"
|
||||
echo "- build-develop-frontend-image Build a 'develop' docker images for frontend only"
|
||||
echo "- build-develop-backend-image Build a 'develop' docker images for backend only"
|
||||
echo "- run-release Run 'production ready' docker images for both backend and frontend using docker compose"
|
||||
echo "- run-develop Run 'develop' docker images for both backend and frontend using docker compose"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
|
@ -198,18 +237,32 @@ case $1 in
|
|||
run-backend-tests)
|
||||
run-backend-tests
|
||||
;;
|
||||
build-release)
|
||||
build-release
|
||||
|
||||
build-release-images)
|
||||
build-release-images
|
||||
;;
|
||||
build-release-frontend)
|
||||
build-release-frontend
|
||||
|
||||
build-release-frontend-image)
|
||||
build-release-frontend-image
|
||||
;;
|
||||
build-release-backend)
|
||||
build-release-backend
|
||||
build-release-backend-image)
|
||||
build-release-backend-image
|
||||
;;
|
||||
run-release)
|
||||
run-release
|
||||
;;
|
||||
|
||||
|
||||
build-develop-images)
|
||||
build-develop-images
|
||||
;;
|
||||
build-develop-frontend-image)
|
||||
build-develop-frontend-image
|
||||
;;
|
||||
run-develop)
|
||||
run-develop
|
||||
;;
|
||||
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
|
|
Loading…
Add table
Reference in a new issue