Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Getting started

Pavel Skipenes edited this page Feb 10, 2022 · 25 revisions

This guide will help you to set up your development environment so you can start development as soon as possible.

The code base is being run inside a docker container that contains all the packages. This is recommended because you will not trash your computer with a ton of programs and the development environment will stay the same across different systems.

First installation

Mac

brew install --cask git visual-studio-code composer docker docker-compose unzip insomnia
git clone --recursive [email protected]:NTNUI/org.ntnu.svommer.git
cd org.ntnu.svommer
composer install
docker-compose --build -d

Arch Linux

pacman -Syu yay # update the system repositories and install AUR helper
yay -Syu github-desktop-bin git docker docker-compose insomnia visual-studio-code-bin composer unzip --no-confirm # install packages
sudo usermod -aG docker $USER # A shell restart might be needed after this command.
git clone --recursive [email protected]:NTNUI/org.ntnu.svommer.git
cd org.ntnu.svommer
systemctl enable docker --now
composer install
docker-compose --build -d

Windows

Install Linux and follow steps above.


You should now be up and running. The web site is accessible at https://127.0.0.1 and phpmyadmin is accessible at https://127.0.0.1:42069.

Note: the docker image is creating it's own self signed certificate. That means when you access the site for the first time after it's built you'll need to accept the self signed certificate. And every time you rebuild the image a new certificate is created.

Now that the site is up you can access it however it does not have any content.

Import content

assuming your username is pavelgs and live server is hosted on login.stud.ntnu.no

scp -r [email protected]:svommer/{translations,img} .

Accessing phpmyadmin

phpmyadmin can be accessed through web interface on http://127.0.0.1:42069. Default credentials are svommer_web, testing_password

Enrollment

Enrollment may or may not be disabled. You'll need to enter the docker container manually and change the settings accordingly. Enrollment is active only when the site wants to accept new memberships. run docker exec -it apache /bin/ash to get shell access. Then modify the file /var/www/apache2/htdocs/settings/settings.json.

  "enrollment": {
      "open": "auto",
      "start_month": "january",
      "start_day": 5,
      "end_month": "december",
      "end_day": 1
  }

This are the default settings. open accepts true, false and auto. When open is set to auto it will read the following lines and open / close the enrollment accordingly.

Update API keys

API keys are stored in /var/www/apache2/htdocs/settings/settings.json. You'll need to get docker shell access by running docker exec -it web /bin/ash and modify these lines:

  "captcha_key": "CAPTCHA_API_KEY",
  "stripe": {
    "secret_key": "STRIPE_SECRET_KEY",
    "publishable_key": "STRIPE_PUBLISHABLE_KEY",
    "signing_key": "STRIPE_SIGNING_KEY"
  }

Stripe API keys can be obtained by logging in to stripe, navigating to somewhere where it says API keys and remember to turn on testing mode so you get the testing keys. The repository ships with test keys by default.

TODO: Google captcha keys

Clone this wiki locally