Landing page for www.teknologforeningen.fi
To update the site you should pull the latest changes from git using the www-data
user. This can be done with the following command:
sudo -u www-data git pull --ff-only
If this command fails it means someone has made changes on the server and you should seek out that person and spank them.
To run this in production you need to set up a webserver like Apache. Once that is set-up you should clone the repository into the /var/www
folder. Make sure to set the ownership of the folder to www-data
in order to allow the webserver user to access it.
Due to the Täffä API being painfully slow menus are generated separately. The menus can be generated hourly by placing the following script in /etc/cron.hourly/
#!/bin/sh
cd /var/www/www.teknologforeningen.fi
for l in sv fi en
do
MENU=$(php -f menu.php lang=$l)
echo $MENU > menu_$l.html
done
Oneliner to be run in the same directory as index.php resides:
docker run -t -i -p 8000:80 -v `pwd`:/var/www "eriksencosta/php-dev:latest" webserver --foreground start
To shut it down, press ctl+c
ALTERNATIVELY
The following command will start a Docker container listening on port 8000. Make sure to replace the path with the path to the project.
docker run -t -i -p 8000:80 -v <path_to_project>:/var/www "eriksencosta/php-dev:latest" /bin/bash
Once the container is running you need to start the webserver:
webserver start
The site should now be available at http://localhost:8000 (or at the IP of the virtual machine running Docker if you're using Windows/Mac).
To exit the container use: exit
.
Here is an example of what this might look like:
$ docker run -t -i -p 8000:80 -v ~/Projects/www.teknologforeningen.fi:/var/www "eriksencosta/php-dev:latest" /bin/bash
root@a0c39ad37ba9:/# webserver start
Starting PHP-FPM (PHP version 5.6.6) server.
Starting Nginx server.
Done.
root@a0c39ad37ba9:/# exit
exit
For more information look here: https://hub.docker.com/r/eriksencosta/php-dev/
- Install otto, VirtualBox and vagrant
- Clone this repository
git clone https://github.com/Teknologforeningen/www.teknologforeningen.fi.git
- If on linux, make sure kernel modules are loaded:
sudo modprobe vboxdrv vboxnetadp vboxnetflt
- In the project folder, run
otto compile
- Run
otto dev
this will start a virtual machine - Allow otto to install all of its dependencies
- Make a note of the IP that the virtual machine is running on.
- Log in to the virtual machine with
otto dev ssh
8b. Windows: Use Putty (or similar) to connect. 8c. Write the IP in the Host Name field. Press enter. 8d. Login: "vagrant" PW: "vagrant" - Run the PHP server with:
php -S 0.0.0.0:5000
- The server is now running on port 5000 on the IP printed out in step 5
Alternatively, install XAMPP/MAMP locally:
- Download MAMP https://www.mamp.info/en/downloads/
- Install the .pkg file you downloaded (next, next, continue, etc.)
- Open the MAMP application from Applications/MAMP/MAMP (the icon is a little elephant!)
- Inside MAMP, go to Preferences.../Web Server
- Select Apache and click the little folder icon to the right of "Document Root:". As "Document Root" you should choose the folder where your index.php file is located.
- Done. Start the server from MAMP by clicking 'Start Servers'. :)
- Start by downloading and installing XAMPP
- Open XAMPP Control Panel
- Move the folder www.teknologforeningen.fi to C:\xampp\htdocs
- Press "Start" on Apache-row
- In case Xampp fails to run Apache, make sure Xampp isn't being stopped by your antivirus program and try rebooting your computer
- If it starts successfully open your browser and type localhost/www.teknologforeningen.fi in the addressbar to check if it's up and running
- Ladda ner nyaste XAMPP från https://www.apachefriends.org/
- Kör vid behov chmod 755 xampp-linux-*-installer.run
- sudo ./xampp-linux-*-installer.run
- Lägg till din github-mapp till /opt/lampp/etc/httpd.conf, följ instruktioner på https://wiki.archlinux.org/index.php/Xampp
- chmod o+x /väg/till/din/mapp/
- Fungerar kanske? Om inte så hjälper StackExchange.
TäffäAPI or as it is referred to in code, TaffaAPI is a class for easy access to the taffa API located at http://api.teknolog.fi/taffa/