Depending on your needs, you may want to install Stylo in different ways :
- With Docker (suited to run Stylo rapidly)
- Without Docker (suited to tailor your Stylo setup)
Ansible playbooks enable you to deploy Stylo on a remote machine, accessible with the SSH protocol.
You can find various pointers in our GitHub Actions automations, and in the ./infrastructure
folder.
First step is to clone the project, you can use either the HTTPS or SSH version of the repository URL:
$ git clone [email protected]:EcrituresNumeriques/stylo.git
Stylo uses submodules to pull templates (and those templates are hosted on framagit). If you have an account with ssh enabled on framagit, you can pull all submodules using the following commands:
$ git submodule init
$ git submodule update
Useful to run a fully fledged Stylo in no time.
Run the following command:
$ cp stylo-example.env stylo.env
$ docker-compose up
NOTE: The first time, this command can take a few dozen minutes depending on your network speed and machine capabilities. Subsequent calls will be faster.
This gives your access to:
- Stylo (frontend): http://localhost:3000
- GraphQL endpoint: http://localhost:3030
- Export endpoint: http://localhost:3060
Note: this section can be improved.
We recommend you to host Stylo behind a reverse proxy. We provide a working configuration example below for the Nginx server.
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
$ nvm install v16
$ sudo apt install mongodb-org pandoc
After cloning the repo, build the service and its dependencies:
$ cp stylo-example.env stylo.env
$ npm clean-install
$ npm start
After the image is built, you should have a Stylo instance running on your server. Now, we need to expose it to the outside world with a reverse proxy.
Obtain a working sample file with the following command:
$ wget -O /etc/nginx/sites-available/stylo.conf \
https://github.com/EcrituresNumeriques/stylo/raw/dev/infrastructure/stylo.huma-num.fr.conf
Replace the service domain name:
$ sed -i s/stylo.huma-num.fr/STYLO_SUBDOMAIN.MYDOMAIN.TLD/g' /etc/nginx/sites-available/stylo.conf
Alternatively, alter the various ports, and domains on your own.
When you are done, enable the website and reload the configuration:
$ ln -s /etc/nginx/sites-available/stylo.conf /etc/nginx/sites-enable/stylo.conf
$ nginx reload
Note: this section can be improved.
$ pip install ansible===2.9.7 requests
$ cd infrastructure
$ ansible-playbook -i inventories/prod playbook.yml
Once you have an up and running Stylo instance, read the SERVER.md
file to run daily and maintenance operations, such as database migrations and such.