Ending gogs migration to gitea

This commit is contained in:
Philippe Caseiro 2018-10-30 16:32:58 +01:00
parent 8619edb520
commit 25763e68c0
6 changed files with 56 additions and 22 deletions

View File

@ -1,5 +1,5 @@
################################ ################################
# Makefile pour eole-gogs # Makefile pour eole-gitea
################################ ################################
SOURCE=eole-gitea SOURCE=eole-gitea

View File

@ -4,7 +4,8 @@
<!-- Je suis un commentaire --> <!-- Je suis un commentaire -->
<file filelist='gitea-nginx' name='/etc/nginx/sites-available/gitea' source='gitea.nginx' mkdir='True' rm='True'/> <file filelist='gitea-nginx' name='/etc/nginx/sites-available/gitea' source='gitea.nginx' mkdir='True' rm='True'/>
<file filelist='gitea' name='/usr/share/eole/bastion/data/51-gitea-nat_rules' mkdir='True' rm='True' mode='0755'/> <file filelist='gitea' name='/usr/share/eole/bastion/data/51-gitea-nat_rules' mkdir='True' rm='True' mode='0755'/>
<file filelist='gitea' name='/usr/share/eole/mysql/eole-gitea/gen/00-create-gitea-db.sql' mkdir='True' rm='True'/> <file filelist='gitea' name='/etc/eole/eole-db.d/gitea-db.yml' rm='True' mkdir='True'/>
<file filelist='gitea' name='/usr/share/eole/db/gitea/gen/00-create-gitea-db.sql' mkdir='True' rm='True'/>
<service_access service='gitea_with_nginx'> <service_access service='gitea_with_nginx'>
<port service_accesslist="gitea_with_nginx">443</port> <port service_accesslist="gitea_with_nginx">443</port>
</service_access> </service_access>
@ -14,7 +15,7 @@
<package>apt-transport-https</package> <package>apt-transport-https</package>
<package>git-core</package> <package>git-core</package>
<!-- FIXME this have to be installed <package>gitea</package> --> <!-- FIXME this have to be installed <package>gitea</package> -->
<file filelist='gitea' name='/etc/gitea/conf/app.ini' source='gitea.conf' mkdir='True' rm='True'/> <file filelist='gitea' name='/etc/gitea/conf/app.ini' source='gitea.conf' mkdir='True' rm='True' mode='770' owner='root' group='gitservice'/>
<!-- <service servicelist='xxxx'>nom-du-service-a-lancer-dans-le-conteneur</service> --> <!-- <service servicelist='xxxx'>nom-du-service-a-lancer-dans-le-conteneur</service> -->
<service servicelist='gitea'>forge</service> <service servicelist='gitea'>forge</service>
<service_access service='gitea_without_nginx'> <service_access service='gitea_without_nginx'>
@ -65,6 +66,14 @@
<value>localhost</value> <value>localhost</value>
</variable> </variable>
<variable name='gitea_nginx' type='oui/non' hidden='True'/> <variable name='gitea_nginx' type='oui/non' hidden='True'/>
<variable type='string' name='gitea_db_mode' description='Serveur de bases de données à utiliser'/>
</family>
<family name="BDD Forge" mode="expert">
<variable type='string' name='gitea_dbserver' description='Adresse du serveur de base de données'/>
<variable type='number' name='gitea_dbport' description="Port d'écoute du serveur de base de données"/>
<variable type='string' name='gitea_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
<variable type='string' name='gitea_dbuser' description='Utilisateur du serveur de base de données'/>
<variable type='string' name='gitea_dbpass' description='Fichier de mot de passe du serveur'/>
</family> </family>
</variables> </variables>
<constraints> <constraints>
@ -88,11 +97,13 @@
<fill name='calc_multi_condition' target='gitea_nginx'> <fill name='calc_multi_condition' target='gitea_nginx'>
<param>oui</param> <param>oui</param>
<param name="operator">OR</param> <param name="operator">OR</param>
<param type="eole" name="condition_1" optional="True">activer_revprox</param> <param type="eole" name="condition_1" optional="True">activer_nginx_web</param>
<param name="condition_2">non</param> <param name="condition_2">non</param>
<param name='match'>oui</param> <param name='match'>oui</param>
<param name='mismatch'>non</param> <param name='mismatch'>non</param>
</fill> </fill>
<condition name='disabled_if_in' source='gitea_nginx'> <condition name='disabled_if_in' source='gitea_nginx'>
<param>non</param> <param>non</param>
<target type='filelist'>gitea-nginx</target> <target type='filelist'>gitea-nginx</target>
@ -102,6 +113,18 @@
<param>oui</param> <param>oui</param>
<target type='service_accesslist'>gitea_without_nginx</target> <target type='service_accesslist'>gitea_without_nginx</target>
</condition> </condition>
<check name='valid_enum' target='gitea_db_mode'>
<param>['default', 'externe', 'local']</param>
</check>
<condition name='disabled_if_in' source='gitea_db_mode'>
<param>local</param>
<target type='family'>BDD Forge</target>
</condition>
<condition name='disabled_if_in' source='gitea_db_mode'>
<param>default</param>
<target type='family'>BDD Forge</target>
</condition>
</constraints> </constraints>
<help> <help>
<variable name='activer_gitea'>Activer la forge Gitea, Gitea est une forge basée sur Git clone de github (fork de gogs)</variable> <variable name='activer_gitea'>Activer la forge Gitea, Gitea est une forge basée sur Git clone de github (fork de gogs)</variable>

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
ENABLE=`CreoleGet activer_gogs 'non'` ENABLE=`CreoleGet activer_gitea 'non'`
if [ -L /etc/nginx/sites-enabled/gogs ];then if [ -L /etc/nginx/sites-enabled/gitea ];then
rm -f /etc/nginx/sites-enabled/gogs rm -f /etc/nginx/sites-enabled/gitea
fi fi
if [ "${ENABLE}" = 'oui' ];then if [ "${ENABLE}" = 'oui' ];then
ln -s /etc/nginx/sites-available/gogs /etc/nginx/sites-enabled/gogs ln -s /etc/nginx/sites-available/gitea /etc/nginx/sites-enabled/gitea
fi fi

