mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-22 07:30:24 +00:00
apphub
This commit is contained in:
parent
7b3a0cc4ae
commit
508cfbbf28
5 changed files with 38 additions and 40 deletions
|
@ -5,10 +5,12 @@ user_name = help@websoft9.com
|
||||||
user_pwd = E3cMekM72yPp1pUX
|
user_pwd = E3cMekM72yPp1pUX
|
||||||
nike_name = admin
|
nike_name = admin
|
||||||
|
|
||||||
#The config for gitea
|
#The config for gitea.
|
||||||
|
# entrypoint.sh will get the user_name and email default value,it mean these must the gitea default
|
||||||
[gitea]
|
[gitea]
|
||||||
base_url = http://websoft9-git:3000/api/v1
|
base_url = http://websoft9-git:3000/api/v1
|
||||||
user_name = websoft9
|
user_name = websoft9
|
||||||
|
email = help@websoft9.com
|
||||||
user_pwd = RilXTqVRvEvU
|
user_pwd = RilXTqVRvEvU
|
||||||
|
|
||||||
#The config for portainer
|
#The config for portainer
|
||||||
|
|
|
@ -48,5 +48,6 @@ RUN rm -rf apphub/docs apphub/tests library.zip plugin-appstore && \
|
||||||
apt clean && \
|
apt clean && \
|
||||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc /usr/share/doc-base
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc /usr/share/doc-base
|
||||||
|
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -1,44 +1,39 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# check credentials exists
|
|
||||||
check_file_exists() {
|
|
||||||
file_path=$1
|
|
||||||
max_attempts=$2
|
|
||||||
|
|
||||||
for ((i=1; i<=max_attempts; i++))
|
|
||||||
do
|
|
||||||
if [ -f "$file_path" ]; then
|
|
||||||
echo "$file_path exists"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
echo "$file_path is not exists, wait a moment.."
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
if ((i==max_attempts)); then
|
|
||||||
echo "$file_path is not exists, app may be work normally."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
set +e
|
|
||||||
check_file_exists "/websoft9/credentials/credential_proxy" 1
|
|
||||||
check_file_exists "/websoft9/credentials/credential_deployment" 1
|
|
||||||
check_file_exists "/websoft9/credentials/credential_git" 1
|
|
||||||
|
|
||||||
# set git user and email
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
username=$(jq -r '.username' /websoft9/credentials/credential_git)
|
|
||||||
email=$(jq -r '.email' /websoft9/credentials/credential_git)
|
|
||||||
else
|
|
||||||
echo "Git set with default value"
|
|
||||||
username="websoft9"
|
|
||||||
email="help@websoft9.com"
|
|
||||||
fi
|
|
||||||
git config --global user.name "$username"
|
|
||||||
git config --global user.email "$email"
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
try_times=3
|
||||||
|
# set git user and email
|
||||||
|
for ((i=0; i<$try_times; i++)); do
|
||||||
|
(
|
||||||
|
username=$(apphub getconfig --section gitea --key user_name)
|
||||||
|
email=$(apphub getconfig --section gitea --key email)
|
||||||
|
) || true
|
||||||
|
if [ -n "$username" ] && [ -n "$email" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo "Command failed, retrying..."
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $username
|
||||||
|
echo $email
|
||||||
|
|
||||||
|
if [[ -n "$username" ]]; then
|
||||||
|
git config --global user.name "$username"
|
||||||
|
else
|
||||||
|
echo "username is null"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
regex="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
|
||||||
|
if [[ $email =~ $regex ]]; then
|
||||||
|
git config --global user.email "$email"
|
||||||
|
else
|
||||||
|
echo "Not have correct email"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# start by supervisord
|
# start by supervisord
|
||||||
/usr/bin/supervisord
|
/usr/bin/supervisord
|
||||||
supervisorctl start apphub
|
supervisorctl start apphub
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Websoft9 Linux AppStore
|
Description=Websoft9 Linux AppStore
|
||||||
Requires=network.target docker
|
Requires=network.target docker.service
|
||||||
After=network.target docker.service
|
After=network.target docker.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "0.8.26",
|
"version": "0.8.26-rc34",
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"portainer": "0.0.6",
|
"portainer": "0.0.6",
|
||||||
"nginx": "0.0.5",
|
"nginx": "0.0.5",
|
||||||
|
|
Loading…
Reference in a new issue