507
edits
No edit summary Tag: 2017 source edit |
Tag: 2017 source edit |
||
| (13 intermediate revisions by 2 users not shown) | |||
| Line 408: | Line 408: | ||
To download attachments from previous forum, start by export the URLs from the Kunena database. | To download attachments from previous forum, start by export the URLs from the Kunena database. | ||
< | <syntaxhighlight lang="SQL"> | ||
SELECT CONCAT('https://www.dolibarr.fr/', folder, '/', filename) AS url FROM gvrsi_kunena_attachments ORDER BY id; | SELECT CONCAT('https://www.dolibarr.fr/', folder, '/', filename) AS url FROM gvrsi_kunena_attachments ORDER BY id; | ||
</ | </syntaxhighlight> | ||
Put all the URLs into a text file (for example <code>uploads.txt</code>). | Put all the URLs into a text file (for example <code>uploads.txt</code>). | ||
| Line 416: | Line 416: | ||
Next, use <code>wget</code> to download all attachment preserving the directory structure (yuuup, file names of multiple distinct attachments can be the same ...) | Next, use <code>wget</code> to download all attachment preserving the directory structure (yuuup, file names of multiple distinct attachments can be the same ...) | ||
< | <syntaxhighlight lang="bash"> | ||
wget --no-host-directories --force-directories --input-file=uploads.txt | wget --no-host-directories --force-directories --input-file=uploads.txt | ||
</ | </syntaxhighlight> | ||
===Permalinks=== | ===Permalinks=== | ||
| Line 454: | Line 454: | ||
This code is to paste in the <code>Admin → Customize → Themes → Light → Edit CSS/HTML → Common → </head></code> section. | This code is to paste in the <code>Admin → Customize → Themes → Light → Edit CSS/HTML → Common → </head></code> section. | ||
< | <syntaxhighlight lang="HTML"> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
var urlSplit = document.URL.split("#"); | var urlSplit = document.URL.split("#"); | ||
| Line 461: | Line 461: | ||
} | } | ||
</script> | </script> | ||
</ | </syntaxhighlight> | ||
===Ads=== | ===Ads=== | ||
| Line 871: | Line 871: | ||
*[https://fr.mailjet.com/ Mailjet] pricing, [https://fr.mailjet.com/pricing/ first 6 000 monthly emails free (no more than 200 email per day ; 30 000 per month for 7,16€]) | *[https://fr.mailjet.com/ Mailjet] pricing, [https://fr.mailjet.com/pricing/ first 6 000 monthly emails free (no more than 200 email per day ; 30 000 per month for 7,16€]) | ||
*[https://aws.amazon.com/fr/ses/ AWS SES (Amazon Web Services Simple Email Service)] pricing, [https://aws.amazon.com/fr/ses/pricing/ 0.10$ per 1 000 emails]. | *[https://aws.amazon.com/fr/ses/ AWS SES (Amazon Web Services Simple Email Service)] pricing, [https://aws.amazon.com/fr/ses/pricing/ 0.10$ per 1 000 emails]. | ||
*[https://sendgrid.net/ SendGrid] pricing, Free for 100 emails per day or 14$ per month for 40 0000 emails. | |||
|} | |} | ||
| Line 882: | Line 884: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
/var/discourse/launcher enter web_only | |||
# Install required dependencies to import data (gems) | # Install required dependencies to import data (gems) | ||
su discourse -c | su discourse -c "export IMPORT=1; bundle config unset deployment; bundle config set path 'vendor/bundle'; bundle config set without 'test development'; bundle install --jobs 4" | ||
# Run import script | # Run import script | ||
su discourse -c 'export IMPORT=1; bundle exec ruby script/import_scripts/ | su discourse -c 'export IMPORT=1; cp /scripts/kunena3_dolibarr_de.rb /var/www/discourse/script/import_scripts/kunena3_dolibarr_de.rb; bundle exec ruby /var/www/discourse/script/import_scripts/kunena3_dolibarr_de.rb' | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==== | Note : | ||
====Restore Discourse backup from command line==== | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
/var/discourse/launcher enter web_only | |||
su discourse -c 'bundle exec ruby script/discourse restore forum-dolibarr-france-2019-08-07-080937-v20190731090219.tar' | su discourse -c 'bundle exec ruby script/discourse restore forum-dolibarr-france-2019-08-07-080937-v20190731090219.tar' | ||
</syntaxhighlight> | </syntaxhighlight> | ||
You must of course replace <code>forum-dolibarr-france-2019-08-07-080937-v20190731090219.tar</code> by the backup filename to restore. | You must of course replace <code>forum-dolibarr-france-2019-08-07-080937-v20190731090219.tar</code> by the backup filename to restore. | ||
Note : to restore a save from a multisite install that is not the main (first) database, prepend the command by <code>RAILS_DB=dolibarrde</code> where <code>dolibarrde</code> is the name of the database : | |||
<syntaxhighlight lang="bash"> | |||
/var/discourse/launcher enter web_only | |||
su discourse -c 'RAILS_DB=dolibarrde bundle exec ruby script/discourse restore dolibarr-germany-forum-2020-08-16-163120-v20200814081437.sql.gz' | |||
</syntaxhighlight> | |||
===Docker tips and tricks=== | ===Docker tips and tricks=== | ||
| Line 908: | Line 919: | ||
The default mount point for all persisted data related to Discourse is through | The default mount point for all persisted data related to Discourse is through | ||
<code>/var/discourse/shared/ | <code>/var/discourse/shared/data</code> and <code>/var/discourse/shared/web-only</code> | ||
===PostgreSQL tips and tricks=== | ===PostgreSQL tips and tricks=== | ||
| Line 917: | Line 927: | ||
''Useful to be able to access the database from a graphical client (like pgAdmin 4, TablePlus or Postico for example).'' | ''Useful to be able to access the database from a graphical client (like pgAdmin 4, TablePlus or Postico for example).'' | ||
1. Expose the 5432 TCP port from the container to the host by adding this line to the '''<code>expose:</code>''' section of <code>containers/app.yml</code> : | 1. Expose the 5432 TCP port from the container to the host by adding this line to the '''<code>expose:</code>''' section of <code>/var/discourse/containers/app.yml</code> : | ||
<syntaxhighlight lang="yaml"> | <syntaxhighlight lang="yaml"> | ||
- "5432:5432" | - "5432:5432" | ||
| Line 923: | Line 933: | ||
2. Rebuild the container to take into account modifications to '''<code>app.yml</code>''' : | 2. Rebuild the container to take into account modifications to '''<code>app.yml</code>''' : | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
./launcher rebuild | cd /var/discourse | ||
./launcher rebuild data | |||
</syntaxhighlight> | </syntaxhighlight> | ||
3. Enter into the container, login as the default postgresql user, add a new user and grant it all perms to the database | 3. Enter into the container, login as the default postgresql user, add a new user and grant it all perms to the database | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
./launcher enter | cd /var/discourse | ||
./launcher enter data | |||
sudo -u postgres psql discourse | sudo -u postgres psql discourse | ||
</syntaxhighlight> | </syntaxhighlight> | ||