Skip to content

Commit 141844a

Browse files
committed
improve installation instructions for macos
fixes #707
1 parent 2281e1f commit 141844a

File tree

4 files changed

+33
-24
lines changed

4 files changed

+33
-24
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
select 'redirect' as component, '/examples/tabs' as link;

examples/official-site/your-first-sql-website/index.sql

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@ SELECT 'hero' as component,
2020
when 'windows' then 'get_started_windows.webp'
2121
else 'get_started.webp'
2222
end as image,
23-
'https://github.com/lovasoa/SQLpage/releases'|| case
24-
when $os = 'windows' then '/latest/download/sqlpage-windows.zip'
25-
when $os = 'linux' then '/latest/download/sqlpage-linux.tgz'
26-
else ''
27-
end as link,
28-
'Download SQLPage' || case
29-
when $os = 'windows' then ' for Windows'
30-
when $os = 'linux' then ' for Linux'
31-
else ''
32-
end as link_text;
23+
CASE $os
24+
WHEN 'macos' THEN '#download'
25+
WHEN 'windows' THEN 'https://github.com/lovasoa/SQLpage/releases/latest/download/sqlpage-windows.zip'
26+
WHEN 'linux' THEN 'https://github.com/lovasoa/SQLpage/releases/latest/download/sqlpage-linux.tgz'
27+
ELSE 'https://github.com/lovasoa/SQLpage/releases'
28+
END AS link,
29+
CASE $os
30+
WHEN 'macos' THEN 'Install SQLPage using Homebrew'
31+
WHEN 'windows' THEN 'Download SQLPage for Windows'
32+
WHEN 'linux' THEN 'Download SQLPage for Linux'
33+
ELSE 'Download SQLPage'
34+
END AS link_text;
3335

3436
SELECT 'alert' as component,
3537
'Afraid of the setup ? Do it the easy way !' as title,
@@ -55,4 +57,4 @@ select 'text' as component, sqlpage.read_file_as_text(printf('your-first-sql-web
5557
else 'any'
5658
end
5759
)) as contents_md, 'download' as id;
58-
select 'text' as component, sqlpage.read_file_as_text('your-first-sql-website/tutorial.md') as contents_md;
60+
select 'text' as component, sqlpage.read_file_as_text('your-first-sql-website/tutorial.md') as contents_md;

examples/official-site/your-first-sql-website/tutorial-install-macos.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ sqlpage
1010
```
1111

1212
> **Note**: Advanced users can alternatively install SQLPage using
13+
> [the precompiled binaries](https://github.com/lovasoa/SQLpage/releases/latest),
1314
> [docker](https://hub.docker.com/repository/docker/lovasoa/sqlpage/general),
1415
> [nix](https://search.nixos.org/packages?channel=unstable&show=sqlpage),
1516
> or [cargo](https://crates.io/crates/sqlpage).

examples/official-site/your-first-sql-website/tutorial.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
Create a folder on your computer where you will store all contents related to your sql website.
44
In the rest of this tutorial, we will call this folder the **root folder** of your website.
55

6-
Open the file you downloaded above, and place `sqlpage.bin` (if you are on linux or Mac OS)
7-
or `sqlpage.exe` at the root of the folder.
6+
- On **Windows**, place the `sqlpage.exe` you downloaded above at the root of the folder. Then double-click the `sqlpage.exe` file to start the server.
7+
- On **Linux**, place `sqlpage.bin` at the root of the folder. Then open a terminal, cd to the root folder of your website, and run `./sqlpage.bin` to start the server.
8+
- On **Mac OS**, if you installed SQLPage using Homebrew, then you do not need to place anything at the root of the folder. Open Terminal, cd to the root folder of your website, and type `sqlpage` to start the server.
89

9-
Then launch the `sqlpage.bin` executable file you just downloaded in a terminal from this folder.
10-
11-
![screenshot for the sql website setup](first-sql-website-launch.png)
10+
![screenshot for the sql website setup on linux](first-sql-website-launch.png)
1211

1312
You should see a message in your terminal that includes the sentence `accessible from the network, and locally on http://localhost:8080`
1413

