From 8a7c802614626c6433708785c329ef5c7b3cd9fa Mon Sep 17 00:00:00 2001 From: Fred van Dijk Date: Thu, 16 Feb 2023 13:59:08 +0100 Subject: [PATCH 01/10] Clean up ansible, not using it anymore Rewrite stack for testing.ploneconfig.org --- devops/.env_local | 12 -- devops/.gitignore | 11 -- devops/Makefile | 135 -------------------- devops/README.md | 89 ------------- devops/Vagrantfile | 14 --- devops/ansible.cfg | 9 -- devops/group_vars/all/groups.yml | 5 - devops/group_vars/all/host.yml | 3 - devops/group_vars/all/motd.yml | 4 - devops/group_vars/all/swap.yml | 5 - devops/group_vars/all/ufw.yml | 5 - devops/group_vars/all/users.yml | 15 --- devops/host_vars/ploneconf-local.yml | 8 -- devops/inventory/local.yml | 9 -- devops/playbook-setup.yml | 60 --------- devops/requirements/ansible.yml | 27 ---- devops/requirements/python.txt | 2 - devops/stacks/2022.ploneconf.org.yml | 144 --------------------- devops/stacks/default.conf | 42 ------- devops/stacks/docker-compose-latest.yml | 42 ------- devops/stacks/docker-compose-local.yml | 44 ------- devops/stacks/plone.yml | 159 ------------------------ devops/stacks/testing.ploneconf.org.yml | 73 +++++++++++ node_modules/.yarn-integrity | 10 ++ yarn.lock | 4 + 25 files changed, 87 insertions(+), 844 deletions(-) delete mode 100644 devops/.env_local delete mode 100644 devops/.gitignore delete mode 100644 devops/Makefile delete mode 100644 devops/README.md delete mode 100644 devops/Vagrantfile delete mode 100644 devops/ansible.cfg delete mode 100644 devops/group_vars/all/groups.yml delete mode 100644 devops/group_vars/all/host.yml delete mode 100644 devops/group_vars/all/motd.yml delete mode 100644 devops/group_vars/all/swap.yml delete mode 100644 devops/group_vars/all/ufw.yml delete mode 100644 devops/group_vars/all/users.yml delete mode 100644 devops/host_vars/ploneconf-local.yml delete mode 100644 devops/inventory/local.yml delete mode 100644 devops/playbook-setup.yml delete mode 100644 devops/requirements/ansible.yml delete mode 100644 devops/requirements/python.txt delete mode 100644 devops/stacks/2022.ploneconf.org.yml delete mode 100644 devops/stacks/default.conf delete mode 100644 devops/stacks/docker-compose-latest.yml delete mode 100644 devops/stacks/docker-compose-local.yml delete mode 100644 devops/stacks/plone.yml create mode 100644 devops/stacks/testing.ploneconf.org.yml create mode 100644 node_modules/.yarn-integrity create mode 100644 yarn.lock diff --git a/devops/.env_local b/devops/.env_local deleted file mode 100644 index 9a1c826..0000000 --- a/devops/.env_local +++ /dev/null @@ -1,12 +0,0 @@ -export DEPLOY_ENV=local -export DEPLOY_HOST=127.0.0.1 -export DEPLOY_PORT=2222 -export DEPLOY_USER=plone -export DOCKER_CONFIG=.docker -export FQDN=ploneconf.localhost -export FQDN_ALTERNATIVE=ploneconf.localhost -export TRAEFIK_FQDN=traefik.localhost -export TRAEFIK_AUTH_USERNAME=admin -export TRAEFIK_AUTH_PASSWORD=admin -export TRAEFIK_EMAIL="conf@plone.org" -export HASHED_PASSWORD="$(openssl passwd -apr1 $TRAEFIK_AUTH_PASSWORD)" diff --git a/devops/.gitignore b/devops/.gitignore deleted file mode 100644 index 5ea2a01..0000000 --- a/devops/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -.docker -.env_prod -.vagrant -.vagrant_private_key -bin -include -inventory/prod.yml -host_vars/ploneconf-prod.yml -lib -lib64 -pyvenv.cfg diff --git a/devops/Makefile b/devops/Makefile deleted file mode 100644 index cf7e229..0000000 --- a/devops/Makefile +++ /dev/null @@ -1,135 +0,0 @@ -### Defensive settings for make: -# https://tech.davis-hansson.com/p/make/ -SHELL:=bash -.ONESHELL: -.SHELLFLAGS:=-xeu -o pipefail -O inherit_errexit -c -.SILENT: -.DELETE_ON_ERROR: -MAKEFLAGS+=--warn-undefined-variables -MAKEFLAGS+=--no-builtin-rules - -ifndef DEPLOY_ENV -$(error DEPLOY_ENV is not set) -endif - -ifndef DEPLOY_USER -$(error DEPLOY_USER is not set) -endif - -ifndef DEPLOY_SCALES - DEPLOY_SCALES=2 -endif - -ifeq ($(DEPLOY_ENV), local) - CONTEXT=local - CONTEXT_HOST=ssh://$(DEPLOY_USER)@$(DEPLOY_HOST):$(DEPLOY_PORT) - DEPLOY_STACK=plone.yml -else ifeq ($(DEPLOY_ENV), prod) - CONTEXT=prod - CONTEXT_HOST=ssh://$(DEPLOY_USER)@$(DEPLOY_HOST):$(DEPLOY_PORT) -else -$(error DEPLOY_ENV is not supported) -endif - -DOCKER=docker -DOCKER_CONTEXT=${DOCKER} --context ${CONTEXT} - -# We like colors -# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects -RED=`tput setaf 1` -GREEN=`tput setaf 2` -RESET=`tput sgr0` -YELLOW=`tput setaf 3` - -# Add the following 'help' target to your Makefile -# And add help text after each target name starting with '\#\#' -.PHONY: help -help: ## This help message - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' - -.PHONY: clean -clean: ## remove all build, test, coverage and Python artifacts - rm -Rf bin lib lib64 include pyvenv.cfg .docker - -bin/pip: - @echo "$(GREEN)==> Setup Virtual Env$(RESET)" - python3 -m venv . - bin/pip install -U pip - -bin/ansible: bin/pip - @echo "$(GREEN)==> Setup Ansible $(RESET)" - bin/pip install -r requirements/python.txt --upgrade - bin/ansible-galaxy install -r requirements/ansible.yml --force - -.PHONY: setup -setup: bin/ansible ## Create VirtualEnv and install Ansible via Pip - -.PHONY: docker-login -docker-login: .docker/config.json ## Login with Docker - @echo "$(GREEN)==> Docker login $(RESET)" - ${DOCKER} login - -.PHONY: docker-setup -docker-setup: ## Setup docker context - ${DOCKER} context create ${CONTEXT} --description "Plone Conference deployment" --docker "host=${CONTEXT_HOST}" - -.PHONY: provision -destroy: ## Provision Vagrant box - if [ "$(DEPLOY_ENV)" = "local" ]; then - @echo "$(GREEN)==> Destroy Vagrant box $(RESET)" - sudo vagrant destroy - sudo rm -Rf .vagrant_private_key .vagrant - fi - -.PHONY: provision -provision: bin/ansible ## Provision Vagrant box - if [ "$(DEPLOY_ENV)" = "local" ]; then - @echo "$(GREEN)==> Provision Vagrant box $(RESET)" - sudo vagrant up - sudo cp .vagrant/machines/default/virtualbox/private_key .vagrant_private_key - USER=`whoami` sudo chown ${USER}: .vagrant_private_key - ssh-keygen -f ~/.ssh/known_hosts -R "[127.0.0.1]:2222" - fi - -.PHONY: run-playbook -run-playbook: bin/ansible ## Run playbook - @echo "$(GREEN)==> Apply playbook in $(DEPLOY_ENV) $(RESET)" - ./bin/ansible-playbook playbook-setup.yml --limit ${CONTEXT} - -.PHONY: deploy -deploy: ## Deploy stacks: Plone - @echo "$(GREEN)==> Deploy Stack in $(DEPLOY_ENV) $(RESET)" - ${DOCKER_CONTEXT} stack deploy -c stacks/$(DEPLOY_STACK) plone - -.PHONY: status -status: ## Check status of stack - @echo "$(GREEN)==> Stack status in $(DEPLOY_ENV) $(RESET)" - ${DOCKER_CONTEXT} stack ps -f "desired-state=running" plone - -.PHONY: logs-webserver -logs-webserver: ## Display webserver logs - @echo "$(GREEN)==> Logs for webserver in $(DEPLOY_ENV) $(RESET)" - ${DOCKER_CONTEXT} service logs plone_traefik - -.PHONY: logs-frontend -logs-frontend: ## Display frontend logs - @echo "$(GREEN)==> Logs for frontend in $(DEPLOY_ENV) $(RESET)" - ${DOCKER_CONTEXT} service logs plone_frontend - -.PHONY: logs-backend -logs-backend: ## Display backend logs - @echo "$(GREEN)==> Logs for backend in $(DEPLOY_ENV) $(RESET)" - ${DOCKER_CONTEXT} service logs plone_backend - -.PHONY: scale-services -scale-services: ## Scale services - @echo "$(GREEN)==> Scaling Frontend and Backend to $(DEPLOY_SCALES) in $(DEPLOY_ENV) $(RESET)" - ${DOCKER_CONTEXT} service scale plone_frontend=$(DEPLOY_SCALES) plone_backend=$(DEPLOY_SCALES) - -.PHONY: all -all: ## Create new box, run ansible, deploy stack - if [ "$(DEPLOY_ENV)" = "local" ]; then - $(MAKE) provision - fi - $(MAKE) run-playbook - $(MAKE) deploy diff --git a/devops/README.md b/devops/README.md deleted file mode 100644 index ec221db..0000000 --- a/devops/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# Plone Conference Devops - -## Setup - -Install Python 3 virtual environment and Ansible - -```shell -cd devops -make clean -make setup -``` - -## Source configuration - -### For Local Deployment (Using Vagrant) - -```shell -source .env_local -``` -### For Production - -Create `.env_prod`, if it does not exist, setting all values defined in `.env_local`, then: - -```shell -source .env_prod -``` - -Also, add a `prod.yml` file to `inventory` folder (with information about the production server), and a `ploneconf-prod.yml` to `host_vars` folder. - -These files can be obtained with the [Plone Foundation AI Team](https://plone.org/community/admin-and-infrastructure). - -## Docker configuration - -As the images used in this deployment are public, just make sure you already are logged in with Docker. - -After that, we need to create a new docker context, to be stored inside this folder. - -```shell -make docker-setup -``` - -## Deploy - -The shortcut is to run all steps at once with: - -```shell -make all -``` - -This command provision a new machine, if running in the local environment, run the playbook and then deploy the stack. -### Provision - -Only valid for local deployments using Vagrant. This creates a new Vagrant box with the configuration according to the `Vagrantfile`. - -```shell -make provision -``` - -### Run playbook - -Setup the server, by installing base packages, creating `UFW` configuration and adding users - -```shell -make run-playbook -``` - -### Deploy stack to the server - -Run `docker stack` to deploy to the server - -```shell -make deploy -``` - -Use this also when there is a new version of any of the images. - -## Check Stack Status - -```shell -make status -``` - -## Check Logs - -|Tool|Command| -|-|-| -|webserver|`make logs-webserver`| -|frontend|`make logs-frontend`| -|backend|`make logs-backend`| diff --git a/devops/Vagrantfile b/devops/Vagrantfile deleted file mode 100644 index 78fe4c4..0000000 --- a/devops/Vagrantfile +++ /dev/null @@ -1,14 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure(2) do |config| - config.vm.box = "ubuntu/focal64" - config.vm.network "forwarded_port", guest: 80, host: 80 - config.vm.network "forwarded_port", guest: 443, host: 443 - config.vm.network "forwarded_port", guest: 3000, host: 3000 - config.vm.network "forwarded_port", guest: 8080, host: 8080 - config.vm.provider "virtualbox" do |vb| - vb.memory = 2048 - vb.cpus = 1 - end - end diff --git a/devops/ansible.cfg b/devops/ansible.cfg deleted file mode 100644 index 55ba44a..0000000 --- a/devops/ansible.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[defaults] -inventory = inventory -retry_files_enabled = False -allow_world_readable_tmpfiles = true -interpreter_python=auto - -[ssh_connection] -pipelining=True -ssh_args = -o ControlMaster=auto -o ControlPersist=3600s -o PreferredAuthentications=publickey diff --git a/devops/group_vars/all/groups.yml b/devops/group_vars/all/groups.yml deleted file mode 100644 index c931e08..0000000 --- a/devops/group_vars/all/groups.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -user_groups: - plone: - description: 'Plone' - state: present diff --git a/devops/group_vars/all/host.yml b/devops/group_vars/all/host.yml deleted file mode 100644 index 46b4f05..0000000 --- a/devops/group_vars/all/host.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -hostname: '2022' -fqdn: '{{ hostname }}.ploneconf.org' \ No newline at end of file diff --git a/devops/group_vars/all/motd.yml b/devops/group_vars/all/motd.yml deleted file mode 100644 index 0c0109e..0000000 --- a/devops/group_vars/all/motd.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -motd_info: - - " FQDN: ": "{{ ansible_fqdn }}" - - " RAM: ": "{{ (ansible_memtotal_mb / 1000) | round(1) }}GB" diff --git a/devops/group_vars/all/swap.yml b/devops/group_vars/all/swap.yml deleted file mode 100644 index b81cd02..0000000 --- a/devops/group_vars/all/swap.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -swap_file_path: /swapfile -swap_file_size_mb: '2048' -swap_swappiness: '60' -swap_file_state: present diff --git a/devops/group_vars/all/ufw.yml b/devops/group_vars/all/ufw.yml deleted file mode 100644 index b30f9b9..0000000 --- a/devops/group_vars/all/ufw.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -ssh_port: 22 -additional_ports: - - 80 - - 443 diff --git a/devops/group_vars/all/users.yml b/devops/group_vars/all/users.yml deleted file mode 100644 index 4aa7cf7..0000000 --- a/devops/group_vars/all/users.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -users: - - 'plone': - name: 'Plone installation' - email: 'conf@plone.org' - public_keys: - - 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDJIwjHxRAM1a8zc1kuTJ0GyzvloaBTz/fO7bGoNOlxY2lnUDop+q3CbHF28IkmVQCk28I+MXCnUXG6ARZgnBcb4LDey9WPVsiy3NRCXOmaZK6NKmKUejdA5Y4ZTHbs6rdIInDLWaFxzoxg5p/LaXUaTrKra2SpGc3kv7xKiZKXyTznFjFSv/u6Wm/vvZopWM6m4k8Z00fTUtxQO0eWKArStF99YFszUDU2w2jhL7n8irLow0UqjNjp0MvkPiic2SueoylQRIlD57XzveMBpGynYdsZWKDa3Czzo5ykHPLYrOByioKKjnpwgruXnXkkN4ov8sK+LqqAXaicxed6ohbOh68IWVB8nssb+RbISmzzpIXUwd1qkAyeiSjt5b9MFcIT56zeRb5B+aWZbYffc+pKy8kAjrYHCWEFl6O3N+M/bI9jgtXcZ9L6FSBN5vWjgRQPn7UwiMXIUssm0lU5AgCxs7q7S0xACj0xVFk5NeUM9vcCzXkY9vAjJmE1hzBWeOVhhQqLKmkbi/scr5hW2rrNwnuPBpyHUu2wTIyGHbnZ9CCwU3u21XDyvvO9ufxDjIH3v2EwEPqpbejKRM8QUH6YuH2goy89yQQijsC0YUE8AlJpbs9ctxSyzsJ6Z3ZwHJA681Ei15omhab2iwmT4KcS+3mC5pSCsFQgA4OsJKy5OQ== ericof@gmail.com' - - 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCk1tYH/sCWfw7HJctBd5or6mV1rB15LohQcq4NAYuF4uUCiEPqowtMvg54rkl2YtVYVlZQhV2RaZXzxE94Hxcd/0bQ5VrwfxQ6xbDhHAoGEIm1mQCMdcgl9s7IWUDqgcC7AXXWa3UDJczjkc/5zrw5s2SbDaiKqdyXs3DqW06UqFpMK3UTSbcdmvAbY9skQCc57+fH8fKvpBuWfO717tIyx9H4tQJSNIhQvXxd2g+zSVSyi1h3etFVGmfHRrsr1xJzoTcnc4qd66qPzVY868cN8ev/f+Ifxlxt2DbxsiNqhwwK6zU0QUe+UAXHUGnH/T4TH+FWkTwSuW9CpNXBn6ad' # Martin Peeters - password: '$6$8TrTq/2twy7u./bS$5gxT7m93.aVJD1P9V0y.EMcCvgH2RV8pM4vVyGFpqx3zEPUvmib7nQtJD6vxJRTMyR9oPRi323tbwpx0wLyWs.' - state: present - shell: '/bin/bash' - groups: - - 'docker' - - 'plone' diff --git a/devops/host_vars/ploneconf-local.yml b/devops/host_vars/ploneconf-local.yml deleted file mode 100644 index fed2962..0000000 --- a/devops/host_vars/ploneconf-local.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -ssh_port: 22 -hostname: '2022-local' -fqdn: '{{ hostname }}.ploneconf.org' -swap_file_size_mb: '512' -additional_ports: - - 80 - - 443 diff --git a/devops/inventory/local.yml b/devops/inventory/local.yml deleted file mode 100644 index 9a83197..0000000 --- a/devops/inventory/local.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -# Local -local: - hosts: - ploneconf-local: - ansible_host: 127.0.0.1 - ansible_ssh_port: 2222 - ansible_user: vagrant - ansible_ssh_private_key_file: ./.vagrant_private_key diff --git a/devops/playbook-setup.yml b/devops/playbook-setup.yml deleted file mode 100644 index 29b076b..0000000 --- a/devops/playbook-setup.yml +++ /dev/null @@ -1,60 +0,0 @@ -- hosts: "all" - gather_facts: True - become: yes - - roles: - - role: tangrama.common - - role: geerlingguy.swap - - role: tangrama.motd - - role: tangrama.ufw - - role: tangrama.users - - tasks: - - - name: Install Docker Python Packages - ansible.builtin.pip: - name: - - docker - state: present - - - name: Prepare project structure - block: - - name: Create main directory - ansible.builtin.file: - dest: /srv/ploneconf/ - state: directory - owner: plone - group: plone - mode: 0750 - - - name: Create data directory - ansible.builtin.file: - dest: /srv/ploneconf/data - state: directory - owner: 999 - group: 999 - mode: 0750 - - - name: Create Swarm structure - block: - - name: Init a new swarm with default parameters - community.docker.docker_swarm: - state: present - - - name: Create a network - community.docker.docker_network: - name: traefik-public - driver: overlay - - - name: Create Traefik folders - ansible.builtin.file: - dest: "{{ item }}" - state: directory - owner: root - group: root - mode: 0755 - with_items: - - /usr/src/traefik/ - - /data/traefik/ - - /data/traefik/certificates - - /data/traefik/config diff --git a/devops/requirements/ansible.yml b/devops/requirements/ansible.yml deleted file mode 100644 index 65779f2..0000000 --- a/devops/requirements/ansible.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -collections: - - name: community.general - version: "3.6.0" - - - name: community.docker - version: "1.9.1" - -roles: - - src: https://github.com/tangrama/tangrama.common.git - name: tangrama.common - version: main - - - src: https://github.com/tangrama/tangrama.ufw.git - name: tangrama.ufw - version: main - - - src: https://github.com/tangrama/tangrama.motd.git - name: tangrama.motd - version: main - - - src: https://github.com/tangrama/tangrama.users.git - name: tangrama.users - version: main - - - name: geerlingguy.swap - version: 1.0.2 diff --git a/devops/requirements/python.txt b/devops/requirements/python.txt deleted file mode 100644 index c26ac75..0000000 --- a/devops/requirements/python.txt +++ /dev/null @@ -1,2 +0,0 @@ -wheel -ansible diff --git a/devops/stacks/2022.ploneconf.org.yml b/devops/stacks/2022.ploneconf.org.yml deleted file mode 100644 index 7633146..0000000 --- a/devops/stacks/2022.ploneconf.org.yml +++ /dev/null @@ -1,144 +0,0 @@ -version: '3.3' - -services: - traefik: - image: traefik:v2.6 - - ports: - - 80:80 - - 443:443 - - deploy: - labels: - - traefik.enable=true - - traefik.docker.network=traefik-public - - traefik.constraint-label=traefik-public - - traefik.http.middlewares.admin-auth.basicauth.users=admin:$$apr1$Jv7k2JvK$uNmYFBXyov5NYPm/SzB09/ - - traefik.http.routers.traefik-public-https.rule=Host(`traefik.ploneconf.org`) - - traefik.http.routers.traefik-public-https.entrypoints=https - - traefik.http.routers.traefik-public-https.tls=true - - traefik.http.routers.traefik-public-https.service=api@internal - - traefik.http.routers.traefik-public-https.middlewares=admin-auth - - traefik.http.services.traefik-public.loadbalancer.server.port=8000 - - # GENERIC MIDDLEWARES - - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https - - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true - - traefik.http.middlewares.gzip.compress=true - - traefik.http.middlewares.gzip.compress.excludedcontenttypes=image/png, image/jpeg, font/woff2 - - # GENERIC ROUTERS - - traefik.http.routers.generic-https-redirect.entrypoints=http - - traefik.http.routers.generic-https-redirect.rule=HostRegexp(`{host:.*}`) - - traefik.http.routers.generic-https-redirect.priority=1 - - traefik.http.routers.generic-https-redirect.middlewares=https-redirect - - volumes: - - /var/run/docker.sock:/var/run/docker.sock:ro - - traefik-public-certificates:/certificates - - traefik-config:/config - - command: - - --providers.docker - - --providers.docker.constraints=Label(`traefik.constraint-label`, `traefik-public`) - - --providers.docker.exposedbydefault=false - - --providers.docker.swarmmode - - --entrypoints.http.address=:80 - - --entrypoints.https.address=:443 - - --certificatesresolvers.le.acme.email=admins@plone.org - - --certificatesresolvers.le.acme.storage=/certificates/acme.json - - --certificatesresolvers.le.acme.tlschallenge=true - - --providers.file.filename=/config/traefik_config.yaml - - --accesslog - - --log - - --api - - networks: - - traefik-public - - frontend: - image: plone/ploneconf-frontend:2022 - environment: - RAZZLE_INTERNAL_API_PATH: http://backend:8080/Plone - ports: - - "3000:3000" - depends_on: - - backend - networks: - - traefik-public - - backend - deploy: - replicas: 2 - labels: - - traefik.enable=true - - traefik.docker.network=traefik-public - - traefik.constraint-label=traefik-public - # SERVICE - - traefik.http.services.plone-frontend.loadbalancer.server.port=3000 - # HOSTS: Main - - traefik.http.routers.frontend.rule=Host(`2022.ploneconf.org`) - - traefik.http.routers.frontend.entrypoints=https - - traefik.http.routers.frontend.tls=true - - traefik.http.routers.frontend.tls.certresolver=le - - traefik.http.routers.frontend.service=plone-frontend - - traefik.http.routers.frontend.middlewares=gzip - - backend: - image: plone/ploneconf-backend:2022 - environment: - RELSTORAGE_DSN: "dbname='plone' user='plone' host='db' password='plone'" - depends_on: - - db - networks: - - traefik-public - - backend - deploy: - replicas: 2 - labels: - - traefik.enable=true - - traefik.docker.network=traefik-public - - traefik.constraint-label=traefik-public - # SERVICE - - traefik.http.services.plone-backend.loadbalancer.server.port=8080 - # Plone API - - traefik.http.routers.backend.rule=Host(`2022.ploneconf.org`) && (PathPrefix(`/++api++`)) - - traefik.http.routers.backend.entrypoints=https - - traefik.http.routers.backend.tls=true - - traefik.http.routers.backend.service=plone-backend - - traefik.http.middlewares.backend.addprefix.prefix=/VirtualHostBase/https/2022.ploneconf.org/Plone/++api++/VirtualHostRoot - - traefik.http.routers.backend.middlewares=gzip, backend - - db: - image: postgres:14.2 - environment: - POSTGRES_USER: plone - POSTGRES_PASSWORD: plone - POSTGRES_DB: plone - volumes: - - site-data:/var/lib/postgresql/data - networks: - - backend - -volumes: - traefik-public-certificates: - driver_opts: - type: none - device: /data/traefik/certificates - o: bind - traefik-config: - driver_opts: - type: none - device: /data/traefik/config - o: bind - site-data: - driver_opts: - type: none - device: /srv/ploneconf/data - o: bind - -networks: - traefik-public: - external: true - driver: overlay - backend: - driver: overlay diff --git a/devops/stacks/default.conf b/devops/stacks/default.conf deleted file mode 100644 index 1886613..0000000 --- a/devops/stacks/default.conf +++ /dev/null @@ -1,42 +0,0 @@ -upstream backend { - server backend:8080; -} -upstream frontend { - server frontend:3000; -} - -server { - listen 80 default_server; - server_name ploneconf.localhost; - - location ~ /\+\+api\+\+($|/.*) { - rewrite \+\+api\+\+\/?($|/.*) /VirtualHostBase/http/$server_name/Plone/++api++/VirtualHostRoot/$1 break; - proxy_pass http://backend; - } - - location ~ / { - location ~* \.(js|jsx|css|less|swf|eot|ttf|otf|woff|woff2)$ { - add_header Cache-Control "public"; - expires +1y; - proxy_pass http://frontend; - } - location ~* static.*\.(ico|jpg|jpeg|png|gif|svg)$ { - add_header Cache-Control "public"; - expires +1y; - proxy_pass http://frontend; - } - - location ~ /(@@download|@@images|@@ical_view) { - rewrite ^(.*) /VirtualHostBase/http/$server_name/Plone/VirtualHostRoot$1 break; - proxy_pass http://backend; - break; - } - - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_redirect http:// https://; - proxy_pass http://frontend; - } -} \ No newline at end of file diff --git a/devops/stacks/docker-compose-latest.yml b/devops/stacks/docker-compose-latest.yml deleted file mode 100644 index f9433f5..0000000 --- a/devops/stacks/docker-compose-latest.yml +++ /dev/null @@ -1,42 +0,0 @@ -version: "3" -services: - - webserver: - image: nginx - volumes: - - ./default.conf:/etc/nginx/conf.d/default.conf - depends_on: - - backend - - frontend - ports: - - "80:80" - - frontend: - image: plone/ploneconf-frontend:2022 - environment: - RAZZLE_INTERNAL_API_PATH: http://backend:8080/Plone - ports: - - "3000:3000" - depends_on: - - backend - - backend: - image: plone/ploneconf-backend:2022 - environment: - SITE: Plone - ADDITIONAL_PROFILES: "ploneconf.core:default,ploneconf.core:initial" - RELSTORAGE_DSN: "dbname='plone' user='plone' host='db' password='plone'" - depends_on: - - db - - db: - image: postgres - environment: - POSTGRES_USER: plone - POSTGRES_PASSWORD: plone - POSTGRES_DB: plone - volumes: - - data:/var/lib/postgresql/data - -volumes: - data: {} \ No newline at end of file diff --git a/devops/stacks/docker-compose-local.yml b/devops/stacks/docker-compose-local.yml deleted file mode 100644 index 2dbf0e3..0000000 --- a/devops/stacks/docker-compose-local.yml +++ /dev/null @@ -1,44 +0,0 @@ -version: "3" -services: - - webserver: - image: nginx - volumes: - - ./default.conf:/etc/nginx/conf.d/default.conf - depends_on: - - backend - - frontend - ports: - - "80:80" - - frontend: - build: - context: ../../frontend - environment: - RAZZLE_INTERNAL_API_PATH: http://backend:8080/Plone - ports: - - "3000:3000" - depends_on: - - backend - - backend: - build: - context: ../../backend - environment: - SITE: Plone - ADDITIONAL_PROFILES: "ploneconf.core:default,ploneconf.core:initial" - RELSTORAGE_DSN: "dbname='plone' user='plone' host='db' password='plone'" - depends_on: - - db - - db: - image: postgres - environment: - POSTGRES_USER: plone - POSTGRES_PASSWORD: plone - POSTGRES_DB: plone - volumes: - - data:/var/lib/postgresql/data - -volumes: - data: {} diff --git a/devops/stacks/plone.yml b/devops/stacks/plone.yml deleted file mode 100644 index 2cc6597..0000000 --- a/devops/stacks/plone.yml +++ /dev/null @@ -1,159 +0,0 @@ -version: '3.3' - -services: - traefik: - image: traefik:v2.6 - - ports: - - 80:80 - - 443:443 - - deploy: - labels: - - traefik.enable=true - - traefik.docker.network=traefik-public - - traefik.constraint-label=traefik-public - - traefik.http.middlewares.admin-auth.basicauth.users=${TRAEFIK_AUTH_USERNAME?Variable not set}:${HASHED_PASSWORD?Variable not set} - - traefik.http.routers.traefik-public-https.rule=Host(`${TRAEFIK_FQDN?Variable TRAEFIK_FQDN not set}`) - - traefik.http.routers.traefik-public-https.entrypoints=https - - traefik.http.routers.traefik-public-https.tls=true - - traefik.http.routers.traefik-public-https.service=api@internal - - traefik.http.routers.traefik-public-https.middlewares=admin-auth - - traefik.http.services.traefik-public.loadbalancer.server.port=8000 - - # GENERIC MIDDLEWARES - - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https - - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true - - traefik.http.middlewares.gzip.compress=true - - traefik.http.middlewares.gzip.compress.excludedcontenttypes=image/png, image/jpeg, font/woff2 - - # GENERIC ROUTERS - - traefik.http.routers.generic-https-redirect.entrypoints=http - - traefik.http.routers.generic-https-redirect.rule=HostRegexp(`{host:.*}`) - - traefik.http.routers.generic-https-redirect.priority=1 - - traefik.http.routers.generic-https-redirect.middlewares=https-redirect - - volumes: - - /var/run/docker.sock:/var/run/docker.sock:ro - - traefik-public-certificates:/certificates - - traefik-config:/config - - command: - - --providers.docker - - --providers.docker.constraints=Label(`traefik.constraint-label`, `traefik-public`) - - --providers.docker.exposedbydefault=false - - --providers.docker.swarmmode - - --entrypoints.http.address=:80 - - --entrypoints.https.address=:443 - - --certificatesresolvers.le.acme.email=${TRAEFIK_EMAIL?Variable TRAEFIK_EMAIL not set} - - --certificatesresolvers.le.acme.storage=/certificates/acme.json - - --certificatesresolvers.le.acme.tlschallenge=true - - --providers.file.filename=/config/traefik_config.yaml - - --accesslog - - --log - - --api - - networks: - - traefik-public - - frontend: - image: plone/ploneconf-frontend:2022 - environment: - RAZZLE_INTERNAL_API_PATH: http://backend:8080/Plone - ports: - - "3000:3000" - depends_on: - - backend - networks: - - traefik-public - - backend - deploy: - replicas: 2 - labels: - - traefik.enable=true - - traefik.docker.network=traefik-public - - traefik.constraint-label=traefik-public - # SERVICE - - traefik.http.services.plone-frontend.loadbalancer.server.port=3000 - # HOSTS: Main - - traefik.http.routers.frontend.rule=Host(`${FQDN?Unset}`) - - traefik.http.routers.frontend.entrypoints=https - - traefik.http.routers.frontend.tls=true - - traefik.http.routers.frontend.tls.certresolver=le - - traefik.http.routers.frontend.service=plone-frontend - - traefik.http.routers.frontend.middlewares=gzip - # HOSTS: Alternative - - traefik.http.routers.frontend_alternative.rule=Host(`${FQDN_ALTERNATIVE?Unset}`) - - traefik.http.routers.frontend_alternative.entrypoints=https - - traefik.http.routers.frontend_alternative.tls=true - - traefik.http.routers.frontend_alternative.tls.certresolver=le - - traefik.http.routers.frontend_alternative.service=plone-frontend - - traefik.http.routers.frontend_alternative.middlewares=gzip - - backend: - image: plone/ploneconf-backend:2022 - environment: - RELSTORAGE_DSN: "dbname='plone' user='plone' host='db' password='plone'" - depends_on: - - db - networks: - - traefik-public - - backend - deploy: - replicas: 2 - labels: - - traefik.enable=true - - traefik.docker.network=traefik-public - - traefik.constraint-label=traefik-public - # SERVICE - - traefik.http.services.plone-backend.loadbalancer.server.port=8080 - # Plone API - - traefik.http.routers.backend.rule=Host(`${FQDN?Unset}`) && (PathPrefix(`/++api++`) || PathPrefix(`/{traversal:.+}/@@images`) || PathPrefix(`/{traversal:.+}/@@download`)) - - traefik.http.routers.backend.entrypoints=https - - traefik.http.routers.backend.tls=true - - traefik.http.routers.backend.service=plone-backend - - traefik.http.middlewares.backend.addprefix.prefix=/VirtualHostBase/https/${FQDN?Unset}/Plone/++api++/VirtualHostRoot - - traefik.http.routers.backend.middlewares=gzip, backend - # Plone API Alternative - - traefik.http.routers.backend_alternative.rule=Host(`${FQDN_ALTERNATIVE?Unset}`) && (PathPrefix(`/++api++`) || PathPrefix(`/{traversal:.+}/@@images`) || PathPrefix(`/{traversal:.+}/@@download`)) - - traefik.http.routers.backend_alternative.entrypoints=https - - traefik.http.routers.backend_alternative.tls=true - - traefik.http.routers.backend_alternative.tls.certresolver=le - - traefik.http.routers.backend_alternative.service=plone-backend - - traefik.http.middlewares.backend_alternative.addprefix.prefix=/VirtualHostBase/https/${FQDN_ALTERNATIVE?Unset}/Plone/++api++/VirtualHostRoot - - traefik.http.routers.backend_alternative.middlewares=gzip, backend_alternative - - db: - image: postgres:14.2 - environment: - POSTGRES_USER: plone - POSTGRES_PASSWORD: plone - POSTGRES_DB: plone - volumes: - - site-data:/var/lib/postgresql/data - networks: - - backend - -volumes: - traefik-public-certificates: - driver_opts: - type: none - device: /data/traefik/certificates - o: bind - traefik-config: - driver_opts: - type: none - device: /data/traefik/config - o: bind - site-data: - driver_opts: - type: none - device: /srv/ploneconf/data - o: bind - -networks: - traefik-public: - external: true - driver: overlay - backend: - driver: overlay diff --git a/devops/stacks/testing.ploneconf.org.yml b/devops/stacks/testing.ploneconf.org.yml new file mode 100644 index 0000000..144bf27 --- /dev/null +++ b/devops/stacks/testing.ploneconf.org.yml @@ -0,0 +1,73 @@ +version: '3.3' + +services: + + frontend: + image: plone/ploneconf-frontend:2023 + environment: + RAZZLE_INTERNAL_API_PATH: http://backend:8080/Plone + ports: + - "3000:3000" + depends_on: + - backend + networks: + - public + - testing_ploneconf + deploy: + replicas: 2 + labels: + - traefik.enable=true + - traefik.docker.network=public + - traefik.constraint-label=public + # SERVICE + - traefik.http.services.testing_ploneconf-frontend.loadbalancer.server.port=3000 + # HOSTS: Main + - traefik.http.routers.testing_ploneconf-frontend.rule=Host(`testing.ploneconf.org`) + - traefik.http.routers.testing_ploneconf-frontend.entrypoints=https + - traefik.http.routers.testing_ploneconf-frontend.tls=true + - traefik.http.routers.testing_ploneconf-frontend.tls.certresolver=le + - traefik.http.routers.testing_ploneconf-frontend.service=testing_ploneconf-frontend + - traefik.http.routers.testing_ploneconf-frontend.middlewares=gzip + + backend: + image: plone/ploneconf-backend:2023 + environment: + RELSTORAGE_DSN: "dbname='${DB_NAME:-plone}' user='${DB_USER:-plone}' host='${DB_HOST:-db}' password='${DB_PASSWORD:-plone}'" + networks: + - testing_ploneconf + deploy: + replicas: 2 + labels: + - traefik.enable=true + - traefik.docker.network=public + - traefik.constraint-label=public + # SERVICE + - traefik.http.services.testing_ploneconf-backend.loadbalancer.server.port=8080 + # MIDDLEWARES + ### ClassicUI Access Authentication + - traefik.http.middlewares.testing_ploneconf-backend-auth.basicauth.users=ploneconf:$$2y$$05$$OcevCKwZYZeq3svCxoUpKOnuC1NAIe5Ey23ZLVrARBbOQMOJr4nyG + ### Frontend +api_ VHM + - "traefik.http.middlewares.testing_ploneconf-vhm.replacepathregex.regex=^/\\+\\+api\\+\\+($$|/.*)" + - "traefik.http.middlewares.testing_ploneconf=vhm.replacepathregex.replacement=/VirtualHostBase/https/testing.plone.org/Plone/++api++/VirtualHostRoot/$$1" + ### Frontend ClassicUI VHM + - "traefik.http.middlewares.testing_ploneconf-vhm-classicui.replacepathregex.regex=^/ClassicUI($$|/.*)" + - "traefik.http.middlewares.testing_ploneconf-vhm-classicui.replacepathregex.replacement=/VirtualHostBase/https/testing.plone.org/Plone/VirtualHostRoot/_vh_ClassicUI/$$1" + # ROUTES + ## PloneCONF API + - traefik.http.routers.testing_ploneconf-backend.rule=Host(`testing.ploneconf.org`) && (PathPrefix(`/++api++`)) + - traefik.http.routers.testing_ploneconf-backend.entrypoints=https + - traefik.http.routers.testing_ploneconf-backend.tls=true + - traefik.http.routers.testing_ploneconf-backend.service=testing_ploneconf-backend + - traefik.http.routers.testing_ploneconf-backend.middlewares=gzip, testing_ploneconf-vhm + ### ploneconf.org /ClassicUI - protected with basic auth (prevent SEOs from crawl it) + - traefik.http.routers.testing_ploneconf-classicui.rule=Host(`testing.ploneconf.org`) && (PathPrefix(`/ClassicUI`)) + - traefik.http.routers.testing_ploneconf-classicui.entrypoints=https + - traefik.http.routers.testing_ploneconf-classicui.tls=true + - traefik.http.routers.testing_ploneconf-classicui.service=ploneconf_testing-backend + - traefik.http.routers.testing_ploneconf-classicui.middlewares=gzip,testing_ploneconf-backend-auth,testing_ploneconf-vhm-classicui +networks: + public: + external: true + driver: overlay + testing_ploneconf: + driver: overlay diff --git a/node_modules/.yarn-integrity b/node_modules/.yarn-integrity new file mode 100644 index 0000000..9937b9e --- /dev/null +++ b/node_modules/.yarn-integrity @@ -0,0 +1,10 @@ +{ + "systemParams": "darwin-arm64-93", + "modulesFolders": [], + "flags": [], + "linkedModules": [], + "topLevelPatterns": [], + "lockfileEntries": {}, + "files": [], + "artifacts": {} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..fb57ccd --- /dev/null +++ b/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + From 201c2bffe77eeafc38060e76eddf12a645c838cf Mon Sep 17 00:00:00 2001 From: Fred van Dijk Date: Thu, 16 Feb 2023 14:04:00 +0100 Subject: [PATCH 02/10] cleanup & fixes reorder service, middleware, routes --- devops/stacks/testing.ploneconf.org.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/devops/stacks/testing.ploneconf.org.yml b/devops/stacks/testing.ploneconf.org.yml index 144bf27..5334ce4 100644 --- a/devops/stacks/testing.ploneconf.org.yml +++ b/devops/stacks/testing.ploneconf.org.yml @@ -35,25 +35,25 @@ services: RELSTORAGE_DSN: "dbname='${DB_NAME:-plone}' user='${DB_USER:-plone}' host='${DB_HOST:-db}' password='${DB_PASSWORD:-plone}'" networks: - testing_ploneconf + - public deploy: replicas: 2 labels: - traefik.enable=true - - traefik.docker.network=public - - traefik.constraint-label=public + - traefik.docker.network=testing_ploneconf # SERVICE - traefik.http.services.testing_ploneconf-backend.loadbalancer.server.port=8080 # MIDDLEWARES ### ClassicUI Access Authentication - traefik.http.middlewares.testing_ploneconf-backend-auth.basicauth.users=ploneconf:$$2y$$05$$OcevCKwZYZeq3svCxoUpKOnuC1NAIe5Ey23ZLVrARBbOQMOJr4nyG - ### Frontend +api_ VHM + ### Frontend ++api++ VHM - "traefik.http.middlewares.testing_ploneconf-vhm.replacepathregex.regex=^/\\+\\+api\\+\\+($$|/.*)" - "traefik.http.middlewares.testing_ploneconf=vhm.replacepathregex.replacement=/VirtualHostBase/https/testing.plone.org/Plone/++api++/VirtualHostRoot/$$1" ### Frontend ClassicUI VHM - "traefik.http.middlewares.testing_ploneconf-vhm-classicui.replacepathregex.regex=^/ClassicUI($$|/.*)" - "traefik.http.middlewares.testing_ploneconf-vhm-classicui.replacepathregex.replacement=/VirtualHostBase/https/testing.plone.org/Plone/VirtualHostRoot/_vh_ClassicUI/$$1" # ROUTES - ## PloneCONF API + ## ploneconf.org API - traefik.http.routers.testing_ploneconf-backend.rule=Host(`testing.ploneconf.org`) && (PathPrefix(`/++api++`)) - traefik.http.routers.testing_ploneconf-backend.entrypoints=https - traefik.http.routers.testing_ploneconf-backend.tls=true From f26ba0ffa100c2b97b9269d69993f5400cb01ec7 Mon Sep 17 00:00:00 2001 From: Fred van Dijk Date: Thu, 16 Feb 2023 15:23:09 +0100 Subject: [PATCH 03/10] Update workflow for backend_testing deploy --- .github/workflows/backend_testing.yml | 153 ++++++++++++++++++++++++++ .github/workflows/deploy.yml | 40 ------- 2 files changed, 153 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/backend_testing.yml delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/backend_testing.yml b/.github/workflows/backend_testing.yml new file mode 100644 index 0000000..9dee736 --- /dev/null +++ b/.github/workflows/backend_testing.yml @@ -0,0 +1,153 @@ +name: Backend CI + +on: + push: + paths: + - "backend/**" + - ".github/workflows/backend_testing.yml" + workflow_dispatch: + +jobs: + + black: + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v3 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + base_dir: 'backend' + check: 'black' + + flake8: + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v3 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + base_dir: 'backend' + check: 'flake8' + + isort: + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v3 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + base_dir: 'backend' + check: 'isort' + + zpretty: + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v3 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + base_dir: 'backend' + check: 'zpretty' + + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python: + - 3.11 + plone: + - "6.0.1" + + defaults: + run: + working-directory: ./backend + + steps: + - uses: actions/checkout@v3 + + - name: Setup Plone ${{ matrix.plone }} with Python ${{ matrix.python }} + uses: plone/setup-plone@v2.0.0 + with: + python-version: ${{ matrix.python }} + plone-version: ${{ matrix.plone }} + + - name: Install package + run: | + pip install mxdev + mxdev -c mx.ini + pip install -r requirements-mxdev.txt + + - name: Run tests + run: | + pytest + + release: + runs-on: ubuntu-latest + needs: [black, flake8, isort, zpretty, tests] + + steps: + + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/plone/ploneconf-backend + tags: | + type=sha + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GHCR + uses: docker/login-action@v2.1.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64 + context: backend + file: backend/Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + + deploy: + if: ${{ github.ref == 'refs/heads/main' }} + needs: + - release + runs-on: ubuntu-latest + environment: ploneconf2023testing + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Deploy to plone.org + uses: kitconcept/docker-stack-deploy@v2.0.0 + with: + registry: "ghcr.io" + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + remote_host: ${{ secrets.DEPLOY_HOST }} + remote_port: ${{ secrets.DEPLOY_PORT }} + remote_user: ${{ secrets.DEPLOY_USER }} + remote_private_key: ${{ secrets.DEPLOY_SSH }} + stack_file: "devops/stacks/testing.ploneconf.org.yml" + stack_name: "ploneconftesting" + env_file: ${{ secrets.ENV_FILE }} + deploy_timeout: 480 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 9f75912..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Deploy 2022.ploneconf.org - -on: - workflow_run: - workflows: [Acceptance Tests] - types: - - completed - branches: - - "2022" - -jobs: - - deploy: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - environment: ploneconf.org - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Deploy to 2022.ploneconf.org - uses: kitconcept/docker-stack-deploy@v1.0.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - remote_host: ${{ secrets.DEPLOY_HOST }} - remote_port: ${{ secrets.DEPLOY_PORT }} - remote_user: ${{ secrets.DEPLOY_USER }} - remote_private_key: ${{ secrets.DEPLOY_SSH }} - stack_file: "devops/stacks/2022.ploneconf.org.yml" - stack_name: "plone" - deploy_timeout: 480 - - report-skipped: - if: ${{ github.event.workflow_run.conclusion != 'success' }} - runs-on: ubuntu-latest - steps: - - name: Report the reason for skipping a deploy - run: echo "$GITHUB_CONTEXT" From 501913b939532bd79968e5ce6a3844c4efa24480 Mon Sep 17 00:00:00 2001 From: Fred van Dijk Date: Thu, 16 Feb 2023 15:31:05 +0100 Subject: [PATCH 04/10] Update workflow to deploy testing.ploneconf.org --- .github/workflows/backend.yml | 146 --------------------- .github/workflows/backend_testing.yml | 10 +- .github/workflows/frontend-testing.yml | 163 ++++++++++++++++++++++++ .github/workflows/frontend.yml | 134 ------------------- devops/stacks/testing.ploneconf.org.yml | 4 +- 5 files changed, 170 insertions(+), 287 deletions(-) delete mode 100644 .github/workflows/backend.yml create mode 100644 .github/workflows/frontend-testing.yml delete mode 100644 .github/workflows/frontend.yml diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml deleted file mode 100644 index 5d65e4d..0000000 --- a/.github/workflows/backend.yml +++ /dev/null @@ -1,146 +0,0 @@ -name: Backend CI - -on: - push: - paths: - - "backend/**" - - -jobs: - - black: - runs-on: ubuntu-latest - steps: - - name: Checkout codebase - uses: actions/checkout@v2 - - - name: Run check - uses: plone/code-analysis-action@v1 - with: - base_dir: 'backend' - check: 'black' - path: | - src/ploneconf.core/src - src/ploneconf.core/setup.py - scripts - - flake8: - runs-on: ubuntu-latest - steps: - - name: Checkout codebase - uses: actions/checkout@v2 - - - name: Run check - uses: plone/code-analysis-action@v1 - with: - base_dir: 'backend' - check: 'flake8' - path: | - src/ploneconf.core/src - src/ploneconf.core/setup.py - scripts - - isort: - runs-on: ubuntu-latest - steps: - - name: Checkout codebase - uses: actions/checkout@v2 - - - name: Run check - uses: plone/code-analysis-action@v1 - with: - base_dir: 'backend' - check: 'isort' - path: | - src/ploneconf.core/src - src/ploneconf.core/setup.py - scripts - - zpretty: - runs-on: ubuntu-latest - steps: - - name: Checkout codebase - uses: actions/checkout@v2 - - - name: Run check - uses: plone/code-analysis-action@v1 - with: - base_dir: 'backend' - check: 'zpretty' - path: src/ploneconf.core/src - - tests: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python: - - 3.9 - plone: - - "6.0.0b1" - - defaults: - run: - working-directory: ./backend - - steps: - - uses: actions/checkout@v2 - - - name: Setup Plone ${{ matrix.plone }} with Python ${{ matrix.python }} - uses: plone/setup-plone@v1.0.0 - with: - python-version: ${{ matrix.python }} - plone-version: ${{ matrix.plone }} - - - name: Install package - run: | - pip install "plone.app.testing" -c https://dist.plone.org/release/${{ matrix.plone }}/constraints.txt - pip install -e "src/ploneconf.core[test]" - - - name: Run tests - run: | - PYTHONWARNINGS=ignore zope-testrunner --auto-color --auto-progress --test-path src/ploneconf.core/src/ - - release: - runs-on: ubuntu-latest - needs: [black, flake8, isort, zpretty, tests] - - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - images: | - plone/ploneconf-backend - labels: | - org.label-schema.docker.cmd=docker run -d -p 8080:8080 plone/ploneconf-backend:latest - tags: | - type=ref,event=branch - type=sha - type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v2 - with: - platforms: linux/amd64 - context: backend - file: backend/Dockerfile - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/backend_testing.yml b/.github/workflows/backend_testing.yml index 9dee736..73be7bd 100644 --- a/.github/workflows/backend_testing.yml +++ b/.github/workflows/backend_testing.yml @@ -1,11 +1,11 @@ name: Backend CI on: - push: - paths: - - "backend/**" - - ".github/workflows/backend_testing.yml" workflow_dispatch: +# push: +# paths: +# - "backend/**" +# - ".github/workflows/backend_testing.yml" jobs: @@ -104,7 +104,7 @@ jobs: uses: docker/metadata-action@v4 with: images: | - ghcr.io/plone/ploneconf-backend + ghcr.io/plone/ploneconf-backend-2023 tags: | type=sha diff --git a/.github/workflows/frontend-testing.yml b/.github/workflows/frontend-testing.yml new file mode 100644 index 0000000..2b89da5 --- /dev/null +++ b/.github/workflows/frontend-testing.yml @@ -0,0 +1,163 @@ +name: Frontend CI + +on: + workflow_dispatch: +# push: +# paths: +# - "frontend/**" +# - ".github/workflows/frontend_testing.yml" + + +env: + node-version: 16.x + +jobs: + + eslint: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./frontend + steps: + - name: Checkout codebase + uses: actions/checkout@v3 + + - name: Use Node.js ${{ env.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ env.node-version }} + cache: 'yarn' + cache-dependency-path: 'frontend/yarn.lock' + + - name: Install packages + run: make install + + - name: Lint + run: yarn run lint:ci + + prettier: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./frontend + steps: + - name: Checkout codebase + uses: actions/checkout@v3 + + - name: Run Prettier + run: npx prettier@2.0.5 --single-quote --check 'src/**/*.{js,jsx,ts,tsx,css,scss}' --config=package.json + + i18n: + name: i18n sync + runs-on: ubuntu-latest + defaults: + run: + working-directory: frontend + + steps: + - name: Checkout codebase + uses: actions/checkout@v3 + + - name: Use Node.js ${{ env.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ env.node-version }} + cache: 'yarn' + cache-dependency-path: 'frontend/yarn.lock' + + - name: Install packages + run: make install + + - name: Test i18n sync + run: make i18n-ci + + unit: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./frontend + steps: + - name: Checkout codebase + uses: actions/checkout@v3 + + - name: Use Node.js ${{ env.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ env.node-version }} + cache: 'yarn' + cache-dependency-path: 'frontend/yarn.lock' + + - name: Install packages + run: make install + + - name: Test + run: make test + + release: + runs-on: ubuntu-latest + needs: [eslint, prettier, i18n, unit] + + steps: + + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/plone/ploneconf-frontend-2023 + tags: | + type=ref,event=branch + type=sha + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64 + context: frontend/ + file: frontend/Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: $${{ steps.meta.outputs.labels }} + + + deploy: + if: ${{ github.ref == 'refs/heads/main' }} + needs: + - release + runs-on: ubuntu-latest + environment: staging + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Deploy to testing.ploneconf.org + uses: kitconcept/docker-stack-deploy@v1.2.0 + with: + registry: "ghcr.io" + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + remote_host: ${{ secrets.DEPLOY_HOST }} + remote_port: ${{ secrets.DEPLOY_PORT }} + remote_user: ${{ secrets.DEPLOY_USER }} + remote_private_key: ${{ secrets.DEPLOY_SSH }} + stack_file: "devops/stacks/plone.org.yml" + stack_name: "ploneorg" + env_file: ${{ secrets.ENV_FILE }} + deploy_timeout: 480 diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml deleted file mode 100644 index 712d2ed..0000000 --- a/.github/workflows/frontend.yml +++ /dev/null @@ -1,134 +0,0 @@ -name: Frontend CI - -on: - push: - paths: - - "frontend/**" - -env: - node-version: 16.x - -jobs: - - eslint: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./frontend - steps: - - name: Checkout codebase - uses: actions/checkout@v2 - - - name: Use Node.js ${{ env.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ env.node-version }} - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v1 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install packages - run: yarn install --frozen-lockfile - - - name: Lint - run: yarn run lint:ci - - - name: i18n - run: yarn run i18n:ci - - prettier: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./frontend - steps: - - name: Checkout codebase - uses: actions/checkout@v2 - - - name: Run Prettier - run: npx prettier@2.0.5 --single-quote --check 'src/**/*.{js,jsx,ts,tsx,css,scss}' --config=package.json - - tests: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./frontend - steps: - - name: Checkout codebase - uses: actions/checkout@v2 - - - name: Use Node.js ${{ env.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ env.node-version }} - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v1 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install packages - run: yarn install --frozen-lockfile - - - name: Test - run: yarn run test:ci - - release: - runs-on: ubuntu-latest - needs: [eslint, prettier, tests] - - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - images: | - plone/ploneconf-frontend - labels: | - org.label-schema.docker.cmd=docker run -d -p 3000:3000 plone/ploneconf-frontend:latest - tags: | - type=ref,event=branch - type=sha - type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v2 - with: - platforms: linux/amd64 - context: frontend/ - file: frontend/Dockerfile - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/devops/stacks/testing.ploneconf.org.yml b/devops/stacks/testing.ploneconf.org.yml index 5334ce4..1c165ed 100644 --- a/devops/stacks/testing.ploneconf.org.yml +++ b/devops/stacks/testing.ploneconf.org.yml @@ -3,7 +3,7 @@ version: '3.3' services: frontend: - image: plone/ploneconf-frontend:2023 + image: plone/ploneconf-frontend-2023 environment: RAZZLE_INTERNAL_API_PATH: http://backend:8080/Plone ports: @@ -30,7 +30,7 @@ services: - traefik.http.routers.testing_ploneconf-frontend.middlewares=gzip backend: - image: plone/ploneconf-backend:2023 + image: plone/ploneconf-backend-2023:latest environment: RELSTORAGE_DSN: "dbname='${DB_NAME:-plone}' user='${DB_USER:-plone}' host='${DB_HOST:-db}' password='${DB_PASSWORD:-plone}'" networks: From f44adce871c718bf7968c0eb85af16612f79fb0c Mon Sep 17 00:00:00 2001 From: Fred van Dijk Date: Thu, 16 Feb 2023 15:34:57 +0100 Subject: [PATCH 05/10] Update names --- .github/workflows/backend_testing.yml | 2 +- .github/workflows/frontend-testing.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backend_testing.yml b/.github/workflows/backend_testing.yml index 73be7bd..a24fd2a 100644 --- a/.github/workflows/backend_testing.yml +++ b/.github/workflows/backend_testing.yml @@ -1,4 +1,4 @@ -name: Backend CI +name: name: Deploy backend testing.ploneconf.org on: workflow_dispatch: diff --git a/.github/workflows/frontend-testing.yml b/.github/workflows/frontend-testing.yml index 2b89da5..08614bd 100644 --- a/.github/workflows/frontend-testing.yml +++ b/.github/workflows/frontend-testing.yml @@ -1,4 +1,5 @@ -name: Frontend CI +name: name: Deploy frontend testing.ploneconf.org + on: workflow_dispatch: From e09320b80a8f9c95085efc2313a6bf378b362b32 Mon Sep 17 00:00:00 2001 From: Fred van Dijk Date: Thu, 16 Feb 2023 15:37:12 +0100 Subject: [PATCH 06/10] shorter names --- .github/workflows/backend_testing.yml | 4 ++-- .github/workflows/frontend-testing.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/backend_testing.yml b/.github/workflows/backend_testing.yml index a24fd2a..24d6a37 100644 --- a/.github/workflows/backend_testing.yml +++ b/.github/workflows/backend_testing.yml @@ -1,5 +1,5 @@ -name: name: Deploy backend testing.ploneconf.org - +name: Deploy backend testing +run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} on: workflow_dispatch: # push: diff --git a/.github/workflows/frontend-testing.yml b/.github/workflows/frontend-testing.yml index 08614bd..64c76dd 100644 --- a/.github/workflows/frontend-testing.yml +++ b/.github/workflows/frontend-testing.yml @@ -1,5 +1,5 @@ -name: name: Deploy frontend testing.ploneconf.org - +name: Deploy frontend testing +run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} on: workflow_dispatch: From 9ecd6dad9f6f591dd7965b13be686b79256ccca7 Mon Sep 17 00:00:00 2001 From: Fred van Dijk Date: Thu, 16 Feb 2023 15:43:13 +0100 Subject: [PATCH 07/10] only this branch --- .github/workflows/backend_testing.yml | 4 ++++ .github/workflows/frontend-testing.yml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/backend_testing.yml b/.github/workflows/backend_testing.yml index 24d6a37..31db15d 100644 --- a/.github/workflows/backend_testing.yml +++ b/.github/workflows/backend_testing.yml @@ -2,6 +2,10 @@ name: Deploy backend testing run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} on: workflow_dispatch: + push: + branches: + - testing-deploy + # push: # paths: # - "backend/**" diff --git a/.github/workflows/frontend-testing.yml b/.github/workflows/frontend-testing.yml index 64c76dd..04df268 100644 --- a/.github/workflows/frontend-testing.yml +++ b/.github/workflows/frontend-testing.yml @@ -3,6 +3,9 @@ run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} on: workflow_dispatch: + push: + branches: + - testing-deploy # push: # paths: # - "frontend/**" From 31e02f8ebb304aef2df65a4a2c058f5558530434 Mon Sep 17 00:00:00 2001 From: Fred van Dijk Date: Thu, 16 Feb 2023 15:56:02 +0100 Subject: [PATCH 08/10] ignore .python-version copy updated makefile from plone.org backend --- backend/.gitignore | 1 + backend/Makefile | 90 ++++++++++++++++++++++++++-------------------- 2 files changed, 53 insertions(+), 38 deletions(-) diff --git a/backend/.gitignore b/backend/.gitignore index 60f7252..4bfdf69 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -40,3 +40,4 @@ live.cfg inituser pip-wheel-metadata pyvenv.cfg +.python-version \ No newline at end of file diff --git a/backend/Makefile b/backend/Makefile index fc38b31..f439c9e 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -15,18 +15,37 @@ GREEN=`tput setaf 2` RESET=`tput sgr0` YELLOW=`tput setaf 3` -PLONE_VERSION=6.0.1 +PLONE_VERSION=6.0.0 BACKEND_FOLDER=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -CODE_QUALITY_VERSION=1.0.1 -LINT=docker run --rm -v "${BACKEND_FOLDER}":/github/workspace plone/code-quality:${CODE_QUALITY_VERSION} check +CODE_QUALITY_VERSION=2.0.2 +ifndef LOG_LEVEL + LOG_LEVEL=INFO +endif +CURRENT_USER=$$(whoami) +USER_INFO=$$(id -u ${CURRENT_USER}):$$(getent group ${CURRENT_USER}|cut -d: -f3) +LINT=docker run --rm -e LOG_LEVEL="${LOG_LEVEL}" -v "${BACKEND_FOLDER}":/github/workspace plone/code-quality:${CODE_QUALITY_VERSION} check +FORMAT=docker run --rm --user="${USER_INFO}" -e LOG_LEVEL="${LOG_LEVEL}" -v "${BACKEND_FOLDER}":/github/workspace plone/code-quality:${CODE_QUALITY_VERSION} format -PACKAGE_NAME=ploneconf.core -PACKAGE_PATH=src/ploneconf.core/src/ -IMAGE_NAME=plone/ploneconf-backend +IMAGE_NAME=ghcr.io/plone/ploneorg-backend IMAGE_TAG=latest -CHECK_PATH=src/ploneconf.core/setup.py scripts/ $(PACKAGE_PATH) + +# Python checks +PYTHON?=python3 + +# installed? +ifeq (, $(shell which $(PYTHON) )) + $(error "PYTHON=$(PYTHON) not found in $(PATH)") +endif + +# version ok? +PYTHON_VERSION_MIN=3.11 +PYTHON_VERSION_OK=$(shell $(PYTHON) -c 'import sys; print((int(sys.version_info[0]), int(sys.version_info[1])) > tuple(map(int, "$(PYTHON_VERSION_MIN)".split("."))))') +ifeq ($(PYTHON_VERSION_OK),0) + $(error "Need python $(PYTHON_VERSION) >= $(PYTHON_VERSION_MIN)") +endif + # Add the following 'help' target to your Makefile # And add help text after each target name starting with '\#\#' @@ -67,21 +86,16 @@ clean-test: ## remove test and coverage artifacts bin/pip: @echo "$(GREEN)==> Setup Virtual Env$(RESET)" - python3 -m venv . - bin/pip install -U "pip" "wheel" "git+https://github.com/cookiecutter/cookiecutter.git#egg=cookiecutter" + $(PYTHON) -m venv . + bin/pip install -U "pip" "wheel" "cookiecutter" "mxdev" -instance/etc/zope.ini: bin/pip - @echo "$(GREEN)==> Install Plone and create instance$(RESET)" - bin/pip install Plone -c https://dist.plone.org/release/$(PLONE_VERSION)/constraints.txt - bin/cookiecutter -f --no-input --config-file instance.yaml https://github.com/plone/cookiecutter-zope-instance - mkdir -p var/{filestorage,blobstorage,cache,log} - -bin/black: bin/pip - @echo "$(GREEN)==> Install Code Quality tools$(RESET)" - bin/pip install -r https://raw.githubusercontent.com/plone/code-quality/v$(CODE_QUALITY_VERSION)/requirements.txt +.PHONY: config +config: bin/pip ## Create instance configuration + @echo "$(GREEN)==> Create instance configuration$(RESET)" + bin/cookiecutter -f --no-input --config-file instance.yaml gh:plone/cookiecutter-zope-instance # i18n -bin/i18ndude: bin/pip +bin/i18ndude: bin/pip @echo "$(GREEN)==> Install translation tools$(RESET)" bin/pip install i18ndude @@ -90,54 +104,50 @@ i18n: bin/i18ndude ## Update locales @echo "$(GREEN)==> Updating locales$(RESET)" bin/update_locale -.PHONY: build -build: instance/etc/zope.ini ## Create virtualenv and run buildout - @echo "$(GREEN)==> Setup Build$(RESET)" - bin/pip install -r requirements.txt +# TODO `make build` +# build: -.PHONY: build -build-dev: instance/etc/zope.ini ## Create virtualenv and run buildout +.PHONY: build-dev +build-dev: config ## pip install Plone packages @echo "$(GREEN)==> Setup Build$(RESET)" - bin/pip install -r requirements/dev.txt + bin/mxdev -c mx.ini + bin/pip install -r requirements-mxdev.txt .PHONY: format -format: bin/black ## Format the codebase according to our standards +format: ## Format the codebase according to our standards @echo "$(GREEN)==> Format codebase$(RESET)" - bin/isort ${CHECK_PATH} - bin/black ${CHECK_PATH} - find "${PACKAGE_PATH}" -name '*.xml' |xargs bin/zpretty -x -i - find "${PACKAGE_PATH}" -name '*.zcml' |xargs bin/zpretty -z -i + $(FORMAT) .PHONY: lint lint: lint-isort lint-black lint-flake8 lint-zpretty ## check code style .PHONY: lint-black lint-black: ## validate black formating - $(LINT) black "$(CHECK_PATH)" + $(LINT) black .PHONY: lint-flake8 lint-flake8: ## validate black formating - $(LINT) flake8 "$(CHECK_PATH)" + $(LINT) flake8 .PHONY: lint-isort lint-isort: ## validate using isort - $(LINT) isort "$(CHECK_PATH)" + $(LINT) isort .PHONY: lint-pyroma lint-pyroma: ## validate using pyroma - $(LINT) pyroma src/ploneconf.core/ + $(LINT) pyroma .PHONY: lint-zpretty lint-zpretty: ## validate ZCML/XML using zpretty - $(LINT) zpretty "$(PACKAGE_PATH)" + $(LINT) zpretty .PHONY: test test: ## run tests - ./bin/zope-testrunner --auto-color --auto-progress --test-path src/ploneconf.core/src/ + bin/pytest .PHONY: test_quiet test_quiet: ## run tests removing deprecation warnings - PYTHONWARNINGS=ignore ./bin/zope-testrunner --auto-color --auto-progress --test-path src/ploneconf.core/src/ + bin/pytest --disable-warnings .PHONY: create-site create-site: instance/etc/zope.ini ## Create a new site from scratch @@ -147,6 +157,10 @@ create-site: instance/etc/zope.ini ## Create a new site from scratch start: ## Start a Plone instance on localhost:8080 PYTHONWARNINGS=ignore ./bin/runwsgi instance/etc/zope.ini +.PHONY: debug +debug: instance/etc/zope.ini ## Run debug console + PYTHONWARNINGS=ignore ./bin/zconsole debug instance/etc/zope.conf + .PHONY: build-image build-image: ## Build Docker Image @docker build . -t $(IMAGE_NAME):$(IMAGE_TAG) -f Dockerfile --build-arg PLONE_VERSION=$(PLONE_VERSION) From a0b52df4a17eb2072b33cc2be66d560f779ae65b Mon Sep 17 00:00:00 2001 From: Fred van Dijk Date: Thu, 16 Feb 2023 19:56:35 +0100 Subject: [PATCH 09/10] Fix all xml to inlucde the correct header for zpretty validation --- .../core/content/schemas/keynote.xml | 3 +- .../ploneconf/core/content/schemas/person.xml | 1 + .../ploneconf/core/content/schemas/slot.xml | 3 +- .../core/content/schemas/sponsor.xml | 1 + .../ploneconf/core/content/schemas/talk.xml | 1 + .../core/content/schemas/training.xml | 1 + .../core/profiles/default/actions.xml | 2 +- .../core/profiles/default/browserlayer.xml | 2 +- .../core/profiles/default/catalog.xml | 2 +- .../core/profiles/default/metadata.xml | 2 +- .../profiles/default/registry/imaging.xml | 2 +- .../profiles/default/registry/languages.xml | 2 +- .../core/profiles/default/registry/main.xml | 2 +- .../profiles/default/registry/querystring.xml | 2 +- .../core/profiles/default/rolemap.xml | 68 ++++++++++--------- .../ploneconf/core/profiles/default/theme.xml | 2 +- .../ploneconf/core/profiles/default/types.xml | 2 +- .../profiles/default/types/Collection.xml | 2 +- .../core/profiles/default/types/Keynote.xml | 2 +- .../core/profiles/default/types/Person.xml | 2 +- .../core/profiles/default/types/Slot.xml | 2 +- .../core/profiles/default/types/Sponsor.xml | 2 +- .../core/profiles/default/types/Talk.xml | 2 +- .../core/profiles/default/types/Training.xml | 2 +- .../core/profiles/initial/metadata.xml | 2 +- .../core/profiles/uninstall/browserlayer.xml | 2 +- 26 files changed, 64 insertions(+), 52 deletions(-) diff --git a/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/keynote.xml b/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/keynote.xml index a1660c9..40b872e 100644 --- a/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/keynote.xml +++ b/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/keynote.xml @@ -1,7 +1,8 @@ + - + diff --git a/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/person.xml b/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/person.xml index cd233d8..e332745 100644 --- a/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/person.xml +++ b/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/person.xml @@ -1,3 +1,4 @@ + - + diff --git a/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/sponsor.xml b/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/sponsor.xml index 243be64..8cc7d6f 100644 --- a/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/sponsor.xml +++ b/backend/src/ploneconf.core/src/ploneconf/core/content/schemas/sponsor.xml @@ -1,3 +1,4 @@ + + + + + 20220825001 diff --git a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/registry/imaging.xml b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/registry/imaging.xml index 3278593..cd00365 100644 --- a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/registry/imaging.xml +++ b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/registry/imaging.xml @@ -1,4 +1,4 @@ - + + + diff --git a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/registry/querystring.xml b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/registry/querystring.xml index a91e2dd..bc19b20 100644 --- a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/registry/querystring.xml +++ b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/registry/querystring.xml @@ -1,4 +1,4 @@ - + diff --git a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/rolemap.xml b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/rolemap.xml index e4253d7..7b433ee 100644 --- a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/rolemap.xml +++ b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/rolemap.xml @@ -1,48 +1,54 @@ - + - - - - + name="ploneconf.core: Add Sponsor" + > + + + + - - - - + name="ploneconf.core: Add Person" + > + + + + - - - - + name="ploneconf.core: Add Slot" + > + + + + - - - - + name="ploneconf.core: Add Training" + > + + + + - - - - + name="ploneconf.core: Add Talk" + > + + + + - - - - + name="ploneconf.core: Add Keynote" + > + + + + diff --git a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/theme.xml b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/theme.xml index a328066..7f916aa 100644 --- a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/theme.xml +++ b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/theme.xml @@ -1,4 +1,4 @@ - + barceloneta true diff --git a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types.xml b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types.xml index 77b4b5d..b8f9a7b 100644 --- a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types.xml +++ b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types.xml @@ -1,4 +1,4 @@ - + diff --git a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types/Collection.xml b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types/Collection.xml index f13ad57..e80c51d 100644 --- a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types/Collection.xml +++ b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types/Collection.xml @@ -1,4 +1,4 @@ - + diff --git a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types/Keynote.xml b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types/Keynote.xml index 12a4057..39fb7d4 100644 --- a/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types/Keynote.xml +++ b/backend/src/ploneconf.core/src/ploneconf/core/profiles/default/types/Keynote.xml @@ -1,4 +1,4 @@ - + + + + + + + 20210813001 diff --git a/backend/src/ploneconf.core/src/ploneconf/core/profiles/uninstall/browserlayer.xml b/backend/src/ploneconf.core/src/ploneconf/core/profiles/uninstall/browserlayer.xml index 238a625..f5bc15f 100644 --- a/backend/src/ploneconf.core/src/ploneconf/core/profiles/uninstall/browserlayer.xml +++ b/backend/src/ploneconf.core/src/ploneconf/core/profiles/uninstall/browserlayer.xml @@ -1,4 +1,4 @@ - + Date: Thu, 16 Feb 2023 20:09:46 +0100 Subject: [PATCH 10/10] Add empty mx.ini ignore mxdev output fix workflow run title --- .github/workflows/backend_testing.yml | 2 +- .github/workflows/frontend-testing.yml | 2 +- backend/.gitignore | 1 + backend/mx.ini | 9 +++++++++ 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 backend/mx.ini diff --git a/.github/workflows/backend_testing.yml b/.github/workflows/backend_testing.yml index 31db15d..f616385 100644 --- a/.github/workflows/backend_testing.yml +++ b/.github/workflows/backend_testing.yml @@ -1,5 +1,5 @@ name: Deploy backend testing -run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} +run-name: Deploy to backend testing by @${{ github.actor }} on: workflow_dispatch: push: diff --git a/.github/workflows/frontend-testing.yml b/.github/workflows/frontend-testing.yml index 04df268..baf17b0 100644 --- a/.github/workflows/frontend-testing.yml +++ b/.github/workflows/frontend-testing.yml @@ -1,5 +1,5 @@ name: Deploy frontend testing -run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} +run-name: Deploy to frontend testing by @${{ github.actor }} on: workflow_dispatch: diff --git a/backend/.gitignore b/backend/.gitignore index 4bfdf69..a40baea 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -35,6 +35,7 @@ report.html .tox/ reports/ venv/ +*-mxdev.txt # excludes live.cfg inituser diff --git a/backend/mx.ini b/backend/mx.ini new file mode 100644 index 0000000..dbe75b5 --- /dev/null +++ b/backend/mx.ini @@ -0,0 +1,9 @@ +; This is a mxdev configuration file +; it can be used to override versions of packages already defined in the +; constraints files and to add new packages from VCS like git. +; to learn more about mxdev visit https://pypi.org/project/mxdev/ + +[settings] +; example how to override a package version +; version-overrides = +; example.package==2.1.0a2 \ No newline at end of file