Skip to content

Commit

Permalink
feat: better installation and docker instructions (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
anoziere authored Nov 22, 2024
1 parent 2b0999e commit af92d1e
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 23 deletions.
112 changes: 108 additions & 4 deletions docs/getting_started/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,125 @@ If you want to use **docker** please follow [this](./docker) way.
:::

### Download the project
```
composer create-project thelia/thelia-project YourProject 2.5.3

Rename `YourPorject` with the name of your project. Be aware of the version you want to install (here `2.5.4`) :

```bash
composer create-project thelia/thelia-project YourProject 2.5.4
```

### Launch the database installation
You can say `yes` for the recipes.

### Thelia core installation
```bash
cd YourProject
php Thelia thelia:install
```
Installation will ask you some questions, like database connection. Please, use the access of your provider.

### Create an admin

```bash
php Thelia admin:create
```

### Thelia modern theme installation

#### 1\. Check Node.js Version


Make sure you have Node.js installed and a supported version > 10.0.0
```bash
node --version
```
If your Node.js version is not supported, install a compatible version from [Node.js](https://nodejs.org).


#### 2\. Check Yarn Installation

Verify that Yarn is installed and accessible in your system.

```bash
yarn --version
```
If Yarn is not installed, install it by following the instructions on the [Yarn website](https://yarnpkg.com).


#### 3\. Configure a Template

Choose a front-office template. By default, the template is named `modern`.

```bash
cp -r templates/frontOffice/modern templates/frontOffice/<template_name>
```

Replace `<template_name>` with your desired template name.


#### 4\. Activate/Deactivate Modules

Activate essential modules and deactivate unnecessary ones.


```bash
php Thelia module:refresh
php Thelia module:activate OpenApi
php Thelia module:activate ChoiceFilter
php Thelia module:activate StoreSeo
php Thelia module:activate SmartyRedirection
php Thelia module:deactivate HookAdminHome
php Thelia module:deactivate HookAnalytics
php Thelia module:deactivate HookCart
php Thelia module:deactivate HookCustomer
php Thelia module:deactivate HookSearch
php Thelia module:deactivate HookLang
php Thelia module:deactivate HookCurrency
php Thelia module:deactivate HookNavigation
php Thelia module:deactivate HookProductsNew
php Thelia module:deactivate HookSocial
php Thelia module:deactivate HookNewsletter
php Thelia module:deactivate HookContact
php Thelia module:deactivate HookLinks
php Thelia module:deactivate HookProductsOffer
php Thelia module:refresh
```

⚠️ You can ignore errors on deactivate commands; some modules might not be installed or available.

#### 5\. Change Active Template

Set the active front-office template.

```bash
php Thelia template:set frontOffice <template_name>
```

Replace `<template_name>` with your chosen template.

#### 6\. Install Front-End Dependencies

Navigate to your template directory and install dependencies using Yarn.

```bash
cd templates/frontOffice/<template_name>
yarn install
yarn build
```

#### Final Step: Clear Cache

Clear the cache to ensure all changes are applied.

```bash
rm -rf ./cache
php Thelia assets:install web
```

That's all, your Thelia is now installed, but depending your web server you may need to do come configuration :
Depending your web server you may need to do come configuration :
- Guide for [Apache](./apache_configuration)
- Guide for [Nginx](./nginx_configuration)

----

### Insert demo data
Now if you want a demo data with fake but realistic products execute
Expand Down
84 changes: 65 additions & 19 deletions docs/getting_started/docker.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,93 @@
---
title: Dockerize your Thelia
sidebar_position: 4
sidebar_position: 6
---

A docker configuration is provided in the repository of Thelia. It uses docker-compose.
A docker configuration is provided in the repository of Thelia. It uses docker-compose.

It requires obviously [docker](https://docker.com/) and [docker-compose](http://docs.docker.com/compose/)

## start the containers
## Get the project

Simply run :
### With composer

Run the composer command shown in the [dedicated page](/docs/getting_started/Installation).

### Or download the archive

You can download the archive from official [releases pages](https://github.com/thelia/thelia/releases).

## Run docker

> ⚠️ **Important** : First, copy and paste content from file `.env.docker` to `.env` file.
Change default values if needed, but default values should work. You should overrides default values with a `.env.local` file.


Then execute this command from the root path of the project :
```
docker-compose up -d
docker compose up -d
```

tip : create an alias for docker-compose, it's boring to write it all the time

## How to use it
Your website should be accessible here, but not yet installed : [http://localhost:8080](http://localhost:8080) . You should see "Thelia is not installed".

## Initial commands

All the script are launched through docker. For examples :
To be able to run PHP command, you first need to execute this if you need :

```
docker-compose exec php-fpm bash
```
docker exec -it thelia_web_1 php Thelia cache:clear
docker exec -it thelia_web_1 php setup/faker.php
docker exec -it thelia_web_1 unit-tests.sh
docker exec -it thelia_web_1 php composer.phar install

You will be inside the php docker container. From here, you have to follow the classic installation process of Thelia ( cf: [installation page](/docs/getting_started/Installation) )

A few differences :
- you have to use the database host `docker-thelia-mariadb` instead of `localhost`
- use `thelia` (if you didn't change it) as the database name, user and password
- to install modern theme, please execute command from your host (not inside docker container)
- execute php commands of the installation process inside the docker container (only php commands)

If you have permission errors at the end of the execution or in the browser, simply run this from your host terminal :

```
sudo chmod -R 777 var/log
sudo chmod -R 777 var/cache
sudo chmod -R 777 web
```

From here, your Thelia might be correctly installed.
Your website should be accessible here : [http://localhost:8080](http://localhost:8080) .


## To go further

Environment variables are set in the `.env` file, if you change them, you have to restart the container :
```bash
docker compose down --remove-orphans
docker compose up -d
docker compose exec php-fpm bash
rm -rf var/cache/*
```

```thelia_web_1``` is the name of your main container. run ```docker-compose``` if your container name is different.
You can now run commands like this inside your container :

You can now use Thelia exactly as if you have all the php/apache/mysql stack installed on your machine. This configuration contains xdebug so you can also use the ste by step feature.
```
php Thelia c:c
php Thelia admin:create
php local/setup/import.php
```

## Database information
## Shut down docker

* host : mariaDB
* login : root
* password : toor
Run this command from your root path if you need to stop your docker containers:
```
docker compose down --remove-orphans
```


## How to change the configuration

All the configuration can be customize for your own project. It uses the official [php image](https://hub.docker.com/_/php/) provided by docker so you can change the php version as you want.
You can also install all the extension you want.

Each time you modify the configuration, you have to rebuild the containers : ```docker-composer build --no-cache```
Each time you modify the configuration, you have to rebuild the containers : ```docker-composer build --no-cache```

0 comments on commit af92d1e

Please sign in to comment.