2023-07-01 05:23:06 +02:00
|
|
|
# Get started with Docker.
|
|
|
|
|
|
|
|
Docker is the recommended way for novices to
|
|
|
|
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.
|
|
|
|
|
2023-07-01 05:24:36 +02:00
|
|
|
As soon as the application is already listening in the port 3000
|
|
|
|
open a new terminal and execute the following command to install
|
2023-07-01 05:23:06 +02:00
|
|
|
the database migrations.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
bash install_docker.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
It is very important that all the docker actions are
|
|
|
|
done when the container is started otherwise they
|
|
|
|
will throw error and do nothing.
|
|
|
|
|
|
|
|
After the install interrupt `start_docker.sh` with
|
|
|
|
control + c and start it again and the database
|
|
|
|
installation will be complete.
|
|
|
|
|
|
|
|
## Creating new migrations.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
bash prepare_docker.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
## Upgrading the database with the new migrations.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
bash upgrade_docker.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
## Where are the CSS and Javascript build scripts for Docker?
|
|
|
|
|
|
|
|
These scripts are not needed in Docker since Docker already
|
|
|
|
does them every time you start the container, caring about
|
|
|
|
changes in the Perl dependencies is also unneeded, Docker
|
|
|
|
already cares for you.
|