diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000000000000000000000000000000000000..e37ad90fcea4c63b18870c496bf8f7659f1351fe --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,99 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://vagrantcloud.com/search. + config.vm.box = "debian/bookworm64" + + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # NOTE: This will enable public access to the opened port + # config.vm.network "forwarded_port", guest: 5000, host:5000 + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine and only allow access + # via 127.0.0.1 to disable public access + # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + config.vm.network "public_network", use_dhcp_assigned_default_route: true, bridge: "vmbr0" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network "public_network" + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + # config.vm.synced_folder "~/scodoc", "/opt/scodoc" + + #config.ssh.username = 'scodoc' + #config.ssh.insert_key = 'true' + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + vb.memory = "8192" + vb.cpus = 2 + end + + #config.ssh.username = "scodoc" + #config.ssh.password = "r6a06$$" + # + # View the documentation for the provider you are using for more + # information on available options. + # Enable provisioning with a shell script. Additional provisioners such as + # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the + # documentation for more information about their specific syntax and use. + config.vm.provision "shell", inline: <<-SHELL + apt update && apt -y upgrade + apt -y install net-tools + export CONFIG=/vagrant/config + apt-get install -y gnupg + wget -O - https://scodoc.org/misc/scodoc-repo.gpg.key | gpg --dearmor > /usr/share/keyrings/scodoc-archive-keyring.gpg + #ajout depot et installation scodoc + cp $CONFIG/scodoc.list /etc/apt/sources.list.d + apt-get update + # discard postfix dialog + export DEBIAN_FRONTEND=noninteractive + apt-get install -y nginx + apt-get install -y scodoc9 + + echo '# scodoc user is created by scodoc install. configure it' + usermod -aG sudo scodoc + cp $CONFIG/.bashrc /home/scodoc/.bashrc + su -c "psql -c 'GRANT postgres TO scodoc;'" postgres + + echo 'install development data' + su -c "createdb SCODOC_DEV" scodoc + rm /opt/scodoc/.env + cp $CONFIG/.env /opt/scodoc/.env + cd /opt/scodoc + yes | tools/restore_scodoc9_data.sh /$CONFIG/SCODOC_DEV.tgz + SHELL +end + diff --git a/config/.bashrc b/config/.bashrc new file mode 100644 index 0000000000000000000000000000000000000000..98c2a33803519454f8fc94214df9fa9e42a2cfdf --- /dev/null +++ b/config/.bashrc @@ -0,0 +1,3 @@ +#!/bin/bash +cd /opt/scodoc +source venv/bin/activate diff --git a/config/.env b/config/.env new file mode 100644 index 0000000000000000000000000000000000000000..7aa8e3d51ab0f57121f57529b1496e325473ddcc --- /dev/null +++ b/config/.env @@ -0,0 +1,20 @@ +# Fichier à configurer et renommer en .env +# (dans /opt/scodoc) +# Il doit appartenir à (ou être lisible par) "scodoc" + + +FLASK_APP=scodoc.py +FLASK_ENV=development + +# Envois de mails: adapter si nécessaire +# MAIL_SERVER=localhost + +# Obligatoire: +SCODOC_ADMIN_MAIL="nomail@nowhere.net" +SCODOC_DATABASE_URI=postgresql:///SCODOC_DEV + +# Remplacer cette chaine +# Vous pouvez utiliser +# python3 -c "import uuid; print(uuid.uuid4().hex)" +# pour en créer une de ce genre, aléatoire +SECRET_KEY="53ffeff44a3940dea4964d628af33dd9" diff --git a/config/MINI_SCODOC.tgz b/config/MINI_SCODOC.tgz new file mode 100644 index 0000000000000000000000000000000000000000..8aa327a3ae49f8dd7410d7ccc1a49b058fde1229 Binary files /dev/null and b/config/MINI_SCODOC.tgz differ diff --git a/config/SCODOC_DEV.tgz b/config/SCODOC_DEV.tgz new file mode 100644 index 0000000000000000000000000000000000000000..3a625c0794631bdcb29f58ab0950acaef397a4fe Binary files /dev/null and b/config/SCODOC_DEV.tgz differ diff --git a/config/scodoc.list b/config/scodoc.list new file mode 100644 index 0000000000000000000000000000000000000000..f722c5cd694c7906e8b8c544b91a665d29a620fa --- /dev/null +++ b/config/scodoc.list @@ -0,0 +1,2 @@ +# ScoDoc repository for Debian 12 bullseye +deb [signed-by=/usr/share/keyrings/scodoc-archive-keyring.gpg] http://scodoc.org/deb/bookworm bookworm main