Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
origosys
stabile-stacks
Commits
0c754948
Commit
0c754948
authored
Jun 16, 2021
by
HQ
Browse files
Various improvements
parent
bf1fc026
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
discourse/files/stabile-discourse.pl
discourse/files/stabile-discourse.pl
+12
-7
No files found.
discourse/files/stabile-discourse.pl
View file @
0c754948
...
...
@@ -29,11 +29,6 @@ unless (-e '/etc/discourse.seeded') {
# print `perl -pi -e 's/(DocumentRoot .*)/\$1\\nProxyPass \\/ http:\\/\\/127.0.0.1:9292\\/\\nProxyPassReverse \\/ http:\\/\\/127.0.0.1:9292\\//g' /etc/apache2/sites-available/default-ssl.conf`;
# }
unless
(`
grep PassengerBase /etc/apache2/sites-available/default-ssl.conf
`)
{
print
`
perl -pi -e 's/(DocumentRoot .*)/DocumentRoot
\\
/var
\\
/discourse
\\
/public
\\
nRailsBaseURI
\\
/
\\
nPassengerBaseURI
\\
/
\\
nPassengerResolveSymlinksInDocumentRoot on
\\
nPassengerAppRoot
\\
/var
\\
/discourse
\\
n/g' /etc/apache2/sites-available/default-ssl.conf
`;
print
`
perl -pi -e 's/(DocumentRoot .*)/DocumentRoot
\\
/var
\\
/discourse
\\
/public
\\
nRailsBaseURI
\\
/
\\
nPassengerBaseURI
\\
/
\\
nPassengerResolveSymlinksInDocumentRoot on
\\
nPassengerAppRoot
\\
/var
\\
/discourse
\\
n/g' /etc/apache2/sites-available/000-default.conf
`;
}
print
`
echo "<h1 align=center><img width=48 height=48 src=https://www.stabile.io/images/apps/discourse_icon.png> Preparing Discourse...</h1><p align=center><img src=https://www.origo.io/images/39.svg></p><script>setTimeout(function(){location.reload() ; }, 8000);</script>" > /var/www/html/index.html
`;
print
`
sudo -u postgres psql -c "CREATE USER discourse;"
`;
print
`
sudo -u postgres psql -c "ALTER USER discourse WITH ENCRYPTED PASSWORD 'password';"
`;
...
...
@@ -46,7 +41,12 @@ unless (-e '/etc/discourse.seeded') {
`
perl -pi -e 's/hostname =.*/hostname =
$dom
/g' /var/discourse/config/discourse.conf
`;
`
perl -pi -e 's/smtp_domain =.*/smtp_domain =
$dom
/g' /var/discourse/config/discourse.conf
`;
`
perl -pi -e 's/myhostname =.*/myhostname =
$dom
/g' /var/discourse/config/discourse.conf
`;
print
`
sudo -u postgres psql discourse -c "UPDATE site_settings SET value = 'noreply
\
@
$dom
' WHERE name = 'notification_email';"
`;
# print `sudo -u postgres psql discourse -c "UPDATE site_settings SET value = 'noreply\@$dom' WHERE name = 'notification_email';"`;
# https://github.com/lautis/uglifier/issues/127
`
perl -pi -e 's/config
\
.assets
\
.js_compressor = :uglifier/config.assets.js_compressor = Uglifier.new(:harmony => true)/' /var/discourse/config/environments/production.rb
`;
`
perl -pi -e 's/Uglifier.new
\
(comments: :none,.*/Uglifier.new(comments: :none, harmony: true,/' /var/discourse/lib/tasks/assets.rake
`;
`
echo "require 'uglifier'" >> /var/discourse/Gemfile
`;
print
`
cd /var/discourse ; RAILS_ENV=production bundle exec rake db:migrate
`;
print
`
cd /var/discourse ; RAILS_ENV=production bundle exec rake assets:precompile
`;
...
...
@@ -60,9 +60,14 @@ unless (-e '/etc/discourse.seeded') {
chomp
$randpass
;
print
`
cd /var/discourse ; export RAILS_ENV=production; echo "
$email
\n
$randpass
\n
$randpass
\n
Y " | rake admin:create
`;
unless
(`
grep PassengerBase /etc/apache2/sites-available/default-ssl.conf
`)
{
print
`
perl -pi -e 's/(DocumentRoot .*)/DocumentRoot
\\
/var
\\
/discourse
\\
/public
\\
nRailsBaseURI
\\
/
\\
nPassengerBaseURI
\\
/
\\
nPassengerResolveSymlinksInDocumentRoot on
\\
nPassengerAppRoot
\\
/var
\\
/discourse
\\
n/g' /etc/apache2/sites-available/default-ssl.conf
`;
print
`
perl -pi -e 's/(DocumentRoot .*)/DocumentRoot
\\
/var
\\
/discourse
\\
/public
\\
nRailsBaseURI
\\
/
\\
nPassengerBaseURI
\\
/
\\
nPassengerResolveSymlinksInDocumentRoot on
\\
nPassengerAppRoot
\\
/var
\\
/discourse
\\
n/g' /etc/apache2/sites-available/000-default.conf
`;
}
`
chown -R www-data:www-data /var/www
`;
`
chown -R www-data:www-data /var/discourse
`;
`
perl -pi -e 's/PrivateTmp=true/PrivateTemp=false/' /lib/systemd/system/apache2.service
`;
`
systemctl restart postfix
`;
`
systemctl restart apache2
`;
`
touch /etc/discourse.seeded
`;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment