[新服务] Docker 一款优雅的开源自托管书签和笔记应用 - Benotes
date
Feb 24, 2024
slug
newservice-benotes-bookmarks
status
Published
summary
新服务-
tags
service
type
Post
URL
Summary
- ‣
步骤
#
export DOCKER_PROJ=benotes
export DOCKER_PROJ_DOMAIN=$DOCKER_PROJ.riyu.org
mkdir /data/$DOCKER_PROJ && cd /data/$DOCKER_PROJ
mkdir -p ./data/nginx/logs/ ./data/storage ./data/benotes_postgres
chmod 777 -R data
chmod 777 -R .env
git clone https://github.com/fr0tt/benotes_docker-compose
cp benotes_docker-compose/.env.example .env
cp benotes_docker-compose/docker-compose.yml ./
vi docker-compose.yml
version: "3.6"
services:
app:
container_name: benotes_app
image: fr0tt/benotes:latest
restart: unless-stopped
environment:
DB_CONNECTION: ${DB_CONNECTION}
#ports:
#- ${APP_PORT}:80
volumes:
- .env:/var/www/.env
- ./data/storage/app/public/thumbnails:/var/www/storage/app/public/thumbnails
- ./data/storage/backup:/var/www/storage/backup
- ./data/storage/logs:/var/www/storage/logs
# or instead one named volume to rule them all:
#- benotes_storage:/var/www/storage
#- ./data/storage:/var/www/storage
# this is optional (either way):
- ./data/nginx/logs/:/var/lib/nginx/logs/
networks:
- benotes
- npm_nginx_proxy_manager-network
db:
container_name: benotes_db
image: postgres:15.2-alpine
restart: unless-stopped
environment:
POSTGRES_DATABASE: ${DB_DATABASE}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_PASSWORD: ${DB_PASSWORD}
ports:
- ${DB_PORT}
volumes:
- ./data/benotes_postgres:/var/lib/postgresql/data
networks:
- benotes
#
# If you wish to use MySQL instead remove the lines above, uncomment the following
# and change DB_PORT in your .env file to 3306
#
# db:
# container_name: benotes_db
# image: mysql:5.7
# restart: unless-stopped
# environment:
# MYSQL_DATABASE: ${DB_DATABASE}
# MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
# MYSQL_USER: ${DB_USERNAME}
# MYSQL_PASSWORD: ${DB_PASSWORD}
# ports:
# - ${DB_PORT}
# volumes:
# - benotes_mysql:/var/lib/mysql
# networks:
# - benotes
networks:
benotes:
driver: bridge
npm_nginx_proxy_manager-network:
external: true
#volumes:
# benotes_postgres:
# driver: "local"
# # benotes_mysql:
# # driver: "local"
# benotes_storage:
# driver: "local"
docker-compose down; docker-compose up -d; sleep 1s; docker-compose logs -f
docker-compose exec --user application app sh
# inside docker
php artisan install
# 再重启一下composer