diff --git a/.env b/.env deleted file mode 100755 index 1bbcf61..0000000 --- a/.env +++ /dev/null @@ -1,35 +0,0 @@ -RENDERTRON_CACHE_DEBUG=0 -RENDERTRON_CACHE_LOCK_TIMEOUT=1 -RENDERTRON_CACHE_ROOT=./cache -RENDERTRON_CACHE_FILE_SUFFIX=.json -RENDERTRON_CACHE_RESOURCE_URL=http://rendertron:3000/render -RENDERTRON_CACHE_RESOURCE_METHOD=GET -RENDERTRON_CACHE_HEADER_REQUEST_BLACKLIST= -RENDERTRON_CACHE_HEADER_RESPONSE_BLACKLIST=Set-Cookie,Content-Encoding,Transfer-Encoding - -API_URL=http://dashboard:8080/docs/ -API_VER=v1 -API_NAME=snaptron -API_PASS=Sn@ptron1337 - -CACHEWARMER_CACHE_SERVER_URL=http://cacheserver:5000/render -CACHEWARMER_USER_AGENT=Seosnap -CACHEWARMER_THREADS=2 -CACHEWARMER_CONCURRENT_REQUESTS=2 -CACHEWARMER_LOG_LEVEL=ERROR -CACHEWARMER_BUFFER_SIZE=50 - -EXTERNAL_CACHE_SERVER_URL= - -DB_ROOT_HOST=% -DB_HOST=db -DB_NAME=seosnap_dashboard -DB_USER=snaptron -DB_PASS=snaptron - -ADMIN_EMAIL=snaptron@snaptron.nl -ADMIN_NAME=snaptron -ADMIN_PASS=Sn@ptron1337 -ADMIN_SECRET="981xu2xx(b#ak3%$8jp$xc5=&z+b#66w0hx5!4tmfqnfk=9^u&" -ADMIN_DEBUG=1 -ADMIN_LOG_LEVEL=ERROR \ No newline at end of file diff --git a/.env.docker b/.env.docker new file mode 100644 index 0000000..fbbb4ba --- /dev/null +++ b/.env.docker @@ -0,0 +1 @@ +# A hack. Since docker compose wont override this for some reason diff --git a/.env.example b/.env.example index dad2377..13f8ef7 100755 --- a/.env.example +++ b/.env.example @@ -7,7 +7,7 @@ RENDERTRON_CACHE_RESOURCE_METHOD=GET RENDERTRON_CACHE_HEADER_REQUEST_BLACKLIST= RENDERTRON_CACHE_HEADER_RESPONSE_BLACKLIST=Set-Cookie,Content-Encoding,Transfer-Encoding -API_URL=http://dashboard:8080/docs/ +API_URL=http://dashboard:80/docs/ API_VER=v1 API_NAME=snaptron API_PASS=Sn@ptron1337 @@ -24,12 +24,12 @@ EXTERNAL_CACHE_SERVER_URL= DB_ROOT_HOST=% DB_HOST=db DB_NAME=seosnap_dashboard -DB_USER=snaptron -DB_PASS=snaptron +DB_USER=snaptron_db +DB_PASS=snaptron_db ADMIN_EMAIL=snaptron@snaptron.nl ADMIN_NAME=snaptron ADMIN_PASS=Sn@ptron1337 ADMIN_SECRET="https://miniwebtool.com/django-secret-key-generator/" ADMIN_DEBUG=1 -ADMIN_LOG_LEVEL=ERROR \ No newline at end of file +ADMIN_LOG_LEVEL=ERROR diff --git a/.gitignore b/.gitignore index dc3e1db..e2bd815 100755 --- a/.gitignore +++ b/.gitignore @@ -2,12 +2,13 @@ /.idea /dev/instance !/dev/instance/.gitkeep -!/.env +/.env !/.env.example /cache !/cache/.gitkeep /logs !/logs/.gitkeep +.env # Created by .ignore support plugin (hsz.mobi) ### Python template diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..83f457d --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +#!make +DC_CONFIGS = -f docker-compose.yml -f seosnap-cacheserver/docker-compose.yml -f seosnap-cachewarmer/docker-compose.yml -f seosnap-dashboard/docker-compose.yml +DC_CONFIGS_DEV = -f docker-compose.yml -f seosnap-cacheserver/docker-compose.dev.yml -f seosnap-cachewarmer/docker-compose.dev.yml -f seosnap-dashboard/docker-compose.dev.yml + + +up: + docker-compose ${DC_CONFIGS} -f docker-compose.yml up + +daemon: + docker-compose ${DC_CONFIGS} -f docker-compose.yml up -d + +build: + docker-compose ${DC_CONFIGS} -f docker-compose.yml build + +dc: + docker-compose ${DC_CONFIGS} -f docker-compose.yml ${A} + +warm: + docker-compose ${DC_CONFIGS} -f docker-compose.yml run cachewarmer ${A} + +install: + echo 'Running installation' + cp .env.example .env + sh seosnap-dashboard/dev/commands/install.sh + +update: + git submodule update --init --recursive + git submodule foreach --recursive git fetch origin master + git submodule foreach --recursive git checkout master + echo "Everything is now up to date" + +develop: + git submodule update --init --recursive + git submodule foreach --recursive git fetch origin develop + git submodule foreach --recursive git checkout develop + echo "Everything is now up to date" diff --git a/README.md b/README.md index a481b55..e85fcb2 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,13 @@ Setup for the whole seosnap stack including dashboard, cache server and cache wa page caching PWA's. # Installation -* Pull the repo (*note: the pull is recursive*) ``` +# Clone git clone --recursive git@github.com:experius/SeoSnap.git -``` -* **IMPORTANT** Update .env file admin username and password. (These have a value default value) -* Start, build and stop the container -``` -docker-compose up --build -d && docker-compose down +# Configure +make install +# Start server +make up ``` # Usage @@ -27,7 +26,8 @@ Cache directory ./cache ## Run cache warmer Make sure you have created a website via dashboard http://127.0.0.1:8080/seosnap/website/add/ ``` -docker-compose run cachewarmer cache +make cachewarmer +make warm A="cache " ``` ## Nginx @@ -78,11 +78,11 @@ Options: ### Examples ``` # Cache the sitemap of website 1 -docker-compose run cachewarmer cache 1 +make warm A="cache 1" # Cache requests in queue for websites 1 and 2 - dc run cachewarmer cache 1,2 use_queue=true +make warm A="cache 1,2 use_queue=true" # Clean the queue for websites 1 and 2 -docker-compose run cachewarmer clean 1,2 +make warm A="clean 1,2" ``` diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100755 index 0000000..303577d --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,55 @@ +version: '3.7' +services: + dashboard: + build: + context: seosnap-dashboard + container_name: seosnap_stack_dashboard + env_file: .env + volumes: + - ./seosnap-dashboard:/code + - ./logs:/code/logs + networks: + - seosnap + + cachewarmer: + build: + context: seosnap-cachewarmer + container_name: seosnap_stack_cachewarmer + env_file: .env + volumes: + - ./seosnap-cachewarmer:/code + - ./logs:/code/logs + depends_on: + - dashboard + - cacheserver + networks: + - seosnap + + cacheserver: + build: + context: seosnap-cacheserver + container_name: seosnap_stack_cacheserver + env_file: .env + volumes: + - ./cache:/app/cache + - ./logs:/app/logs + depends_on: + - rendertron + networks: + - seosnap + + rendertron: + container_name: snapstack_rendertron + networks: + - seosnap + + db: + container_name: seosnap_stack_db + volumes: + - ./dev/instance/mariadb:/var/lib/mysql + networks: + - seosnap + +networks: + seosnap: + driver: bridge diff --git a/docker-compose.yml b/docker-compose.yml index e7f778a..99fa3c2 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,32 +1,22 @@ version: '3.7' services: dashboard: - build: ./seosnap-dashboard - image: seosnap-dashboard - container_name: seosnap_dashboard - env_file: .env - environment: - DB_HOST_OVERRIDE: db + build: + context: seosnap-dashboard + container_name: seosnap_stack_dashboard + env_file: ./.env volumes: - - ./seosnap-dashboard:/code - ./logs:/code/logs - restart: "unless-stopped" - ports: - - 8080:8080 - depends_on: - - db networks: - seosnap cachewarmer: - build: ./seosnap-cachewarmer - image: seosnap-cachewarmer - container_name: seosnap_cachewarmer - env_file: .env + build: + context: seosnap-cachewarmer + container_name: seosnap_stack_cachewarmer + env_file: ./.env volumes: - - ./seosnap-cachewarmer:/code - ./logs:/code/logs - restart: "no" depends_on: - dashboard - cacheserver @@ -34,42 +24,31 @@ services: - seosnap cacheserver: - build: ./seosnap-cacheserver - image: seosnap-cacheserver - container_name: seosnap_cacheserver - env_file: .env + build: + context: seosnap-cacheserver + container_name: seosnap_stack_cacheserver + env_file: ./.env volumes: - ./cache:/app/cache - ./logs:/app/logs - restart: "unless-stopped" - ports: - - 5000:5000 depends_on: - rendertron networks: - seosnap rendertron: - image: ammobindotca/rendertron - container_name: rendertron - restart: "unless-stopped" - ports: - - 3000:3000 + container_name: snapstack_rendertron + env_file: ./.env + volumes: + - ./seosnap-cacheserver/rendertron-config.json:/app/config.json networks: - seosnap db: - image: mysql - entrypoint: ['/entrypoint.sh', '--default-authentication-plugin=mysql_native_password'] - environment: - MYSQL_ROOT_HOST: ${DB_ROOT_HOST} - MYSQL_RANDOM_ROOT_PASSWORD: "yes" - MYSQL_DATABASE: ${DB_NAME} - MYSQL_USER: ${DB_USER} - MYSQL_PASSWORD: ${DB_PASS} + container_name: seosnap_stack_db + env_file: ./.env volumes: - ./dev/instance/mariadb:/var/lib/mysql - restart: "unless-stopped" networks: - seosnap diff --git a/seosnap-cacheserver b/seosnap-cacheserver index 8af5eb4..6bc6cdf 160000 --- a/seosnap-cacheserver +++ b/seosnap-cacheserver @@ -1 +1 @@ -Subproject commit 8af5eb4b633a075fa70f6459e33da43c18f1ea78 +Subproject commit 6bc6cdff99617b3c2374c9936166e2f1e24f9725 diff --git a/seosnap-cachewarmer b/seosnap-cachewarmer index f2d38da..7f931b9 160000 --- a/seosnap-cachewarmer +++ b/seosnap-cachewarmer @@ -1 +1 @@ -Subproject commit f2d38da035ea806182174e48cdce369bc4ab74fc +Subproject commit 7f931b9d2b962b219a074dbf612fb4ced356f14d diff --git a/seosnap-dashboard b/seosnap-dashboard index 390120c..b7830d7 160000 --- a/seosnap-dashboard +++ b/seosnap-dashboard @@ -1 +1 @@ -Subproject commit 390120c9aa15c609f8b02b9712cb1f5787c583b6 +Subproject commit b7830d7a99fcfc48a072a5ce3acb81065b01f0da