# eclipsefdn-webdev-toolkit ## Getting Started You can clone all our projects with the exception of our php projects, by simply running the [import-all.sh](https://gitlab.eclipse.org/eclipsefdn/it/webdev/eclipsefdn-webdev-toolkit/-/blob/master/import-all.sh) script. Each project should have it's own README.md file. You should check them out for more information. (This is a new project, please don't hesitate to contribute documentation via a patch). ```bash bash import-all.sh ``` Review the projects-php folder for more instructions on those. ### SSH keys An SSH key is an access credential for the SSH (secure shell) network protocol. This authenticated and encrypted secure network protocol is used for remote communication between machines on an unsecured open network. * [Generating a new SSH key and adding it to the ssh-agent](https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) #### Keychain [Keychain](https://www.funtoo.org/Keychain) helps you to manage SSH and GPG keys in a convenient and secure manner. It acts as a frontend to ssh-agent and ssh-add, but allows you to easily have one long running ssh-agent process per system, rather than the norm of one ssh-agent per login session. This dramatically reduces the number of times you need to enter your passphrase. With keychain, you only need to enter a passphrase once every time your local machine is rebooted. Keychain also makes it easy for remote cron jobs to securely "hook in" to a long-running ssh-agent process, allowing your scripts to take advantage of key-based l ### Update your Host file We use [jwilder/nginx-proxy](https://hub.docker.com/r/jwilder/nginx-proxy) as automated Nginx reverse proxy for our docker containers. So instead of having to lookup the port of a new service, you can simply remember it's internal dev hostname. If you create a new project, don't forget to add it to the list. Different operating system, different file paths! Windows: C:\Windows\System32\drivers\etc\hosts Linux / MacOS: /etc/hosts ``` # localdev/make/projects 127.0.0.1 accounts.eclipse.dev.docker 127.0.0.1 api.eclipse.dev.docker 127.0.0.1 babel.eclipse.dev.docker 127.0.0.1 blogs.eclipse.dev.docker 127.0.0.1 dev.eclipse.dev.docker 127.0.0.1 drupal-php5.3.dev.docker 127.0.0.1 drupal-php5.5.dev.docker 127.0.0.1 drupal9.dev.docker 127.0.0.1 eclip.dev.docker 127.0.0.1 eclipse.dev.docker 127.0.0.1 eclipsecon.dev.docker 127.0.0.1 www.eclipsecon.dev.docker 127.0.0.1 foundation.eclipse.dev.docker 127.0.0.1 marketplace.eclipse.dev.docker 127.0.0.1 newsroom.eclipse.dev.docker 127.0.0.1 projects.eclipse.dev.docker 127.0.0.1 sandbox.dev.docker 127.0.0.1 solr.dev.docker 127.0.0.1 mariadb.dev.docker 127.0.0.1 wiki.eclipse.dev.docker 127.0.0.1 enrollment.dev.docker 127.0.0.1 threadxalliance.dev.docker 127.0.0.1 www.rem.docker 127.0.0.1 keycloak.dev.docker 127.0.0.1 api.rem.docker 127.0.0.1 ldap-admin.rem.docker 127.0.0.1 nginx.rem.docker 127.0.0.1 mariadb 127.0.0.1 gitlab.eclipse.dev.docker 127.0.0.1 matomo.dev.docker # okd 127.0.0.1 console-openshift-console.apps.okd-c1.eclipse.org oauth-openshift.apps.okd-c1.eclipse.org grafana-openshift-monitoring.apps.okd-c1.eclipse.org api.okd-c1.eclipse.org 127.0.0.1 keycloak-foundation-internal-infra-apps.apps.okd-c1.eclipse.org 127.0.0.1 api-int.okd-c1.eclipse.org ``` ## Export Aliases Checkout our [bashrc](bashrc) file for useful aliases such as `docker-exec-blog-php` or `docker-exec-stack-blog-php` to `ssh` to the php-blog container. ## Requirements Refer to the config-samples directory for templates for your dev environment. Here's a list of things that you will need: * docker * hugo * nodejs / npm * drush * git * Eclipse IDE * vscode * Chrome / Firefox * [eclipsefdn-home-data](https://github.com/chrisguindon/eclipsefdn-home-data) ### eclipsefdn-home-data For many sites, you will need to use our database connection classes. In order to do so, please clone [eclipsefdn-home-data](https://github.com/chrisguindon/eclipsefdn-home-data) in ~/localdev/eclipsefdn-home-data. This path is used in many docker-compose.yml file. 1. Update username and password: https://github.com/chrisguindon/eclipsefdn-home-data/blob/master/httpd/eclipse-php-classes/system/DBConnectionBase.php 2. Update LDAP configs: https://github.com/chrisguindon/eclipsefdn-home-data/blob/master/httpd/eclipse-php-classes/system/ldapconnection.class.php ### Docker Docker is a container engine that uses the Linux Kernel features like namespaces and control groups to create containers on top of an operating system. * [Docker Get Started](https://www.docker.com/get-started) * [Windows Subsystem for Linux Installation Guide for Windows 10](https://docs.microsoft.com/en-us/windows/wsl/install-win10). This is useful is you are on Windows. #### Known issues with Windows If Avast Firewall is blocking internet access of WSL2, all you have to do is go to Settings -> Protection -> Firewall -> Check the Internet Connection Sharing Mode. With that setting, you will be able to access the internet on WSL2 without disabling Avast Firewall. ### Hugo [Hugo](https://gohugo.io/about/what-is-hugo/) is a fast and modern static site generator written in Go, and designed to make website creation fun again. To get started with out Hugo projects, checkout our [hugo-solstice-theme](https://github.com/EclipseFdn/hugo-solstice-theme). ### Nodejs / npm [Node.js](https://nodejs.org/en/) is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser. We use it a lot with our hugo and reactsjs projects. Consider using [Node Version Manager](https://github.com/nvm-sh/nvm). ### php-env Install multiple PHP versions and automatically switch versions for each directory. Follow the [instructions](https://github.com/phpenv/phpenv#installation) from the project to install. Not sure if it's needed but before I installed this, I took the time to remove php7.4 from my laptop. I also needed to install a bunch of packages to succesfully build php. ```bash sudo apt-get update && sudo apt-get remove -y php-common php7.4-cli php7.4-json php7.4-common php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath # remove php-7.4 sudo apt-get install libonig-dev libtidy-dev libjpeg-dev libpng-dev libcurl4-openssl-dev libxslt-dev libzip-dev libxml2-dev # install dependencies ``` ### Drush [Drush]( https://www.drush.org/latest/) is a command line shell and Unix scripting interface for Drupal. We use drush-7.x for sites running php5.3 and drush-8.4.6 for servers with php5.5. We need to start thinking about the future of these applications. Drupal 7 will reach end-of-life in November of 2022 - [PSA-2019-02-25](https://www.drupal.org/psa-2019-02-25) ```bash mkdir -p ~/bin && cd ~/bin/ scp api-vm1:webdev/drush/drush-7.x.tar.gz . && tar -xzvf drush-7.x.tar.gz scp api-vm1:webdev/drush/drush-8.4.6.tar.gz . && tar -xzvf drush-8.4.6.tar.gz ``` Add the version you wish to use to your paths. These were compiled with PHP 7.4.3. You can checkout the Dockerfile from the projects/docker-php.5.5 to see how it was installed. #export PATH=$PATH:$HOME/bin/drush-7.x #export PATH=$PATH:$HOME/bin/drush-8.4.6 (recommended) ### Eclipse When installing Eclipse IDE, please add the formatters under the `./config-samples/eclispe` folder under `Window > Preferences > Java > Code Style > Formatter` and select the new formatter option (should be Eclipse Tweaked). This should standardize at least formatting of Java files in Eclipse. Additionally, you should install a decompiler (Enhanced Code Decompiler is a good one) and Sonarlint. ## Things you should consider This section is meant to share useful tools that you would like to recommend to the team! * [Oh My Zsh](https://ohmyz.sh/) * [Powerlevel10k](https://github.com/romkatv/powerlevel10k)