Project

General

Profile

Update TEST server - production@idoc-medoc-test » History » Version 3

Imène Lajili, 30/11/2017 17:56

1 1 Guanji Wang
h1. Update TEST server - production@idoc-medoc-test 
2 1 Guanji Wang
3 1 Guanji Wang
>h2. A. Prepare the test-server branch in git:
4 1 Guanji Wang
5 1 Guanji Wang
>1. In branch 'master', git add, commit and push all update to gitlab IAS.
6 1 Guanji Wang
7 1 Guanji Wang
>2. Test pysitools and idoc-medoc-test to see:
8 1 Guanji Wang
>* If the project && datasets are well detected.
9 1 Guanji Wang
>* If the download function works.
10 1 Guanji Wang
>* If all tests pass and the result is Ok, then go to step 3.
11 3 Imène Lajili
To install Pysitools2:
12 3 Imène Lajili
><pre><code class="GIT">
13 3 Imène Lajili
git clone https://git.ias.u-psud.fr/palinger/PySitools2.git -b test-local
14 3 Imène Lajili
cd PySitools2/
15 3 Imène Lajili
source ../bin/activate // In case of using a Python  virtual env
16 3 Imène Lajili
python setup.py install
17 3 Imène Lajili
</code>
18 3 Imène Lajili
</pre>
19 3 Imène Lajili
To test with Pysitools2:
20 3 Imène Lajili
><pre><code class="python">
21 3 Imène Lajili
python setup.py test -q
22 3 Imène Lajili
</code></pre>
23 3 Imène Lajili
24 3 Imène Lajili
25 1 Guanji Wang
    
