Project

General

Profile

Update TEST server - pdocution@idoc-medoc-test » History » Version 1

Guanji Wang, 11/08/2017 17:44

1 1 Guanji Wang
h1. Update TEST server - pdocution@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 1 Guanji Wang
    
12 1 Guanji Wang
>3. Git checkout 'test-server' branch, git cherry-pick the commit ID which are used in test server.
13 1 Guanji Wang
14 1 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.
15 1 Guanji Wang
16 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)
17 1 Guanji Wang
18 1 Guanji Wang
19 1 Guanji Wang
><pre><code class="javascript">
20 1 Guanji Wang
  #!/bin/bash
21 1 Guanji Wang
echo "This is a shell to replace the host name in datasets or preference or sdodownload form url etc.."  
22 1 Guanji Wang
23 1 Guanji Wang
sdo3_cgi='sdo3.ias.u-psud.fr/VSO/DRMS/cgi-bin/ias_export_hmi.cgi'
24 1 Guanji Wang
sdo_cgi='sdo.ias.u-psud.fr/SDO/ias_export_hmi.cgi'
25 1 Guanji Wang
26 1 Guanji Wang
sdoformlocal='localhost:8184/sitools/datastorage/user/idoc_medoc/sdodownloadform.html'
27 1 Guanji Wang
sdoformtest='idoc-medoc-test.ias.u-psud.fr/sitools/datastorage/user/idoc_medoc/sdodownloadform.html'
28 1 Guanji Wang
29 1 Guanji Wang
30 1 Guanji Wang
sdo3datasource='jdbc:postgresql://sdo3.ias.u-psud.fr:5436'
31 1 Guanji Wang
sdodatasource='jdbc:postgresql://sdo.ias.u-psud.fr:5436'
32 1 Guanji Wang
33 1 Guanji Wang
34 1 Guanji Wang
sdo3metasource='jdbc:postgresql://sdo3:5432'
35 1 Guanji Wang
sdometasource='jdbc:postgresql://sdo:5432'
36 1 Guanji Wang
37 1 Guanji Wang
echo "Change cgi sdo3 to sdo"
38 1 Guanji Wang
39 1 Guanji Wang
find ./ -type f ! -name 'transfer_server_test.cmd' -exec sed -i -e "s|$sdo3_cgi|$sdo_cgi|g" {} \;
40 1 Guanji Wang
echo "Done modifier the path"
41 1 Guanji Wang
echo "Stupid changes begin"
42 1 Guanji Wang
43 1 Guanji Wang
find ./ -type f ! -name 'transfer_server_test.cmd' -exec sed -i -e "s|$sdoformlocal|$sdoformtest|g" {} \;
44 1 Guanji Wang
echo "Done modifier the sdo form host domain"
45 1 Guanji Wang
46 1 Guanji Wang
47 1 Guanji Wang
find ./ -type f ! -name 'transfer_server_test.cmd' -exec sed -i -e "s|$sdo3datasource|$sdodatasource|g" {} \;
48 1 Guanji Wang
echo "Done modifier the sdo data source"
49 1 Guanji Wang
50 1 Guanji Wang
51 1 Guanji Wang
52 1 Guanji Wang
find ./ -type f ! -name 'transfer_server_test.cmd' -exec sed -i -e "s|$sdo3metasource|$sdometasource|g" {} \;
53 1 Guanji Wang
echo "Done modifier meta data source"
54 1 Guanji Wang
55 1 Guanji Wang
echo "Stupid change finish"
56 1 Guanji Wang
</code></pre>
57 1 Guanji Wang
58 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.
59 1 Guanji Wang
60 1 Guanji Wang
61 1 Guanji Wang
>h2. B. In the test server:
62 1 Guanji Wang
63 1 Guanji Wang
>1. Check if the sitools will be restarted automatically in case of the cut of electricity. 
64 1 Guanji Wang
65 1 Guanji Wang
><pre><code class="python">
66 1 Guanji Wang
cat /etc/rc.local
67 1 Guanji Wang
</code></pre>
68 1 Guanji Wang
69 1 Guanji Wang
>!Selection_387.jpg!
70 1 Guanji Wang
71 1 Guanji Wang
>2. Stop the sitools project and git fetch the source: git fetch {repository} {branch}.
72 1 Guanji Wang
73 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.
74 1 Guanji Wang
75 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.
76 1 Guanji Wang
77 1 Guanji Wang
78 1 Guanji Wang
79 1 Guanji Wang
><pre><code class="javascript">
80 1 Guanji Wang
#!/bin/bash
81 1 Guanji Wang
82 1 Guanji Wang
NOW=$(date +"%Y-%m-%d")
83 1 Guanji Wang
84 1 Guanji Wang
SitoolsDirTest=/usr/local/Sitools2_solar
85 1 Guanji Wang
86 1 Guanji Wang
$SitoolsDirTest/workspace/fr.cnes.sitools.core/sitools stop
87 1 Guanji Wang
wait ${!}
88 1 Guanji Wang
89 1 Guanji Wang
#echo $SitoolsDirTest $SitoolsDirTest"_"$NOW
90 1 Guanji Wang
rm -Rf $SitoolsDirTest"_"$NOW
91 1 Guanji Wang
mv $SitoolsDirTest $SitoolsDirTest"_"$NOW
92 1 Guanji Wang
#mkdir /usr/local/Sitools2_solar
93 1 Guanji Wang
94 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
95 1 Guanji Wang
#echo $USER@$HOSTNAME:$SitoolsDir/*
96 1 Guanji Wang
97 1 Guanji Wang
mkdir $SitoolsDirTest/data/resourses_logs_solar
98 1 Guanji Wang
99 1 Guanji Wang
$SitoolsDirTest/workspace/fr.cnes.sitools.core/sitools start
100 1 Guanji Wang
101 1 Guanji Wang
echo "Please erase old Sitools2_solar dir on disk "
102 1 Guanji Wang
Dev_To_Test_git_clone.cmd (END)
103 1 Guanji Wang
104 1 Guanji Wang
105 1 Guanji Wang
</code></pre>
106 1 Guanji Wang
107 1 Guanji Wang
108 1 Guanji Wang
>5. Restart the sitools project.
109 1 Guanji Wang
 
110 1 Guanji Wang
>6. Track the log, do simple test in idoc-medoc-test and have fun.
111 1 Guanji Wang
112 1 Guanji Wang
113 1 Guanji Wang
>h2.  C. ANNEXE: 
114 1 Guanji Wang
115 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 
116 1 Guanji Wang
117 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