Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
bf08776f
Commit
bf08776f
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Handle rootdir
parent
44ba5c52
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-deploy-website
+16
-11
16 additions, 11 deletions
src/freedombone-deploy-website
with
16 additions
and
11 deletions
src/freedombone-deploy-website
+
16
−
11
View file @
bf08776f
...
...
@@ -35,13 +35,18 @@ CONFIGURATION_FILE=/root/${PROJECT_NAME}.cfg
ONION_ONLY
=
'no'
site_domain
=
${
PROJECT_NAME
}
.net
site_onion_port
=
8149
rootdir
=
if
[
"
$1
"
]
;
then
site_domain
=
"
$1
"
if
[[
"
$site_domain
"
==
'/tmp/'
*
]]
;
then
rootdir
=
/tmp/
$(
echo
-n
"
$site_domain
"
|
awk
-F
'/'
'{print $3}'
)
CONFIGURATION_FILE
=
"
$rootdir
/root/
${
PROJECT_NAME
}
.cfg"
fi
fi
if
[
!
-d
/root/
${
PROJECT_NAME
}
/website
]
;
then
echo
"Directory not found /root/
${
PROJECT_NAME
}
/website"
if
[
!
-d
"
$rootdir
/root/
${
PROJECT_NAME
}
/website
"
]
;
then
echo
"Directory not found
$rootdir
/root/
${
PROJECT_NAME
}
/website"
exit
1
fi
...
...
@@ -53,7 +58,7 @@ if [[ "$ONION_ONLY" != 'no' ]]; then
site_domain
=
${
PROJECT_NAME
}
_web
fi
dest_dir
=
"/var/www/
${
site_domain
}
/htdocs"
dest_dir
=
"
$rootdir
/var/www/
${
site_domain
}
/htdocs"
if
[[
"
${
site_domain
}
"
==
*
'/help'
]]
;
then
dest_dir
=
"
${
site_domain
}
"
...
...
@@ -64,14 +69,14 @@ if [ ! -d "$dest_dir" ]; then
mkdir
-p
"
$dest_dir
"
fi
if
!
grep
-q
":
$site_onion_port
"
/etc/torrc.d/
${
PROJECT_NAME
}
;
then
if
!
grep
-q
":
$site_onion_port
"
"
$rootdir
/etc/torrc.d/
${
PROJECT_NAME
}
"
;
then
{
echo
"HiddenServiceDir /var/lib/tor/hidden_service_
${
PROJECT_NAME
}
/"
;
echo
'HiddenServiceVersion 3'
;
echo
"HiddenServicePort 80 127.0.0.1:
${
site_onion_port
}
"
;
}
>>
/etc/torrc.d/
${
PROJECT_NAME
}
echo
"HiddenServicePort 80 127.0.0.1:
${
site_onion_port
}
"
;
}
>>
"
$rootdir
/etc/torrc.d/
${
PROJECT_NAME
}
"
systemctl restart tor
fi
site_onion_domain
=
$(
cat
/var/lib/tor/hidden_service_
${
PROJECT_NAME
}
/hostname
)
site_onion_domain
=
$(
cat
"
$rootdir
/var/lib/tor/hidden_service_
${
PROJECT_NAME
}
/hostname
"
)
if
[[
"
$ONION_ONLY
"
==
'no'
]]
;
then
{
echo
'server {'
;
...
...
@@ -195,9 +200,9 @@ if [[ "$ONION_ONLY" == 'no' ]]; then
echo
" proxy_set_header X-Forwarded-For
\$
remote_addr;"
;
echo
' }'
;
echo
'}'
;
echo
''
;
}
>
/etc/nginx/sites-available/
${
site_domain
}
echo
''
;
}
>
"
$rootdir
/etc/nginx/sites-available/
${
site_domain
}
"
else
echo
-n
''
>
/etc/nginx/sites-available/
${
site_domain
}
echo
-n
''
>
"
$rootdir
/etc/nginx/sites-available/
${
site_domain
}
"
fi
{
echo
'server {'
;
...
...
@@ -258,12 +263,12 @@ fi
echo
" proxy_set_header X-Forwarded-For
\$
remote_addr;"
;
echo
' }'
;
echo
'}'
;
echo
'# End of TURN Server'
;
}
>>
/etc/nginx/sites-available/
${
site_domain
}
echo
'# End of TURN Server'
;
}
>>
"
$rootdir
/etc/nginx/sites-available/
${
site_domain
}
"
nginx_ensite
${
site_domain
}
if
[[
"
$ONION_ONLY
"
==
'no'
]]
;
then
if
[
!
-f
"/etc/letsencrypt/live/
${
site_domain
}
/fullchain.pem"
]
;
then
if
[
!
-f
"
$rootdir
/etc/letsencrypt/live/
${
site_domain
}
/fullchain.pem"
]
;
then
DH_KEYLENGTH
=
2048
LETSENCRYPT_SERVER
=
'https://acme-v01.api.letsencrypt.org/directory'
${
PROJECT_NAME
}
-addcert
-e
"
${
site_domain
}
"
-s
"
$LETSENCRYPT_SERVER
"
--dhkey
"
$DH_KEYLENGTH
"
...
...
@@ -274,7 +279,7 @@ if [ ! "$lang" ]; then
lang
=
'EN'
fi
cd
/root/
${
PROJECT_NAME
}
/website
||
exit
2
cd
"
$rootdir
/root/
${
PROJECT_NAME
}
/website
"
||
exit
2
if
[
!
-d
"
$dest_dir
"
]
;
then
mkdir
-p
"
$dest_dir
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment