2.7 KiB
2.7 KiB
Application download & Docker setup
Requirements
- Docker
- Docker Compose CLI
- Git
- A text editor, like
nano
Project repository setup
- Download the project repository via Git:
git clone https://git.alex.lol/FLOT/HovedprosjektWebApp.git /srv/FLOTWebApp
- Navigate to the repository directory:
cd /srv/FLOTWebApp
- Copy
.env.example
to.env
. Leave the.env
file as is for now. - Copy
docker-compose.example.yml
todocker-compose.yml
. - Edit
docker-compose.yml
(with your text editor) and modify configuration/volumes to match your needs. - Edit
.env
and modify your database credentials to match the ones you set indocker-compose.yml
DB_HOST
(db) andDB_PORT
(5432) can generally be left as is
- Navigate to the
.docker
directory in the repository. - Copy
examples/hovedprosjekt.example.conf
tonginx/hovedprosjekt.conf
. - Edit
nginx/hovedprosjekt.conf
and modify domain/TLS configuration to your needs.- Make sure that the SSL certificate and key uses the path as the volume mapping in
docker-compose.yml
.
- Make sure that the SSL certificate and key uses the path as the volume mapping in
- Go up one directory (
cd ..
) and rundocker-compose build app
- If built successfully, run
docker-compose up -d
to run all containers in "detached" mode.
Application setup - First-time setup only
These steps should be run after you have run docker-compose up -d
, as the containers need to be running.
- Go to the project repository:
cd /srv/FLOTWebApp
- Make sure that the project repository has correct permissions for the user specified in
docker-compose.yml
sudo chown -R 1000:1000 .
will set it to the user/group with ID "1000". You can see users and their IDs if youcat /etc/passwd
.
- Install Composer dependencies using:
docker-compose exec app composer install
- Dependency installation might take a while, so be patient.
- Run
docker-compose exec app php artisan key:generate
to generate an app key that's saved in.env
- Finally, create the database tables with:
docker-compose exec app php artisan migrate
- [Optional] Add sample users and posts to the database tables:
docker-compose exec app php artisan db:seed
Logs [Optional]
You do not need to look at the logs, but if things aren't working, the logs might point you in the right direction:
docker-compose logs -f
will show the logs and display new entries while open.
Special thanks
Special thanks to the DigitalOcean tutorial "How To Containerize a Laravel Application for Development with Docker Compose on Ubuntu 18.04", which was used as the initial template.