Telescope intends to replace Observatory as the RCOS website.
- Install dependencies:
- Rust (see https://www.rust-lang.org/)
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh $ source ~/.cargo/env
- Postgres (see https://www.postgresql.org/)
$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' $ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - $ sudo apt update $ sudo apt install postgresql libpq-dev
- OpenSSL and libssl (see https://www.openssl.org/ for more info)
$ sudo apt update $ sudo apt install openssl libssl-dev libssl-doc
- Diesel client (see https://diesel.rs/)
$ cargo install diesel_cli --no-default-features --features postgres
- Rust (see https://www.rust-lang.org/)
- Make sure that you have a user and password set up in postgres and can log in
with a password. You may have to modify
/etc/postgresql/12/main/pg_hba.conf
(or something along those lines) to use md5 authentication rather than peer authentication. You will know this works when you can log in to postgres using$ psql -U <username> -W
- Clone this repository.
- Generate self-signed TLS/SSL certificate and keys for testing:
If you are running this in production, do not do this. Instead, you should use a certificate signed by a trusted certificate authority. See https://phoenixnap.com/kb/openssl-tutorial-ssl-certificates-private-keys-csrs for more details.
$ mkdir tls-ssl $ openssl req -x509 -newkey rsa:4096 -nodes -keyout tls-ssl/private-key.pem -out tls-ssl/certificate.pem -days 365
- Create a
.env
file to store your database config and other environment variables to be used at runtime. Enter the following lines into the.env
file:DATABASE_URL="postgres://<username>:<password>@localhost/telescope" SMTP_USERNAME="USER" SMTP_PASSWORD="PASS" LOG_LEVEL="info,telescope=trace"
- Run the database setup and migrations. This will create a database and then
run all of the necessary migrations.
$ diesel setup $ diesel migration run
$ # Usage:
$ cargo run -- -h
$ # Development profile (for testing on local machine).
$ cargo run -- --development
$ # Production profile (used for deploying in production environments).
$ cargo run --release -- --production
If you have issues running the website, here are a few things you can check/try:
- All prerequisites are installed.
- If you use Windows Subsystem for Linux, make sure that it's installed correctly. There have recently been issues with the installation of WSL2 and Rust: rust-lang/rustup#2293
- One you compile the website, launch it at the local IP address that your terminal generates. Make sure that 'https://' precedes the IP address.
- If you get a blank page when launching the website, you need to regenerate your TLS/SSL certificate and keys. If that doesn't work, then switch browsers (e.g. Firefox, Chrome).
- If your Postgres server isn't locally running, enter the
command
sudo service postgresql status
. If the service is down, entersudo service postgresql start
. - If you are having issues creating a DATABASE_URL, try using the default admin username 'postgres'.