2017-04-15 18:43:29 +00:00
|
|
|
# asciinema web app install guide
|
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
The only officially supported installation procedure of asciinema web app
|
|
|
|
is [Docker](https://www.docker.com/) based. You must have SSH access to a
|
|
|
|
64-bit Linux server with Docker support.
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
If you really, really want to install everything manually then look
|
|
|
|
at [Dockerfile](../Dockerfile) and [docker-compose.yml](../docker-compose.yml)
|
|
|
|
to see what's required by the app.
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
## Hmm, why Docker?
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
Hosting non-trivial web applications is complicated. Setting this one up
|
|
|
|
requires installation of fair number of system packages and build tools,
|
|
|
|
configuring monitoring of several processes, as well as configuring Nginx. Also,
|
|
|
|
you need PostgreSQL, Redis, and SMTP server.
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
With Docker, you get the battle tested configuration (similar to what's running
|
|
|
|
on asciinema.org), in a stable container, along with all required services
|
|
|
|
preconfigured.
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
It also makes upgrading to new versions much easier.
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
## Hardware Requirements
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
- modern single core CPU, dual core recommended
|
|
|
|
- 1 GB RAM minimum (with swap)
|
|
|
|
- 64 bit Linux compatible with Docker
|
|
|
|
- 10 GB disk space minimum
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
## Service Requirements
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
asciinema web app requires the following services:
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
- [Postgres 9.5+](http://www.postgresql.org/download/)
|
|
|
|
- [Redis 2.6+](http://redis.io/download)
|
|
|
|
- SMTP server
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
If you go with the provided [docker-compose.yml](../docker-compose.yml) file you
|
|
|
|
don't need to worry about these - they're included and already configured to
|
|
|
|
work with this app.
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
## Installation
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
This guide assumes you already
|
|
|
|
have [Docker engine](https://docs.docker.com/engine/)
|
|
|
|
and [docker-compose](https://docs.docker.com/compose/) running on the
|
|
|
|
installation host.
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-15 22:07:29 +00:00
|
|
|
You don't have to use docker-compose to use asciinema web app Docker image. Feel
|
2017-04-18 17:40:17 +00:00
|
|
|
free to inspect `docker-compose.yml` file and run required services manually with
|
2017-04-15 22:07:29 +00:00
|
|
|
`docker run ...`. However, for the sake of simplicity and to miminize
|
|
|
|
configuration issues the rest of this guide is based on the provided/suggested
|
|
|
|
docker-compose configuration.
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-18 16:34:45 +00:00
|
|
|
### Clone the repository
|
2017-04-15 18:43:29 +00:00
|
|
|
|
2017-04-18 16:34:45 +00:00
|
|
|
git clone --recursive https://github.com/asciinema/asciinema.org.git
|
|
|
|
|
|
|
|
### Edit config file
|
|
|
|
|
2017-04-18 17:40:17 +00:00
|
|
|
You need to create `.env.production` config file. The easiest is to use
|
|
|
|
provided [.env.production.sample](../.env.production.sample) as a template:
|
2017-04-18 16:34:45 +00:00
|
|
|
|
|
|
|
cp .env.production.sample .env.production
|
|
|
|
nano .env.production
|
|
|
|
|
|
|
|
There are several variables which have to be set, like `BASE_URL` and
|
|
|
|
`SECRET_KEY_BASE`. The rest is optional, and most likely used when you want to
|
|
|
|
use your own SMTP, PostgreSQL or Redis server.
|
|
|
|
|
|
|
|
#### Basic settings
|
|
|
|
|
2017-04-18 17:40:17 +00:00
|
|
|
Set `BASE_URL` to the URL your users are supposed to reach this instance at.
|
2017-04-18 16:34:45 +00:00
|
|
|
Example: `http://asciinema.example.com`.
|
|
|
|
|
|
|
|
Set `SECRET_KEY_BASE` to long random string. Run `docker-compose run --rm web
|
|
|
|
bundle exec rake secret` to obtain one.
|
|
|
|
|
|
|
|
#### SMTP settings
|
|
|
|
|
|
|
|
The app uses linked `namshi/smtp` container, which by default runs in "SMTP
|
|
|
|
Server" mode. Set `MAILNAME` to the outgoing mail hostname, for example, use the
|
|
|
|
same hostname as in `BASE_URL`.
|
|
|
|
|
|
|
|
You can configure it to act as GMail relay, Amazon SES relay or generic SMTP
|
|
|
|
relay. See
|
|
|
|
[namshi/docker-smtp README](https://github.com/namshi/docker-smtp/blob/master/README.md)
|
|
|
|
for details.
|
|
|
|
|
|
|
|
For example, to send emails through GMail add `GMAIL_USER` and `GMAIL_PASSWORD`
|
|
|
|
(most likely
|
|
|
|
[App Password](https://support.google.com/accounts/answer/185833?hl=en))
|
|
|
|
variables to the config file.
|
|
|
|
|
|
|
|
#### Database settings
|
|
|
|
|
|
|
|
`DATABASE_URL` and `REDIS_URL` point to linked `postgres` and `redis` containers
|
|
|
|
by default. You can set these so they point to your existing services. Look at
|
|
|
|
"Service Requirements" above for minimum versions supported.
|
|
|
|
|
|
|
|
### Initialize the database
|
|
|
|
|
|
|
|
Now, once you have the config file ready, create database schema and seed it
|
|
|
|
with initial data:
|
|
|
|
|
|
|
|
docker-compose run --rm web bundle exec rake db:setup
|
2017-04-15 18:43:29 +00:00
|
|
|
|
|
|
|
## Using asciinema recorder with your instance
|
|
|
|
|
|
|
|
Once you have your instance running, point asciinema recorder to it by setting
|
|
|
|
API URL in `~/.config/asciinema/config` file as follows:
|
|
|
|
|
|
|
|
[api]
|
|
|
|
url = https://your.asciinema.host
|