1514
You can open your website locally by visiting [`http://localhost:8080`](http://localhost:8080)
1615

16+
SQLPage should have automatically created a folder called `sqlpage` with a SQLite database file named `sqlpage.db`. This is your website's default database - don't worry, we'll learn how to connect to other databases like PostgreSQL, MySQL, or SQL Server later!
17+
1718
# Your website’s first SQL file
1819

1920
In the root folder of your SQLPage website, create a new SQL file called `index.sql`.
@@ -81,13 +82,16 @@ If you then deploy your website online using a service like [DataPage.app](https
8182

8283
Later, when you want to deploy your website online, you can switch back to a persistent database like
8384

84-
- a SQLite file with `sqlite://your-database-file.db` ([see options](https://docs.rs/sqlx/0.6.3/sqlx/sqlite/struct.SqliteConnectOptions.html#main-content)),
85-
- a PostgreSQL-compatible server with `postgres://user:password@host/database` ([see options](https://www.postgresql.org/docs/15/libpq-connect.html#id-1.7.3.8.3.6)),
86-
- a MySQL-compatible server with `mysql://user:password@host/database` ([see options](https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html)),
87-
- a Microsoft SQL Server with `mssql://user:password@host/database` ([see options](https://docs.rs/sqlx-oldapi/latest/sqlx_oldapi/mssql/struct.MssqlConnectOptions.html), [note about named instances](https://github.com/lovasoa/SQLpage/issues/92)),
85+
- a SQLite file with `sqlite://your-database-file.db` ([see options](https://docs.rs/sqlx-oldapi/latest/sqlx_oldapi/sqlite/struct.SqliteConnectOptions.html)),
86+
- a PostgreSQL-compatible server with `postgres://user:password@host/database` ([see options](https://docs.rs/sqlx-oldapi/latest/sqlx_oldapi/postgres/struct.PgConnectOptions.html)),
87+
- a MySQL-compatible server with `mysql://user:password@host/database` ([see options](https://docs.rs/sqlx-oldapi/latest/sqlx_oldapi/mysql/struct.MySqlConnectOptions.html)),
88+
- a Microsoft SQL Server with `mssql://user:password@host/database` ([see options](https://docs.rs/sqlx-oldapi/latest/sqlx_oldapi/mssql/struct.MssqlConnectOptions.html#method.from_str), [note about named instances](https://github.com/lovasoa/SQLpage/issues/92)),
89+
90+
> If `user` or `password` **contains special characters**, you should [**percent-encode**](https://en.wikipedia.org/wiki/Percent-encoding) them.
91+
>
92+
> For instance, a SQL Server database named `db` running on `localhost` port `1433` with the username `funny:user` and the password `p@ssw0rd` would be represented as
93+
> `mssql://funny%3Auser:p%40ssw0rd@localhost:1433/db`.
8894
89-
If `user` or `password` contains special characters, you should [percent-encode](https://en.wikipedia.org/wiki/Percent-encoding) them.
90-
For instance, a SQL Server database named `db` running on `localhost` port `1433` with the username `funny:user` and the password `p@ssw0rd` would be represented as `mssql://funny%3Auser:p%40ssw0rd@localhost:1433/db`.
9195
For more information about the properties that can be set in sqlpage.json, see [SQLPage's configuration documentation](https://github.com/lovasoa/SQLpage/blob/main/configuration.md#configuring-sqlpage)
9296

9397
![screenshot for the full sql website folder organisation](full-website.png)
@@ -103,7 +107,8 @@ SELECT 'form' AS component, 'Add a user' AS title;
103107
SELECT 'Username' as name, TRUE as required;
104108
```
105109

106-
The snippet above uses the [`form` component](https://sql.datapage.app/documentation.sql?component=form#component) to display a form on your website.
110+
The first SELECT statement opens the [`form` component](https://sql.datapage.app/component.sql?component=form).
111+
The second SELECT statement adds a field to the form. Since we do not specify a `type`, it will be a text field. The label displayed above the field will be the same as its name by default.
107112

108113
### Handling form submission
109114

@@ -160,7 +165,7 @@ Here is a screenshot of the final result:
160165

161166
![final result](final-result.png)
162167

163-
To go further, have a look at [the examples section of our Github repository](https://github.com/lovasoa/SQLpage/tree/main/examples).
168+
To go further, have a look at [the examples](../examples/).
164169

165170

166171
# Deploy your SQLPage website online

0 commit comments

Comments
 (0)