Commit cbb83a6f authored by Yassine Doghri's avatar Yassine Doghri
Browse files

feat: add npm for js dependencies + move src/ files to root folder

- add node service in docker-compose.yml
- update .devcontainer Dockerfile by adding node, npm and vim
- init package.json for npm with tailwindcss, postcss, commitlint and commitizen as dev dependencies
- update default layout main header and footer
- replace CI's welcome_message.php with home.php listing all podcasts
- add AUTHORS.md file
- add docs folder in which to place castopod's technical documentation
parent 3bf9420b
File deleted
......@@ -6,6 +6,11 @@ RUN apt-get update && apt-get install -y \
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get update && \
apt-get install -y nodejs
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git
apt-get install -y git vim
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.117.1/containers/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
"dockerFile": "./Dockerfile",
"settings": {
"terminal.integrated.shell.linux": null
},
"extensions": [
"mikestead.dotenv",
"bmewburn.vscode-intelephense-client",
"streetsidesoftware.code-spell-checker",
"naumovs.color-highlight",
"heybourn.headwind"
]
}
\ No newline at end of file
"name": "Existing Dockerfile",
"dockerFile": "./Dockerfile",
"settings": {
"terminal.integrated.shell.linux": null
},
"extensions": [
"mikestead.dotenv",
"bmewburn.vscode-intelephense-client",
"streetsidesoftware.code-spell-checker",
"naumovs.color-highlight",
"heybourn.headwind",
"anish-m.ci-snippets2",
"wayou.vscode-todo-highlight"
]
}
#-------------------------
# Operating Specific Junk Files
#-------------------------
# OS X
.DS_Store
.AppleDouble
.LSOverride
# OS X Thumbnails
._*
# Windows image file caches
Thumbs.db
ehthumbs.db
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# Linux
*~
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
#-------------------------
# Environment Files
#-------------------------
# These should never be under version control,
# as it poses a security risk.
.env
.vagrant
Vagrantfile
#-------------------------
# Temporary Files
#-------------------------
writable/cache/*
!writable/cache/index.html
writable/logs/*
!writable/logs/index.html
writable/session/*
!writable/session/index.html
writable/uploads/*
!writable/uploads/index.html
writable/debugbar/*
php_errors.log
#-------------------------
# User Guide Temp Files
#-------------------------
user_guide_src/build/*
user_guide_src/cilexer/build/*
user_guide_src/cilexer/dist/*
user_guide_src/cilexer/pycilexer.egg-info/*
#-------------------------
# Test Files
#-------------------------
tests/coverage*
# Don't save phpunit under version control.
phpunit
#-------------------------
# Composer
#-------------------------
vendor
#-------------------------
# IDE / Development Files
#-------------------------
# Modules Testing
_modules/*
# phpenv local config
.php-version
# Jetbrains editors (PHPStorm, etc)
.idea/
*.iml
# Netbeans
nbproject/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/
# Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project
.phpintel
/api/
# Visual Studio Code
.vscode/
/results/
/phpunit*.xml
/.phpunit.*.cache
# Media files
public/media/*
# npm
yarn.lock
node_modules
# potcss generated file
public/index.css
#-------------------------
# Docker volumes
#-------------------------
......
# Authors
[Benjamin Bellamy](https://code.podlibre.org/benjamin) <benjamin@podlibre.org>
[Yassine Doghri](https://code.podlibre.org/yassine) <yassine@podlibre.org>
FROM php:latest
COPY ./src /castopod
COPY . /castopod
WORKDIR /castopod
### Install CodeIgniter's server requirements
......
......@@ -19,151 +19,6 @@ Moreover Podcasters can choose to publish on Castopod while keeping their existi
---
## Setup your development environment
## Documentation
Castopod is a web app based on the `php` framework [CodeIgniter 4](https://codeigniter.com).
To setup a dev environment, we use [Docker](https://www.docker.com/). A `docker-compose.yml` and `Dockerfile` are included in the project's root folder to help you kickstart your contribution.
> Know that you don't need any prior knowledge of Docker to follow the next steps. However, if you wish to use your own environment, feel free to do so!
### Prerequisites
0. Install [docker desktop](https://www.docker.com/products/docker-desktop).
1. Clone castopod project by running:
```bash
git clone https://code.podlibre.org/podlibre/castopod.git
```
2. Create a `./src/.env` file with the minimum required config to connect the app to the database:
```env
CI_ENVIRONMENT = development
database.default.hostname = mariadb
database.default.database = castopod
database.default.username = podlibre
database.default.password = castopod
```
> _NB._ You can tweak your environment by setting more environment variables. See the `./src/env` for examples or the [CodeIgniter4 User Guide](https://codeigniter.com/user_guide/index.html) for more info.
3. Add the repository you've cloned to docker desktop's `Settings` > `Resources` > `File Sharing`.
4. Install castopod's php dependencies
- The project's dependencies aren't included in the repository, you have to download them using the composer service defined in `docker-compose.yml`
```bash
docker-compose run --rm composer install --ignore-platform-reqs
```
### Start docker containers
Go to project's root folder and run:
```bash
# starts all services declared in docker-compose.yml file
# -d option starts the containers in the background
docker-compose up -d
# See all running processes (you should see 3 processes running)
docker ps
# Alternatively, you can check all processes (you should see composer with an Exited status)
docker ps -a
```
> The `docker-compose up -d` command will boot 3 containers in the background:
>
> - `castopod_app`: a php based container with codeigniter requirements installed
> - `castopod_mariadb`: a [mariadb](https://mariadb.org/) server for persistent data
> - `castopod_phpmyadmin`: a phpmyadmin server to visualize the mariadb database
>
> _NB._ `./mariadb`, `./phpmyadmin` folders will be mounted in the project's root directory to persist data and logs.
### Initialize and populate database
Build the database with the migrate command:
```bash
# loads the database schema during first migration
docker-compose run --rm app php spark migrate
```
Populate the database with the required data:
```bash
# Populates all categories
docker-compose run --rm app php spark db:seed CategorySeeder
docker-compose run --rm app php spark db:seed LanguageSeeder
```
### Start hacking
You're all set! Start working your magic by updating the project's files! Help yourself to the [CodeIgniter4 User Guide](https://codeigniter.com/user_guide/index.html) for more insights.
To see your changes, go to:
- [localhost:8080](http://localhost:8080/) for the castopod app
- [localhost:8888](http://localhost:8888/) for the phpmyadmin interface:
- **Username**: podlibre
- **Password**: castopod
---
### Going Further during development
#### Update app dependencies
You can update the project's dependencies using the `composer` service:
```bash
docker-compose run --rm composer update --ignore-platform-reqs
```
> _NB._ Composer commands look for the `composer.json` file to find castopod's php dependencies, all of which live in the `./src/vendor` folder. For more info, check out [Composer documentation](https://getcomposer.org/doc/).
#### Useful docker / docker-compose commands
```bash
# monitor the app container
docker logs --tail 50 --follow --timestamps castopod_app
# monitor the mariadb container
docker logs --tail 50 --follow --timestamps castopod_mariadb
# monitor the phpmyadmin container
docker logs --tail 50 --follow --timestamps castopod_phpmyadmin
# restart docker containers
docker-compose restart
# Destroy all containers, opposite of `up` command
docker-compose down
```
Check [docker](https://docs.docker.com/engine/reference/commandline/docker/) and [docker-compose](https://docs.docker.com/compose/reference/) documentations for more insights.
### Developing inside a Container
If you're working in VSCode, you can take advantage of the `./.devcontainer/` folder. It defines a development container with preinstalled VSCode extensions so you don't have to worry about them. The container will be loaded with php, composer and git:
1. Install the VSCode extension [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
2. `Ctrl/Cmd + Shift + P` > `Open in container`
The VSCode window will reload inside the dev container.
You can check that the required packages are running in the console (`Terminal` > `New Terminal`):
```bash
php -v
composer -V
git version
```
For more info, see [VSCode Remote Containers](https://code.visualstudio.com/docs/remote/containers)
You can check castopod's documentation for [setting up a development environment](./docs/setup-development.md).
<?php namespace Config;
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
......@@ -76,7 +78,7 @@ class App extends BaseConfig
| If false, no automatic detection will be performed.
|
*/
public $negotiateLocale = false;
public $negotiateLocale = true;
/*
|--------------------------------------------------------------------------
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment