Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/482 migrate core type #532

Open
wants to merge 36 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
eccc545
buildout conf to handle migration
sauzher Jul 17, 2024
d2e22c4
initial steps to prepare migration environment (caching, contentrules..)
sauzher Jul 18, 2024
6509a3b
toggle likintegrity check
sauzher Jul 18, 2024
ac9c966
fix page-document type
sauzher Jul 18, 2024
2839c40
mitration runs fine until Folders...
sauzher Jul 18, 2024
5a420b0
fix wierdness migration for folders
sauzher Jul 19, 2024
0c02867
disabling resolveuid_and_caption adapter override
sauzher Jul 19, 2024
38ede0b
found DAVLocker objects. Unlocking them
sauzher Jul 24, 2024
d937ff9
removed c.exportimport
sauzher Jul 24, 2024
af3a472
some members folders need a second pass.
sauzher Jul 25, 2024
b1f9c22
Merge branch 'staging' into issue/482-migrate-core-type
sauzher Jul 25, 2024
b888f84
Initial ansible updated instegrated into buildout.
alecpm Jul 27, 2024
5397c1c
Fix xhtml2 pdf version
alecpm Jul 27, 2024
1e20c13
Update pins.
alecpm Jul 27, 2024
ff937fb
Ansible updates and docs.
alecpm Jul 30, 2024
a67f2ac
cleaned import
sauzher Jul 31, 2024
5e9eb9d
uninstall c.contentleadimage ad the end of the process
sauzher Aug 1, 2024
b03843f
fix Events search view for Dexterity collection
sauzher Aug 8, 2024
f78dfdf
refining work on #482
sauzher Aug 8, 2024
d759c27
fix event details portlet for dexterity accessors
sauzher Aug 22, 2024
1518f51
fix text accessor for dexterity event
sauzher Aug 23, 2024
2943d24
plone.app.event needs to be uninstalled. The behaviors are provided b…
sauzher Aug 23, 2024
f6c6ab3
fix lack of text content
sauzher Aug 23, 2024
fb6c368
fixed timezone conversion issues on Events.
sauzher Aug 23, 2024
5c8bc47
implemented migration of easyslider slides (implemented on the homep…
sauzher Aug 23, 2024
9ca2a1f
some PY3 forward compatibility
sauzher Sep 30, 2024
9d34233
Add sync scripts. Update inventory.
alecpm Oct 1, 2024
e42d92c
Update permissions.
alecpm Oct 1, 2024
6955fb5
Update dep version.
alecpm Oct 1, 2024
5e88f6e
Downgrade dep.
alecpm Oct 1, 2024
b09a572
Apache ssl fixes.
alecpm Oct 1, 2024
397e36d
Merge remote-tracking branch 'origin/updated-ansible' into issue/482-…
sauzher Oct 1, 2024
5ed8eb2
more robust traversing
sauzher Oct 1, 2024
d671a8e
bump pillow to 6.2.2
sauzher Oct 1, 2024
30c6b09
fix indentation issue
sauzher Oct 2, 2024
b5ec0a8
cleaned up contentleadimages properties
sauzher Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ __pycache__/

# Distribution / packaging
.Python
Pipfile
.python-version
.vaultpass
bin/
lib/
setup-base/
Expand All @@ -23,6 +26,7 @@ develop-eggs/
lib64/
parts/
sdist/
ansible/ansible-playbook
var/*
*.egg-info/
*.egg
Expand Down
86 changes: 86 additions & 0 deletions ansible/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
Installing Anisble
------------------

We use the Plone Ansible playbooks to deploy this buildout, using a branch with
certbot SSL support. To get started run the setup script from this directory:

```
$ ./setup_ansible.sh
```

That will checkout a custom branch of the Ansible playbooks, copy in the site
specific configuration, install Ansbile and required roles.

You will need a vault password file for decrypting passwords/tokens in a file at
`ansible-playbook/.vaultpass`

Adding Users
------------

Once ansible is setup locally, you can setup users on the server using:

```
$ ansible-playbook add-users.yml
```

Setting up the Server
---------------------

ISAW uses apache rather than Plone's default nginx, so it needs some special setup to install apache and also clone a git repository with the static Kinik Hoyuk website:

```
$ ansible-playbook apache.yml
```

There's a playbook to install a specified python version if different from
the OS version. The following command will intstall the python version specified
in `plone_python_version` using apt and the deadsnakes PPA:

```
$ ansible-playbook install-python.yml
```

For Plone 5.2, python 3.8 is the default though it is not the OS install, so it's best to run this before running the Plone playbook. The standard Plone playbook is used to setup the server:

```
$ ansible-playbook playbook.yml
```

There's also a playbook to setup a Python 2.7 + Plone 5.1 instance on the server
(in `/usr/local/plone-5.1/migration`) to aid in migration. This must be run after
the primary `playbook.yml`:

```
$ ansible-playbook migration-plone.yml
```

And add and enable custom fail2ban setup (if `install_fail2ban` is enabled in
the group/host vars):
```
$ ansible-playbook fail2ban.yml
```

You can also optionally enable a UFW firewall:

```
$ ansible-playbook firewall.yml

```

## Inventory

The default inventory file is `inventory.cfg`.
It defines both live and staging groups, as well as a combined group for encrypted secrets that are available to all groups.

There is a matching vbox-host.cfg that defines the same groups, but targets the vagrant virtualbox.
Usage: `ansible-playbook -i vbox-inventory.cfg -l live playbook.yml`

### Host and Group Variables

For each host in the inventory, it is possible to customize deployment some
variables using the files in `host_vars`. For example
`host_vars/custom_staging.yml` would contain host specific variables for the `custom_staging` server.

Similarly, deployment variables common across a group of servers can be
configured in `group_vars`. For example, `group_vars/staging.yml`
contains settings common to all servers in the staging group.
134 changes: 134 additions & 0 deletions ansible/add-users.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
---

- hosts: all
become: yes
gather_facts: no

vars:
users:
- name: plone_buildout
sudoer: no
auth_key:
group: plone_group
keyfiles: plone_user_keys
umask: "0007"
- name: plone_daemon
sudoer: no
auth_key:
keyfiles:
group: plone_group
umask: "0007"
- name: alecpm
sudoer: yes
auth_key: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA1Wp63G60D9rNG+iu301OEjYcBIGcPzwA6eGCmQoizAhc8eHx27YOxlkNPlZ6pdensAft9A2Gd/0bdg5rNtf9XmxPbWmY3LMyat0UafJNX/r4z4x5zqdlnEVdXykXbhmfZta4/ESNMwF4i03wjy+9+EOcdfRswBg1Hc1jXrLlJy0= alec@alec
keyfiles:
group: plone_group
- name: marco
sudoer: yes
auth_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDav16s5/3VniqxCy0VE4w6l64zQ96+4/CKEuIsP88svNO+0uuHp2m4Q5Xy0JTZYmImHfThtXEHjFpbHmBV5HCcDMQAEZW+AIveeKGkzkjZZNV+bsf96NSyxG8aZG3iRjxfoDryFNuKjKnRtJ9zzJsaGVr3Dq+4xsvvxl1mOWp9RO6YL2/yEaAz8GWQ+ypdF5/38S+rTHNibdhRMuCVFEiwOTAnRCTwV+nqRHEc5UcO2EhkUzzK+2OZMEucjH6k3mmLbpmhSmfK2A24+ahvLjD2Iw64DD8bsxbvZumUFzHoYkQJ41XdPhs2s/QoxntVdLgLisj6Ss/iVz7UKrxUYS+v
keyfiles:
group: plone_group
- name: sauzher
sudoer: yes
auth_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5KWG+Ron3Tw8zC7XOPlzC7q63oawXUu9MiPVrKRvx7w0OHpzGg5vktQnz2u/vR5voKnz4kJwpZEHJSJRF260gBj3QJGxZ79tvJvel64y4ZRDHsLciibYrhA4HA8J4oWTgyzEzOztdVudzFPPnTTWUXrLq19f9bZHeFAbl7NNJpeN2/t8MkYbIZJ/w6ixurJAuAJIydLXOjf5iXZlgOggiZcOAyYNiC0MU6ESQYDAoPQu5qcCqt26jFjQQybYj2tQsuDPq4wxsCbMy3llNCGuZ3yHafXt5XUfM7fPkmcX2AFa5sQKUhRvGi/JUIERtHxMJGN+CkR1rMjrq/+6ZxrCl sauzher@sauzher-Mint
keyfiles:
group: plone_group
- name: telliott
sudoer: yes
auth_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOkBB0Ds76keMMcvGjeDTT4s6YS8m7TXOmEjVdIeTLAg [email protected]
keyfiles:
group: plone_group

tasks:

- name: Ensure plone_group
group: name=plone_group

- name: Add users
user:
name={{ item.name }}
system={{ item.sudoer }}
shell=/bin/bash
group="{{ item.group }}"
when: item.group
with_items: "{{ users }}"

- name: Add users
user:
name={{ item.name }}
system={{ item.sudoer }}
shell=/bin/bash
when: not item.group
with_items: "{{ users }}"

- name: Add .ssh directories
file:
path=/home/{{ item.name }}/.ssh
state=directory
owner="{{ item.name }}"
with_items: "{{ users }}"
tags:
- ssh

- name: Add keys
lineinfile:
dest=/home/{{ item.name }}/.ssh/authorized_keys
state=present
create=yes
line="{{ item.auth_key }}"
owner="{{ item.name }}"
with_items: "{{ users }}"
tags:
- ssh

- name: Add to sudoers
lineinfile:
dest=/etc/sudoers.d/{{ item.name }}
state=present
create=yes
line="{{ item.name }} ALL=(ALL) NOPASSWD:ALL"
mode=440
when: item.sudoer
with_items: "{{ users }}"
tags:
- sudo

- name: SSH keys
copy:
src={{ item.keyfiles }}/
dest=/home/{{ item.name }}/.ssh/
owner={{ item.name }}
mode=0600
when: item.keyfiles
with_items: "{{ users }}"
tags:
- ssh

- name: Set user umask in .bashrc
ansible.builtin.lineinfile:
path: /home/{{ item.name }}/.bashrc
regexp: ^umask
line: "umask {{ item.umask }}"
create: no
when: item.get('umask')
with_items: "{{ users }}"
tags:
- umask

- name: Set plone_daemon ulimit for open files
community.general.pam_limits:
domain: plone_daemon
limit_type: soft
limit_item: nofile
value: 39693561
tags:
- ulimit

- name: Set plone_daemon ulimit for processes
community.general.pam_limits:
domain: plone_daemon
limit_type: '-'
limit_item: nproc
value: 65000
tags:
- ulimit
10 changes: 10 additions & 0 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[defaults]
inventory = ./inventory.cfg
roles_path = ./roles
become_method = sudo
vault_password_file = .vaultpass
extra_vars = @secrets.yml

[ssh_connection]
allow_world_readable_tmpfiles = True
pipelining = True
Loading