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

Dev #388

Merged
merged 15 commits into from
Mar 17, 2024
Merged

Dev #388

Show file tree
Hide file tree
Changes from all commits
Commits
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
48 changes: 48 additions & 0 deletions .github/workflows/test_install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This is a basic workflow that is manually triggered

name: Test install
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
push:
branches: [master, dev]
paths:
- "backend/**"
- "frontend/**"
- "install/**"
- ".github/workflows/test_install.yml"

pull_request:
branches: [master, dev]
paths:
- "backend/**"
- "frontend/**"
- "install/**"
- ".github/workflows/test_install.yml"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
greet:
strategy:
matrix:
os: ["ubuntu-22.04", "ubuntu-latest", "debian-11", "debian-12"]
node-version: ["14.21.3"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: enable postgresql
run: sudo systemctl start postgresql.service
- name: Test install
run: cp config/settings.ini.template config/settings.ini && sed -i 's,http://mydomain.net/taxhub/api/,https://demo.geonature.fr/taxhub/api/,g' config/settings.ini && install/install_app.sh
2 changes: 2 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Créer un utilisateur appartenant au groupe ``sudo``. Dans cette documentation,
su # vous aurez besoin du mot de passe de l'utilisateur root
# Création de l'utilisateur (ceci vous demandera un mot de passe)
adduser --gecos "" geonatadmin
# Ajout des droits en lecture pour groups et others sur le répertoire de l'utilisateur
chmod -R 744 /home/geonatadmin
# Ajout dans le groupe sudo
usermod -aG sudo geonatadmin
# Connexion avec cet utilisateur
Expand Down
3 changes: 3 additions & 0 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@
}
},
"defaultProject": "frontend",
"cli": {
"analytics": false
},
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
Expand Down
3 changes: 2 additions & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions install/copy_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ if [ ! -f frontend/src/custom/home/home.css ]; then
cp frontend/src/custom/home/home.html.template frontend/src/custom/home/home.html
fi

if [! -d media ]; then
if [ ! -d media ]; then
mkdir media
fi
fi
2 changes: 1 addition & 1 deletion install/create_db.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
echo "Creating Citizen database..."
echo "SELECT 'CREATE DATABASE $pg_dbname' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$pg_dbname')\gexec" | sudo -u postgres psql
echo "SELECT 'CREATE DATABASE $pg_dbname OWNER $user_pg' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$pg_dbname')\gexec" | sudo -u postgres psql
sudo -u postgres -s psql -d $pg_dbname -c "CREATE EXTENSION IF NOT EXISTS postgis;"
4 changes: 2 additions & 2 deletions install/create_db_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ if [ ${user_pg_exists} -eq 0 ]; then
echo "Create Citizen database user…"
sudo -u postgres -s psql -c "CREATE ROLE $user_pg WITH LOGIN PASSWORD '$user_pg_pass';"
fi
# Always grant privileges on the newly created database
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE ${pg_dbname} TO ${user_pg};"
# Always grant ownership on the newly created database
# sudo -u postgres psql -c "ALTER DATABASE ${pg_dbname} OWNER TO ${user_pg};"
22 changes: 11 additions & 11 deletions install/install_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ DIR=$(pwd)

#Installation de python / gunicorn / supervisor + dépendances
sudo apt update
sudo apt -y install gcc curl gunicorn python-setuptools lsb-release \
sudo apt -y install gcc curl gunicorn python3-setuptools lsb-release \
apt-transport-https wget build-essential zlib1g-dev libncurses5-dev \
libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl \
libbz2-dev apache2 python-dev libpq-dev libgeos-dev supervisor unzip \
libbz2-dev apache2 libpq-dev libgeos-dev supervisor unzip \
virtualenv libcurl4-openssl-dev libssl-dev libglib2.0-0 libsm6 libxext6 \
libxrender-dev postgresql postgis python3 python3-dev python3-venv python3-pip

sudo apt-get clean
# Add a new user in database
. ./install/create_db_user.sh

# Create the database
. ./install/create_db.sh

# Add a new user in database
. ./install/create_db_user.sh


#Installation de nvm / npm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
Expand Down Expand Up @@ -65,6 +64,13 @@ sudo sed -i "s%APP_PATH%${DIR}%" /etc/apache2/sites-available/gncitizen.conf
sudo sed -i "s%mydomain.net%${URL}%" /etc/apache2/sites-available/gncitizen.conf
sudo sed -i "s%backoffice_username%${backoffice_username}%" /etc/apache2/sites-available/gncitizen.conf

# Copy main medias to media
mkdir -p $DIR/media
cp -r $DIR/frontend/src/assets/* $DIR/media

# Creation des repertoires de log
mkdir -p var/log

# cd ..

# Création du venv
Expand All @@ -82,12 +88,6 @@ pip install -r requirements.txt
flask db upgrade

cd $DIR
# Copy main medias to media
mkdir -p $DIR/media
cp -r $DIR/frontend/src/assets/* $DIR/media

# Creation des repertoires de log
mkdir -p var/log

touch init_done

Expand Down
Loading