Skip to content

Commit

Permalink
Merge github.com:SWI-Prolog/swish
Browse files Browse the repository at this point in the history
  • Loading branch information
friguzzi committed Jan 3, 2024
2 parents 6f9995d + 24fb445 commit 36079d5
Show file tree
Hide file tree
Showing 56 changed files with 6,480 additions and 3,940 deletions.
2 changes: 2 additions & 0 deletions config-available/clpBNR.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:- module(swish_config_clpBNR, []).
:- use_module(library(clpBNR)).
79 changes: 79 additions & 0 deletions config-available/redis.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* Part of SWISH
Author: Jan Wielemaker
E-mail: [email protected]
WWW: http://www.swi-prolog.org
Copyright (C): 2020, SWI-Prolog Solutions b.v.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/

:- module(config_redis, []).

/** <module> Configure Redis
SWISH may be configured to use the Redis key-value store for the various
databases. This allows multiple SWISH instances to act as a cluster.
Typically the configuration needs to be edited in two places:
- redis_server/3 must be called to address the Redis server
- redis_consumer may be set to identify this instance. The
default is derived from the host name and port to which
this SWISH instance listens. Clusters are advised to
assign a stable name to each cluster member.
*/

:- multifile swish_config:config/2.

% Do not activate if `config(redis,false)` is present
:- if(\+swish_config:config(ide,true)).

:- use_module(swish(lib/config), []).
:- use_module(library(redis)).
:- use_module(library(settings)).
:- use_module(swish('config-available/user_profile')).
:- use_module(library(profile/backend/profile_redis), []).
:- use_module(library(http/http_session)).
:- use_module(library(http/http_redis_plugin)).

:- redis_server(swish, localhost:6379, []).

swish_config:config(redis, swish).
swish_config:config(redis_prefix, swish).
%swish_config:config(redis_consumer, peter).

:- set_setting(user_profile:redis_server, swish).
:- set_setting(user_profile:redis_prefix, 'swish:profiles').
:- set_setting(user_profile:backend, impl_profile_redis).
:- set_setting(user_profile:session_persistency, true).

:- http_set_session_options([ redis_db(swish),
redis_prefix('swish:http:session')
]).

:- endif. % \+swish_config:config(ide,true)
2 changes: 1 addition & 1 deletion config-available/user_profile.pl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
:- use_module(swish(lib/plugin/profile)).

:- set_setting(user_profile:backend, impl_profile_prolog).
:- initialization profile_open_db([]).
:- listen(http(pre_server_start), profile_open_db([])).

/** <module> User profile configuration
Expand Down
4 changes: 2 additions & 2 deletions examples/stats.swinb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="nb-cell markdown" name="md1">
# Display SWISH server statistics

This page examines the performance and health of the SWISH server. Most of the statistics are gathered by `lib/swish_debug`, which is by default loaded into http://swish.swi-prolog.org but must be explicitly loaded into your own SWISH server. Part of the statistics are based on reading the Linux =|/proc|= file system and thus only function on Linux.
This page examines the performance and health of the SWISH server. Most of the statistics are gathered by `lib/swish_diagnostics`, which is by default loaded into http://swish.swi-prolog.org but must be explicitly loaded into your own SWISH server. Part of the statistics are based on reading the Linux =|/proc|= file system and thus only function on Linux.

The first step is easy, showing the overall statistics of the server.
</div>
Expand Down Expand Up @@ -184,7 +184,7 @@ chart(Period, [pengines,threads,visitors], Chart).
as <code>fordblks</code>. Note that <code>fordblks</code> is a 32-bit value. The implementation heuristically
guesses how many times the value wrapped around and corrects for this.
</p>

<div class="panel-body"><i><i>
<div class="form-group row" style="margin-bottom:0px">
<label class="col-sm-2">Period:</label>
Expand Down
1 change: 1 addition & 0 deletions ide.pl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@

user:file_search_path(project, '.').

swish_config:config(ide, true).
swish_config:config(show_beware, false).
swish_config:config(community_examples, true).

Expand Down
Loading

0 comments on commit 36079d5

Please sign in to comment.