Open marc-bouvier opened 2 months ago
.env
A la fin du déroulé, voici les variables qu'on peut trouver dans le .env
chiffré de https://github.com/iroco-co/france-public-declarations/tree/main/deployment
OTA_ENGINE_GITHUB_TOKEN=xxxxxxxxxxx
OTA_ENGINE_SMTP_PASSWORD=xxxxxxxxxx
Pour le moment, le compte ota@ota.iroco.co ne parvient pas à se connecter en SSH.
TASK [ota/apps : Clone repository] *********************************************
fatal: [ota.iroco.co]: FAILED! => changed=false
cmd: /usr/bin/git ls-remote 'ssh:********@ssh.github.com:443/iroco-co/france-public-declarations.git' -h refs/heads/main
msg: |-
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
rc: 128
stderr: |-
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
stderr_lines: <omitted>
stdout: ''
stdout_lines: <omitted>
PLAY RECAP *********************************************************************
ota.iroco.co : ok=5 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
En local je parviens à cloner le dépôt en utilisant la clé privée que j'ai déchiffrée à l'aide du vault.
git clone --config core.sshCommand="ssh -i /Users/marco/.ssh/france-public-bot" git@github.com:iroco-co/france-public-declarations.git
En remettant les URLs des dépôts GIT dans le format préconisé par la doc plutôt que ssh:...443...
, ça à l'air d'aller plus loin.
Etant passé à OVH, nous n'avons plus cette limitation qui venait de Eolas.
Je m'attends à ce que la prochaine erreur concerne soit le bot, soit le mail (Brevo) , vu qu'on n'a pas positionné les variables d'environnement correspondantes.
Pour le moment, ça déroule
https://github.com/iroco-co/france-public-declarations/actions/runs/10736289101/job/29775392336
Le build et OK.
Attendons le premier crawl.
Reste à faire 👇
For collections to be included in the Iroco organisation only. For third parties, handle rights however you see fit.
france-public
collection”Peut-être pourrait-on utiliser Iroco plutôt que Brevo pour envoyer des e-mails?
A voir si on peut le faire avec l'engine ou si on est contraint de fonctionner avec Brevo (proposer une PR pour SMTP classique?)
Create an SMTP key to allow sending error notifications by email.
france-public
collection”On your local machine:
engine.wiki
database.kdbx
with KeePassXCCollection: france-public
folder, add an entry with the title SMTP Key
Password
fieldOn your local machine:
france-public-declarations
repositorydeployment
folder.env
if necessary: ansible-vault decrypt .env
.env
file under the name OTA_ENGINE_SMTP_PASSWORD
.env
: ansible-vault encrypt .env
Creating a collection
You are considering creating a new collection to track terms with Open Terms Archive? Amazing!
✅ Define metadata
First of all, define the metadata of the collection you would like to create.
✅ Check existing collections
Now that you have a clear idea what you would like to track, double-check that there are no existing federated collections that you could contribute to. If you have a doubt about whether some terms you want to track would fit a collection, reach out to the collection maintainers.
If no existing collection could be a good host for the terms you would like to track, then it is relevant to create your own.
Inform the community
Starting a new collection is an exciting endeavour, and would strongly benefit from the support of the community who already maintains existing collections. It is strongly recommended to share your intention to create a new collection as early as possible in the process, to get support and identify potential partners.
You can inform the community by posting on the instant messaging system, or sending an email to the core team.
Define governance
Setting up and maintaining a collection over time needs fulfilling certain tasks on a regular basis. These tasks are handled through roles. To make sure that all these roles are covered, define the governance of your collection.
At any time, feel free to ask for help or partners in the community.
✅ Create repositories
Collections rely on three git repositories being set up to hold the data.
The instructions below assume the usage of GitHub to host repositories. If you don’t use GitHub, try to set up the equivalent metadata in your git hosting platform. Contributions to the documentation to make it independent from GitHub are very welcome!
✅ Declarations
Create the collection declarations repository by using the
demo-declarations
repository as template.demo-declarations
repositoryfrance-public-declarations
. For example:pga-declarations
.first-time-setup
GitHub action to make sure that everything ran fine.✅ Fill the “About” section
france-public
. Maintained byIroco
.”https://opentermsarchive.org
, or any other relevant dedicated website.terms-of-service
,terms-of-service-agreements
,terms-and-conditions
,open-terms-archive
.✅ Define repository settings
These settings ease the whole contribution process.
main
.validate_modified_declarations
andvalidate_schema
as required status checks.✅ Remove default labels
Issues labels will be added by the engine as problems are encountered when tracking. The default labels offered by GitHub, such as
question
orwontfix
, are relevant for software development but less so for the process prescribed by Open Terms Archive.✅ Update README
✅ Snapshots
Create the snapshots repository by using the
demo-snapshots
repository as template:demo-snapshots
repositoryfrance-public-snapshots
.first-time-setup
GitHub action to make sure that everything ran fine.✅ Fill the “About” section
france-public
. Maintained byIroco
.”https://opentermsarchive.org
.terms-of-service
,terms-of-service-agreements
,terms-and-conditions
,open-terms-archive
.✅ Define repository settings
These settings aim at minimising the otherwise overwhelming amount of information and click targets.
✅ Versions
Create the versions repository by using the
demo-versions
repository as template:demo-versions
repositoryfrance-public-versions
.first-time-setup
GitHub action to make sure that everything ran fine.✅ Fill the “About” section
france-public
. Maintained byIroco
.”https://docs.opentermsarchive.org/terms/how-to-navigate-history/
terms-of-service
,terms-of-service-agreements
,terms-and-conditions
,open-terms-archive
.✅ Define repository settings
These settings aim at minimising the otherwise overwhelming amount of information and click targets.
✅ Update README
👉 Set up GitHub teams
For collections to be included in the Iroco organisation only. For third parties, handle rights however you see fit.
france-public
collection”✅ Set up deployment
✅ Check server configuration
Before proceeding with deployment, ensure that the server meets the following requirements:
ssh-keyscan -t ed25519 ota.iroco.co
sudo ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
sudo systemctl restart ssh
adduser ota
. Follow the prompts to set a password for the new user and provide any additional information if required.usermod -aG sudo ota
.sudo
rights to the designated user without requiring a password prompt. To achieve this:/etc/sudoers
for editing.# Allow members of group sudo to execute any command
.✅ Define the inventory
On your local machine:
france-public-declarations
repositorydeployment/inventory.yml
:ota.iroco.co
(example:162.19.74.224
)ansible_user: ota
(example:debian
)ed25519_fingerprint: <server_ssh_fingerprint>
obtained withssh-keyscan -t ed25519 ota.iroco.co
(example:AAAAC3NzaC1lZDI1ETE5AAAAIJkjE2KIbUcoClK+lKLR5ZvmdXMD/eXWghHdenFeJz4c
)✅ Add fingerprint to GitHub france-public-declarations settings
france-public-declarations
repositoryhttps://github.com/OpenTermsArchive/france-public-declarations/settings/secrets/actions
SERVER_FINGERPRINT
secrets by using the previously obtained ed25519 fingerprint✅ Set up a SSH deployment key
This key will enable automated deployment via GitHub Actions.
✅ Create the SSH key
ssh ota@ota.iroco.co
ssh-keygen -t ed25519 -q -N "" -f ~/.ssh/ota-deploy
authorized_keys
:cat ~/.ssh/ota-deploy.pub >> ~/.ssh/authorized_keys
✅ Add key to GitHub france-public-declarations repository secrets
france-public-declarations
repositoryhttps://github.com/iroco-co/france-public-declarations/settings/secrets/actions
SERVER_SSH_KEY
secret with the previously generated deployment private key✅ Back key up
On your local machine:
engine.wiki
database.kdbx
with KeePassXCCollection: france-public
folderDeployment SSH key
ota-deploy.pub
and privateota-deploy
key files to the entry✅ Allow irocodeploy to create issues and publish dataset on GitHub
✅ Create a fine-grained repo-scoped token
france-public
collection”Describe why your personal access token needs access to the iroco-co organization.
france-public
-declarations” andfrance-public
-versions”✅ Backup the token
On your local machine:
database.kdbx
with KeePassXCCollection: france-public
folder, add an entry with the titleGitHub Token
Password
field✅ Validate the token
✅ Add secrets
✅ Generate vault key
On your local machine:
database.kdbx
with KeePassXCCollection: france-public
folder, add an entry with the titleVault key
✅ Create vault key file
On your local machine:
france-public-declarations
repositorydeployment
foldervault.key
file✅ Add vault key to GitHub france-public-declarations settings
france-public-declarations
repositoryhttps://github.com/OpenTermsArchive/france-public-declarations/settings/secrets/actions
ANSIBLE_VAULT_KEY
secrets by using the previously generated vault key✅ Encrypt token and update deployment
On your local machine:
france-public-declarations
repositorydeployment
folder.env
file under the nameOTA_ENGINE_GITHUB_TOKEN
.env
:ansible-vault encrypt .env
✅ Set up an irocodeploy SSH key specific to this collection
✅ Create the SSH key
ssh-keygen -t ed25519 -C @ota@ota.iroco.co -P "" -f ./france-public-key
✅ Encrypt private key and update deployment
On your local machine:
france-public-declarations
repositorydeployment
foldergithub-bot-private-key
github-bot-private-key
:ansible-vault encrypt github-bot-private-key
✅ Back key up
On your local machine:
engine.wiki
database.kdbx
with KeePassXCCollection: france-public
folder, add an entry with the titleirocodeploy GitHub SSH key
france-public-key.pub
and privatefrance-public-key
key files to the entry✅ Attach the key to irocodeploy GitHub user
france-public
collection”🏗️ Enable sending error reports over email
Create an SMTP key
Create an SMTP key to allow sending error notifications by email.
france-public
collection”Backup key
On your local machine:
engine.wiki
database.kdbx
with KeePassXCCollection: france-public
folder, add an entry with the titleSMTP Key
Password
fieldEncrypt key and update deployment
On your local machine:
france-public-declarations
repositorydeployment
folder.env
if necessary:ansible-vault decrypt .env
.env
file under the nameOTA_ENGINE_SMTP_PASSWORD
.env
:ansible-vault encrypt .env
Test
Via GitHub Actions
deploy
action ran properly on the declarations repository.Locally
To test deployment from your local machine, your SSH keys must be authorized to connect to the server.
cd <path/to/>france-public-declarations/deployment
ansible-galaxy collection install -r requirements.yml
ansible-playbook opentermsarchive.deployment.deploy