Adding documentation docker progress and fixes for Debian.

This commit is contained in:
Sergiotarxz 2023-07-01 04:10:11 +02:00
parent 708618f6d1
commit 3faef6da5e
4 changed files with 73 additions and 8 deletions

View File

@ -8,7 +8,54 @@ this project.
## Docker
Docker is the recommended way for novices to
test this software, to use it... (In progress)
test this software, to use it first you
are going to have to install a bunch of packages
in the host.
### Install Docker deps in the Host.
```shell
sudo apt update && \
sudo apt install docker.io redis postgresql pwgen
```
### Configure Redis in the Host for Docker
Now you are going to have to reconfigure
redis to use unix sockets that you can share
with redis.
```shell
( cat << 'EOF'
unixsocket /var/run/redis/redis.sock
unixsocketperm 777
EOF
) | sudo tee -a /etc/redis/redis.conf && \
sudo systemctl restart redis
```
### Setup the database in the Host.
```shell
( cat << EOF
create user $(whoami);
create database "las_tres";
grant all privileges on database "las_tres" to $(whoami);
alter database "las_tres" owner to $(whoami);
EOF
) | sudo -u postgres psql
```
### Exec the webpage using Docker.
```shell
bash start_docker.sh
```
The first time you execute this the database migrations
won't be applied but we are going to solve this soon.
As soon as the application is already listening interrupt
the process and
## Installing

View File

@ -14,9 +14,10 @@ if ! [ -f las_tres.yml ]; then
cat << EOF > las_tres.yml
secrets:
- $(pwgen -s 512 1)
database:
database:
user: $(whoami)
dbname: las_tres
hypnotoad:
hypnotoad:
listen:
- http://*:3000
EOF

View File

@ -18,8 +18,13 @@ our $VERSION = $LasTres::Schema::VERSION;
sub new {
my $class = shift;
if ( !defined $self ) {
my $redis_file = '/var/run/redis/redis.sock';
if (-e $redis_file) {
$self = $class->SUPER::new(
Mojo::URL->new->host("/var/run/redis/redis.sock") );
Mojo::URL->new->host($redis_file) );
} else {
$self = $class->SUPER::new(@_);
}
}
return $self;
}

View File

@ -1,6 +1,6 @@
#!/bin/bash
CURRENT_DIR=$(dirname $0)
CURRENT_DIR=$(realpath $(dirname $0))
NEEDS_SUDO=0
SUDO=""
DOCKER_TAG="lastres:latest"
@ -13,6 +13,18 @@ perl -pe 's/\{\{UID\}\}/'"$UID/" Dockerfile.template > Dockerfile
OLD_CHECKSUM_DOCKER="$(cat $CHECKSUM_DOCKER_FILE 2> /dev/null)"
CURRENT_CHECKSUM_DOCKER="$(sha512sum Dockerfile | awk '{ print $1 }')"
if ! [ -f las_tres.yml ]; then
cat << EOF > las_tres.yml
secrets:
- $(pwgen -s 512 1)
database:
user: $(whoami)
dbname: las_tres
hypnotoad:
listen:
- http://*:3000
EOF
fi &&
if ! docker image ls 2>/dev/null; then
NEEDS_SUDO=1
fi