Skip to content

Instructions

Riku edited this page Mar 11, 2020 · 3 revisions

Nekos.cafe Install guide

Requirements:

  • yarn
  • mongo
  • nginx (optional)

Basic setup

  1. Clone the repository with git clone https://github.com/Riku32/nekos.cafe.git
  2. Run the command yarn, this will install all the required packages for nekos.cafe

Configuration

The default .env.example file should look like this

MONGOURL=mongodb://database:port
DBNAME=dbname
UPLOAD_DIR=./uploads/
UPLOADS_SERVE=true
URL=http://localhost:8080/
INVITEONLY=false
PORT=8080

FILELENGTH=7
MAXUPLOADSIZE=100

ADMINREGISTER=false
ADMINKEY=supersecurekey
  1. Copy/rename this file to .env
  2. Put your mongo connection string in MONGOURL
  3. Put your database name within mongo at DBNAME
  4. Put your upload directory at UPLOAD_DIR
  5. URL is where your file serve domain will be. If you aren't using a custom domain to serve files just put your domain name here. Make sure it ends with a /
  6. UPLOADS_SERVE is for serving your upload directory through the builtin webserver
  7. INVITEONLY is true if you want the instance to be invite-only
  8. PORT is the port that the server will be listening on
  9. FILELENGTH is the length of randomly generated filenames that are uploaded
  10. MAXUPLOADSIZE is the maximum upload filesize, this is in MB
  11. ADMINREGISTER should always be false unless you are creating an admin user
  12. ADMINKEY while creating an admin user this is the secret key needed to signup as admin

Admin setup

  1. Set ADMINREGISTER in .env to true and set ADMINKEY to something secure
  2. Run node app.js to start the server
  3. Navigate to http://yourdomain.com/admin/signup
  4. Put your username and password into the two fields, put the ADMINKEY you configured in .env as the last field. This should create your admin account.
  5. Shut down the server by pressing CTRL+C in the console.
  6. Set ADMINREGISTER to false

After this you should be good to go, just create an account regularly at http://yourdomain.com/signup and continue, if you need to create a registration key for friends or yourself visit http://yourdomain.com/admin and you should have access to the admin panel to create regkeys.


NGINX (optional)

Follow these steps if you want to use SSL or need to reverse proxy the application. This will not tell you how to install nginx, research that elsewhere. This guide assumes you are using ubuntu as your operating system.

  1. Go to /etc/nginx/sites-available
  2. Create a file here prefferably called nekos
server {
    listen              443 ssl;
    server_name         yourdomain.com;

    ssl_certificate     /etc/ssl/certs/server.pem;
    ssl_certificate_key /etc/ssl/certs/server.key;

    location / {
        proxy_pass http://localhost:8080;
    }
}

This should be the content of the file if you did not change the port settings in .env Change server_name to your domain and set the ssl options to your certificate. If you do not want to use ssl then follow the additional instructions below

  1. Change 443 ssl; to 80;
  2. Remove ssl_certificate and ssl_certificate_key. Once you are sure that your config is complete run the two commands below ln -s /etc/nginx/sites-available/nekos /etc/nginx/sites-enabled/nekos systemctl restart nginx

This is activating the config we just made and restarting nginx


Clone this wiki locally