2019-04-16 15:06:26 +00:00
|
|
|
# Development Setup
|
|
|
|
|
|
|
|
Ready to hack on your site? Here's a quick overview.
|
|
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
2024-02-02 15:50:48 +00:00
|
|
|
* [Go 1.19+](https://golang.org/dl/)
|
|
|
|
* [Node.js 15+](https://nodejs.org/en/download/)
|
2019-04-16 15:06:26 +00:00
|
|
|
|
2020-04-21 17:32:39 +00:00
|
|
|
## Quick start
|
2019-04-16 15:06:26 +00:00
|
|
|
|
2019-06-04 16:24:41 +00:00
|
|
|
After installing Go and Node.js, run the following commands to build, configure, and run the application.
|
2019-04-16 15:06:26 +00:00
|
|
|
|
|
|
|
```bash
|
2024-08-10 05:37:05 +00:00
|
|
|
go install github.com/writefreely/writefreely/cmd/writefreely@latest
|
2019-04-16 15:06:26 +00:00
|
|
|
|
2024-08-10 05:37:05 +00:00
|
|
|
cd $GOPATH/pkg/mod/github.com/writefreely/writefreely@*
|
2019-06-04 16:24:41 +00:00
|
|
|
|
2019-04-16 15:06:26 +00:00
|
|
|
make build # Compile the application
|
2019-04-16 15:29:58 +00:00
|
|
|
make install # Config, generate keys, setup database, install LESS compiler
|
|
|
|
make run # Run the application
|
2019-04-16 15:06:26 +00:00
|
|
|
```
|
2020-04-21 17:32:39 +00:00
|
|
|
|
|
|
|
## Detailed steps
|
|
|
|
|
|
|
|
Use the following steps to build WriteFreely without Make. First, get the code:
|
|
|
|
|
|
|
|
```bash
|
2021-06-18 22:59:30 +00:00
|
|
|
git clone https://github.com/writefreely/writefreely.git
|
2020-04-21 17:32:39 +00:00
|
|
|
cd writefreely
|
|
|
|
```
|
|
|
|
|
|
|
|
Finally, build the `writefreely` binary with SQLite support. (Remove `-tags='sqlite'` if you don't need SQLite support.)
|
|
|
|
|
|
|
|
```bash
|
|
|
|
go build -v -tags='sqlite' ./cmd/writefreely/
|
|
|
|
```
|
|
|
|
|
|
|
|
You can now run WriteFreely! But you'll need one more step to generate some assets and successfully run an instance.
|
|
|
|
|
|
|
|
### Building site assets
|
|
|
|
|
2024-02-02 16:07:34 +00:00
|
|
|
You'll need Node.js and LESS installed to generate WriteFreely static assets. Install LESS using our utility script:
|
2020-04-21 17:32:39 +00:00
|
|
|
|
|
|
|
```bash
|
2024-02-02 16:07:34 +00:00
|
|
|
./less/install-less.sh
|
2020-04-21 17:32:39 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Next, compile all stylesheets from the `less` directory, creating them in the `static/css/` directory:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd less
|
2023-01-31 12:31:32 +00:00
|
|
|
CSSDIR=../static/css
|
2024-02-02 16:07:34 +00:00
|
|
|
lessc app.less --clean-css="--s1 --advanced" ${CSSDIR}/write.css
|
|
|
|
lessc fonts.less --clean-css="--s1 --advanced" ${CSSDIR}/fonts.css
|
|
|
|
lessc icons.less --clean-css="--s1 --advanced" ${CSSDIR}/icons.css
|
|
|
|
lessc prose.less --clean-css="--s1 --advanced" ${CSSDIR}/prose.css
|
|
|
|
```
|
|
|
|
|
|
|
|
Finally, build ProseMirror:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd ../prose
|
|
|
|
npm install
|
|
|
|
npm run-script build
|
2020-04-21 17:32:39 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Now you can run and distribute WriteFreely! 🎉
|
|
|
|
|
|
|
|
Beyond this, you'll initialize your individual instance.
|
|
|
|
|
|
|
|
### Application initiation
|
|
|
|
|
|
|
|
With your build complete, create a configuration file, encryption keys, and initialize your database.
|
|
|
|
|
|
|
|
#### Config file
|
|
|
|
|
|
|
|
Most users will want the interactive configuration process. Run with:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
writefreely config start
|
|
|
|
```
|
|
|
|
|
|
|
|
For other cases where you only need a blank configuration, you can non-interactively generate `config.ini` with this command:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
writefreely config generate
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Encryption keys
|
|
|
|
|
|
|
|
Generate encryption keys needed for storing user sessions and private data:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
writefreely keys generate
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Database
|
|
|
|
|
|
|
|
With your instance configured for a database, run the following command to create the necessary tables:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
writefreely db init
|
|
|
|
```
|
|
|
|
|
|
|
|
### Run WriteFreely
|
|
|
|
|
|
|
|
```bash
|
|
|
|
writefreely
|
|
|
|
```
|