View File

@ -1,13 +1,13 @@
-- example de création d'une base de données MySQL -- example de création d'une base de données MySQL
-- création de la base de donnée -- création de la base de donnée
CREATE DATABASE gogs CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE DATABASE gitea CHARACTER SET utf8 COLLATE utf8_general_ci;
-- création du user de la base -- création du user de la base
grant all privileges on gogs.* to gogs@%%container_ip_forge identified by 'gogs1234'; grant all privileges on gitea.* to gitea@%%container_ip_forge identified by 'gitea1234';
flush privileges ; flush privileges ;
-- connexion à la base -- connexion à la base
\r gogs \r gitea
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

View File

@ -34,8 +34,8 @@ createscript: "/usr/share/eole/db/gitea/gen/00-create-gitea-db.sql"
%set cnt_prefix = %%getVar('container_path_reseau', '') %set cnt_prefix = %%getVar('container_path_reseau', '')
pwd_files: pwd_files:
- {file: '%%cnt_prefix/etc/gitea/conf/app.ini', - {file: '%%cnt_prefix/etc/gitea/conf/app.ini',
pattern: 'PASSWD="', pattern: 'PASSWD = ',
end_pattern: ';', end_pattern: '',
owner: 'root:www-data', owner: 'root:gitservice',
mod: '660' } mod: '660' }

View File

@ -56,7 +56,18 @@ LANDING_PAGE = explore
; Either "mysql", "postgres" or "sqlite3", it's your choice ; Either "mysql", "postgres" or "sqlite3", it's your choice
DB_TYPE = mysql DB_TYPE = mysql
;FIXME FOR EOLEDB ;FIXME FOR EOLEDB
HOST = %%getVar("container_ip_mysql","127.0.0.1"):3306 %set %%dbMode = %%getVar("gitea_db_mode")
%if %%dbMode == "default"
%if %%edb_local == "oui"
HOST = 127.0.0.1:3306
%else
HOST = %%{edb_host}:%%{edb_port}
%end if
%elif %%dbMode == "local"
HOST = 127.0.0.1:3306
%elif %%dbMode == "externe"
HOST = %%{gitea_dbserver}:%%{gitea_dbport}
%end if
NAME = gitea NAME = gitea
USER = gitea USER = gitea
PASSWD=gitea1234 PASSWD=gitea1234