nettsiden/README.md

78 lines
2.4 KiB
Markdown
Raw Normal View History

2021-09-08 22:38:17 +02:00
# Programvareverkstedets nettside
2016-08-15 17:43:41 +02:00
A website created with the latest and greatest web technologies.
May contain blackjack and other things one tends to include in awesome projects.
## Installation
git clone --recursive https://github.com/Programvareverkstedet/nettsiden.git
2016-08-15 17:43:41 +02:00
Put it in a folder your webserver can find.
2016-08-18 23:08:31 +02:00
## Development setup
2021-09-08 22:38:17 +02:00
Make sure you have `sqlite3`, `php` and `pdo-sqlite` installed.
These can be obtained from your package manager.
2021-09-08 22:38:17 +02:00
Then make sure PHP has the `curl`, `pdo-sqlite` and `sqlite3` extensions enabled, see `/etc/php/php.ini`.
2016-08-18 23:08:31 +02:00
./dev.sh
2021-09-08 22:38:17 +02:00
On Windows you can use chocolatey and git bash to run `./dev.sh`.
Install `php` and `sqlite`, then enable these extensions in `C:\tools\php80\php.ini`:
`mbstring`, `openssl`, `curl`, `pdo-sqlite` and `sqlite3`
Alternatively you may use `cmd` on Windows.
In this case you'll have to perform a `composer install` manually beforehand.
Good luck.
dev.bat
2021-03-16 20:00:02 +01:00
2021-09-08 22:38:17 +02:00
2021-03-16 20:00:02 +01:00
### Dependency management
2021-09-08 22:38:17 +02:00
`dev.sh` will ensure the git submodules have been properly pulled, then download the `composer` package manager to a php archive file named `composer.phar`, then run it.
Composer will then check for the php extensions needed, such as `pdo_sqlite`, which must be enabled on your system.
This usually includes installing a php-sqlite3 package and enabling it in `/etc/php/php.ini`:
2021-03-16 20:07:56 +01:00
[PHP]
extension=pdo_sqlite
extension=sqlite3
2021-09-08 22:38:17 +02:00
extension=ext-curl
2021-03-16 20:07:56 +01:00
Composer is used as such:
2021-03-16 20:00:02 +01:00
php composer.phar update
php composer.phar install
2021-09-08 22:38:17 +02:00
2021-08-11 22:28:48 +02:00
### Docker
We provide a simple docker-compose setup for local development.
First ensure that docker is running:
sudo systemctl start docker
then
DOCKER_USER=$(id -u):$(id -g) docker-compose up
### Admin account
Login goes through `idp.pvv.ntnu.no` via SAML, so you have to use your PVV account.
2021-09-08 22:38:17 +02:00
(This only works if you use access the local development site via the the hostname `localhost`)
To make your account into an admin account, run:
2021-09-08 22:38:17 +02:00
sqlite3 pvv.sqlite 'INSERT INTO users (uname, groups) VALUES ("YOUR_USERNAME", 1);'
2021-09-08 22:38:17 +02:00
If using docker, when already running:
2021-09-08 22:38:17 +02:00
DOCKER_USER=$(id -u):$(id -g) docker-compose exec nettside sqlite3 pvv.sqlite 'INSERT INTO users (uname, groups) VALUES ("YOUR_USERNAME", 1);'
If not already running:
2021-09-08 22:38:17 +02:00
DOCKER_USER=$(id -u):$(id -g) docker-compose run nettside sqlite3 pvv.sqlite 'INSERT INTO users (uname, groups) VALUES ("YOUR_USERNAME", 1);'
2021-03-16 20:00:02 +01:00
## Hosting