Run Lookyloo in Production

Please follow the default installation guide first.

Reverse proxy (nginx)

The relevant sample configuration file is:

etc/nginx/sites-available/lookyloo

Modify server_name to point to the domain or IP you want to use for Lookyloo.

If you didn’t modify website_listen_ip and website_listen_port in config/generic.json, the rest of this file will work out of the box. Otherwise, adapt the file accordingly.

Copy the file to the expected directory for nginx:

cp etc/nginx/sites-available/lookyloo /etc/nginx/sites-available/

Optionally, you can remove the default site:

sudo rm /etc/nginx/sites-enabled/default

Enable the website, check and restart nginx:

sudo ln -s /etc/nginx/sites-available/lookyloo /etc/nginx/sites-enabled
sudo nginx -t
# If it is cool:
sudo service nginx restart

Systemd service

Adapt the confirguration file to your system

The relevant sample configuration file is:

etc/systemd/system/lookyloo.service.sample

In this one, you will need to edit the file accordingly to your configuration:

  • User: system user used to install lookyloo

  • Group: group of the user used to install lookyloo

  • WorkingDirectory: path to the directory where you cloned the repository

  • Environment: Path to the directory where the poetry executable is. You can find it by using whereis:

    $ whereis poetry
    poetry: /home/lookyloo/.local/bin/poetry

    In this case, you will use: /home/lookyloo/.local/bin. If you installed poetry as root, it might be /usr/local/bin or even /usr/bin

    Always make sure you have :/usr/bin at the end. Otherwise, the service may not be able to find the python3 executable.

In the end, the service file should look something like that:

[Unit]
Description=uWSGI instance to serve lookyloo
After=network.target

[Service]
User=lookyloo
Group=lookyloo
Type=forking
WorkingDirectory=/home/lookyloo/gits/lookyloo
Environment="PATH=/home/lookyloo/.local/bin:/usr/bin"
ExecStart=/bin/bash -c "exec poetry run start"
ExecStop=/bin/bash -c "exec poetry run stop"


[Install]
WantedBy=multi-user.target

Set it up

Copy the file to the expected directory:

cp etc/systemd/system/lookyloo.service.sample /etc/systemd/system/lookyloo.service
sudo systemctl daemon-reload

Start, and check the status of the systemd service:

sudo systemctl start lookyloo
sudo systemctl status lookyloo

If everything is fine, enable the service so it automatically starts on reboot:

sudo systemctl enable lookyloo

Multi-users App

If you expect to have multiple users of Lookyloo at the same time, it is strongly recommended to use aquarium.

Aquarium is a haproxy + splash bundle that will allow to capture multiple websites at the same time with Lookyloo, making it more reliable for concurrent users.

Follow the documentation if you want to use it.

The initial version of the project was created by TeamHG-Memex, but our dedicated repository fits our needs better.

Adapt the service file to your system

The relevant sample configuration file is:

etc/systemd/system/aquarium.service.sample

In this one, you will need to edit the file accordingly to your configuration:

  • User: system user used to install lookyloo

  • Group: group of the user used to install lookyloo

  • WorkingDirectory: path to the directory where you installed aquarium

    In this case, you will use: /home/lookyloo/aquarium.

    In the end, the service file should look something like that:

[Unit]
Description=aquarium service with docker compose
Requires=docker.service
After=docker.service

[Service]
User=lookyloo
Group=lookyloo
Type=forking
RemainAfterExit=true
WorkingDirectory=/home/lookyloo/aquarium
ExecStart=/usr/bin/docker-compose up -d --remove-orphans
ExecStop=/usr/bin/docker-compose down

[Install]
WantedBy=multi-user.target
[Install]
WantedBy=multi-user.target

Set it up

Add the user to docker group

sudo usermod -aG docker $USER

Copy the file to the expected directory:

cp etc/systemd/system/aquarium.service.sample /etc/systemd/system/aquarium.service
sudo systemctl daemon-reload

Start, and check the status of the systemd service:

sudo systemctl start aquarium
sudo systemctl status aquarium

If everything is fine, enable the service so it automatically starts on reboot:

sudo systemctl enable aquarium

Final remarks

If everything above went fine, you can connect to lookyloo in your browser: http://<IP-or-domain-in-nginx-config>/

You probably want to enable TLS on the website. The easiest way is to use Let’s Encrypt, and Digital Ocean has a great guide for Ubuntu 20.04.