26 1 Guanji Wang
>3. Git checkout 'test-server' branch, git cherry-pick the commit ID which are used in test server.
27 1 Guanji Wang
28 2 Guanji Wang
>4. In case if there are some conflicts or conflict headers added in XML files, for easier and cleaner update, we can delete the data folder in branch test-server, then ' git checkout master -- data' to recover the proper data from 'master' branch.
29 1 Guanji Wang
30 1 Guanji Wang
>5. Attention, in master branch, data source is sdo3 but not sdo, so we need execute my script -  transfer_local_test.cmd (The link : https://git.ias.u-psud.fr/gwang/idoc-medoc-solar-portal/blob/test-server/transfer_local_test.cmd)
31 1 Guanji Wang
32 1 Guanji Wang
33 1 Guanji Wang
><pre><code class="javascript">
34 1 Guanji Wang
  #!/bin/bash
35 1 Guanji Wang
echo "This is a shell to replace the host name in datasets or preference or sdodownload form url etc.."  
36 1 Guanji Wang
37 1 Guanji Wang
sdo3_cgi='sdo3.ias.u-psud.fr/VSO/DRMS/cgi-bin/ias_export_hmi.cgi'
38 1 Guanji Wang
sdo_cgi='sdo.ias.u-psud.fr/SDO/ias_export_hmi.cgi'
39 1 Guanji Wang
40 1 Guanji Wang
sdoformlocal='localhost:8184/sitools/datastorage/user/idoc_medoc/sdodownloadform.html'
41 1 Guanji Wang
sdoformtest='idoc-medoc-test.ias.u-psud.fr/sitools/datastorage/user/idoc_medoc/sdodownloadform.html'
42 1 Guanji Wang
43 1 Guanji Wang
44 1 Guanji Wang
sdo3datasource='jdbc:postgresql://sdo3.ias.u-psud.fr:5436'
45 1 Guanji Wang
sdodatasource='jdbc:postgresql://sdo.ias.u-psud.fr:5436'
46 1 Guanji Wang
47 1 Guanji Wang
48 1 Guanji Wang
sdo3metasource='jdbc:postgresql://sdo3:5432'
49 1 Guanji Wang
sdometasource='jdbc:postgresql://sdo:5432'
50 1 Guanji Wang
51 1 Guanji Wang
echo "Change cgi sdo3 to sdo"
52 1 Guanji Wang
53 1 Guanji Wang
find ./ -type f ! -name 'transfer_server_test.cmd' -exec sed -i -e "s|$sdo3_cgi|$sdo_cgi|g" {} \;
54 1 Guanji Wang
echo "Done modifier the path"
55 1 Guanji Wang
echo "Stupid changes begin"
56 1 Guanji Wang
57 1 Guanji Wang
find ./ -type f ! -name 'transfer_server_test.cmd' -exec sed -i -e "s|$sdoformlocal|$sdoformtest|g" {} \;
58 1 Guanji Wang
echo "Done modifier the sdo form host domain"
59 1 Guanji Wang
60 1 Guanji Wang
61 1 Guanji Wang
find ./ -type f ! -name 'transfer_server_test.cmd' -exec sed -i -e "s|$sdo3datasource|$sdodatasource|g" {} \;
62 1 Guanji Wang
echo "Done modifier the sdo data source"
63 1 Guanji Wang
64 1 Guanji Wang
65 1 Guanji Wang
66 1 Guanji Wang
find ./ -type f ! -name 'transfer_server_test.cmd' -exec sed -i -e "s|$sdo3metasource|$sdometasource|g" {} \;
67 1 Guanji Wang
echo "Done modifier meta data source"
68 1 Guanji Wang
69 1 Guanji Wang
echo "Stupid change finish"
70 1 Guanji Wang
</code></pre>
71 1 Guanji Wang
72 1 Guanji Wang
>6. Every time we restart sitools, the lastupdatedate element in all XML files will be updated, so don't forget to re-commit all the new changes.
73 1 Guanji Wang
74 1 Guanji Wang
75 1 Guanji Wang
>h2. B. In the test server:
76 1 Guanji Wang
77 1 Guanji Wang
>1. Check if the sitools will be restarted automatically in case of the cut of electricity. 
78 1 Guanji Wang
79 1 Guanji Wang
><pre><code class="python">
80 1 Guanji Wang
cat /etc/rc.local
81 1 Guanji Wang
</code></pre>
82 1 Guanji Wang
83 1 Guanji Wang
>!Selection_387.jpg!
84 1 Guanji Wang
85 1 Guanji Wang
>2. Stop the sitools project and git fetch the source: git fetch {repository} {branch}.
86 1 Guanji Wang
87 1 Guanji Wang
>3. Git pull:  If there are conflicts in XML, try to commit the conflicts and if it works, go to step5, if it doesn't work, go to step 4.
88 1 Guanji Wang
89 1 Guanji Wang
>4. Re-distribute sitools project by executing cmd in following production@idoc-medoc-test :   /home/production/scripts/Dev_To_Test_git_clone.cmd.
90 1 Guanji Wang
91 1 Guanji Wang
92 1 Guanji Wang
93 1 Guanji Wang
><pre><code class="javascript">
94 1 Guanji Wang
#!/bin/bash
95 1 Guanji Wang
96 1 Guanji Wang
NOW=$(date +"%Y-%m-%d")
97 1 Guanji Wang
98 1 Guanji Wang
SitoolsDirTest=/usr/local/Sitools2_solar
99 1 Guanji Wang
100 1 Guanji Wang
$SitoolsDirTest/workspace/fr.cnes.sitools.core/sitools stop
101 1 Guanji Wang
wait ${!}
102 1 Guanji Wang
103 1 Guanji Wang
#echo $SitoolsDirTest $SitoolsDirTest"_"$NOW
104 1 Guanji Wang
rm -Rf $SitoolsDirTest"_"$NOW
105 1 Guanji Wang
mv $SitoolsDirTest $SitoolsDirTest"_"$NOW
106 1 Guanji Wang
#mkdir /usr/local/Sitools2_solar
107 1 Guanji Wang
108 1 Guanji Wang
git clone https://gwang@git.ias.u-psud.fr/gwang/idoc-medoc-solar-portal.git -b test-server /usr/local/Sitools2_solar
109 1 Guanji Wang
#echo $USER@$HOSTNAME:$SitoolsDir/*
110 1 Guanji Wang
111 1 Guanji Wang
mkdir $SitoolsDirTest/data/resourses_logs_solar
112 1 Guanji Wang
113 1 Guanji Wang
$SitoolsDirTest/workspace/fr.cnes.sitools.core/sitools start
114 1 Guanji Wang
115 1 Guanji Wang
echo "Please erase old Sitools2_solar dir on disk "
116 1 Guanji Wang
Dev_To_Test_git_clone.cmd (END)
117 1 Guanji Wang
118 1 Guanji Wang
119 1 Guanji Wang
</code></pre>
120 1 Guanji Wang
121 1 Guanji Wang
122 1 Guanji Wang
>5. Restart the sitools project.
123 1 Guanji Wang
 
124 1 Guanji Wang
>6. Track the log, do simple test in idoc-medoc-test and have fun.
125 1 Guanji Wang
126 1 Guanji Wang
127 1 Guanji Wang
>h2.  C. ANNEXE: 
128 1 Guanji Wang
129 1 Guanji Wang
>1. The commits in the test-server branch - https://git.ias.u-psud.fr/gwang/idoc-medoc-solar-portal/commits/test-server 
130 1 Guanji Wang
131 1 Guanji Wang
>2. The whole project source code for test branch - https://git.ias.u-psud.fr/gwang/idoc-medoc-solar-portal/tree/test-server