소스 검색

Move pleroma to production config

Bob Mottram 7 년 전
부모
커밋
0982180705
1개의 변경된 파일12개의 추가작업 그리고 3개의 파일을 삭제
  1. 12
    3
      src/freedombone-app-pleroma

+ 12
- 3
src/freedombone-app-pleroma 파일 보기

227
         echo $"Missing directory $PLEROMA_DIR/config"
227
         echo $"Missing directory $PLEROMA_DIR/config"
228
         exit 7835393
228
         exit 7835393
229
     fi
229
     fi
230
-    pleroma_secret=$PLEROMA_DIR/config/dev.secret.exs
230
+    pleroma_secret=$PLEROMA_DIR/config/prod.secret.exs
231
     if [ ! -f $PLEROMA_DIR/config/dev.exs ]; then
231
     if [ ! -f $PLEROMA_DIR/config/dev.exs ]; then
232
         echo $"Did not find $PLEROMA_DIR/config/dev.exs"
232
         echo $"Did not find $PLEROMA_DIR/config/dev.exs"
233
         exit 78923528
233
         exit 78923528
234
     fi
234
     fi
235
+
235
     cp $PLEROMA_DIR/config/dev.exs $pleroma_secret
236
     cp $PLEROMA_DIR/config/dev.exs $pleroma_secret
236
     sed -i "s|username:.*|username: \"pleroma\",|g" $pleroma_secret
237
     sed -i "s|username:.*|username: \"pleroma\",|g" $pleroma_secret
237
     sed -i "s|password:.*|password: \"$PLEROMA_ADMIN_PASSWORD\",|g" $pleroma_secret
238
     sed -i "s|password:.*|password: \"$PLEROMA_ADMIN_PASSWORD\",|g" $pleroma_secret
272
         echo $'mix ecto.create failed'
273
         echo $'mix ecto.create failed'
273
         exit 83653582
274
         exit 83653582
274
     fi
275
     fi
275
-    sudo -u pleroma mix ecto.migrate --force
276
+    sudo -u pleroma MIX_ENV=prod mix ecto.migrate --force
276
     if [ ! "$?" = "0" ]; then
277
     if [ ! "$?" = "0" ]; then
277
         run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;"
278
         run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;"
278
         run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;"
279
         run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;"
279
         echo $'mix ecto.migrate failed'
280
         echo $'mix ecto.migrate failed'
280
         exit 73752573
281
         exit 73752573
281
     fi
282
     fi
283
+    sudo -u pleroma MIX_ENV=prod mix phx.digest --force
284
+    if [ ! "$?" = "0" ]; then
285
+        run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;"
286
+        run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;"
287
+        echo $'mix phx.digest failed'
288
+        exit 783529235
289
+    fi
282
 
290
 
283
     # revoke the ability to create databases for this user
291
     # revoke the ability to create databases for this user
284
     run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;"
292
     run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;"
878
 
886
 
879
     # We need to set up the url option again because it somehow gets
887
     # We need to set up the url option again because it somehow gets
880
     # lost during mix compile
888
     # lost during mix compile
881
-    pleroma_secret=$PLEROMA_DIR/config/dev.secret.exs
889
+    pleroma_secret=$PLEROMA_DIR/config/prod.secret.exs
882
     if ! grep -q 'watchers: [],' $pleroma_secret; then
890
     if ! grep -q 'watchers: [],' $pleroma_secret; then
883
         sed -i 's|watchers: []|watchers: [],|g' $pleroma_secret
891
         sed -i 's|watchers: []|watchers: [],|g' $pleroma_secret
884
     fi
892
     fi
899
     echo 'User=pleroma' >> /etc/systemd/system/pleroma.service
907
     echo 'User=pleroma' >> /etc/systemd/system/pleroma.service
900
     echo "WorkingDirectory=$PLEROMA_DIR" >> /etc/systemd/system/pleroma.service
908
     echo "WorkingDirectory=$PLEROMA_DIR" >> /etc/systemd/system/pleroma.service
901
     echo "Environment=\"HOME=$PLEROMA_DIR\"" >> /etc/systemd/system/pleroma.service
909
     echo "Environment=\"HOME=$PLEROMA_DIR\"" >> /etc/systemd/system/pleroma.service
910
+    echo "Environment=\"MIX_ENV=prod\"" >> /etc/systemd/system/pleroma.service
902
     echo 'ExecStart=/usr/local/bin/mix phx.server' >> /etc/systemd/system/pleroma.service
911
     echo 'ExecStart=/usr/local/bin/mix phx.server' >> /etc/systemd/system/pleroma.service
903
     echo 'ExecReload=/bin/kill $MAINPID' >> /etc/systemd/system/pleroma.service
912
     echo 'ExecReload=/bin/kill $MAINPID' >> /etc/systemd/system/pleroma.service
904
     echo 'KillMode=process' >> /etc/systemd/system/pleroma.service
913
     echo 'KillMode=process' >> /etc/systemd/system/pleroma.service