Giter Club home page Giter Club logo

coding-challenge-setup's Introduction

Coding Challenge Setup

Forking (public)

Note: Please see Mirroring (private) if you do not want this repo to show up publicly on your Github profile.

When forking this repository, you need to explicitly activate Github Actions in the "Actions" tab of your fork to make use of the built-in CI capabilities, as

Workflows don't run on forked repositories by default. You must enable GitHub Actions in the Actions tab of the forked repository.

Source: GitHub Docs

Mirroring (private)

Unfortunately, Github does not allow making forks of a public repository private. Instead, they recommend mirroring the repository as documented here.

The steps for this repository are:

  • create a new private repository named coding-challenge-setup
  • clone this repository
    git clone --bare https://github.com/paslandau/coding-challenge-setup.git
    
  • mirror-push the repository
    cd coding-challenge-setup.git
    git push --mirror [email protected]:<username>/coding-challenge-setup.git
    
  • delete the local copy of this repository
    cd ..
    rm -rf coding-challenge-setup.git
    

You can now simply clone "your own" repository.

Preconditions

docker and docker-compose

make

Check upfront if already installed via:

$ make --version
GNU Make 4.2.1

Setup

A docker setup is provided in the .docker folder following the structure defined here and can be set up via make commands:

make docker-setup

make docker-up

Please verify that docker is running successfully via docker ps

$ docker ps
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                                NAMES
11e85f1fe115        coding-challenge/mysql       "docker-entrypoint.s…"   3 hours ago         Up 3 hours          33060/tcp, 0.0.0.0:33060->3306/tcp   coding-challenge_mysql_1
b37211637853        coding-challenge/workspace   "/bin/docker-entrypo…"   3 hours ago         Up 3 hours          0.0.0.0:2222->22/tcp                 coding-challenge_workspace_1

Once docker is running, the application can be setup via make commands as well:

make setup

IDE integration with PhpStorm is described here for reference. Please note, that we're using password based authentication instead of an (insecure) private key file. The password is generated randomly and can be found at .docker/.env in the variable WORKSPACE_SSH_PASSWORD.

Create BigQuery key file

BigQuery is a central component in our infrastructure. The BigQuery SDK is already included in the dependencies of this project, but you will need to create a service account with a corresponding credential file and add it to this repository in order to complete the setup task.

Note: We recommend the usage of a .json key file as described in this step by step tutorial on Service Account based Authentication. See the official authentication instructions for more details.

Please make sure to name the file google-cloud-key.json (ignored via .gitignore) and put it in the root of the repository. It should look like this:

{
  "type": "service_account",
  "project_id": "<your-project>",
  "private_key_id": "3a88f2...66c18120",
  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBA...bMq+ktxb\n-----END PRIVATE KEY-----\n",
  "client_email": "coding-challenge@<your-project>.iam.gserviceaccount.com",
  "client_id": "1127...3003",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/coding-challenge%40<your-project>.iam.gserviceaccount.com"
}

Task

Please "verfiy" the setup via make verify. You should see the following output:

$ make verify
vendor/bin/phpcs -p -n --standard=PSR12 app/ domain/
.................... 20 / 20 (100%)


Time: 522ms; Memory: 8MB

vendor/bin/phpunit -c phpunit.xml
PHPUnit 9.2.5 by Sebastian Bergmann and contributors.

...                                                                 3 / 3 (100%)

Time: 00:00.522, Memory: 20.00 MB

OK (3 tests, 3 assertions)
php artisan verify
Gathering PHP settings...
[OK]

Verifying MySql database connection...
[OK]

Verifying BigQuery connection...
[OK]

Writing verification file...
[OK]

Done.

The verify make target will also create a verification file in the root of this repository.

Please

  • add a new commit including the verification file
  • push it to your repository and
  • send us a link to your repository

Note: If you created a private repository, please add the user paslandau as a collaborator.

coding-challenge-setup's People

Contributors

pascallandau-ay avatar paslandau avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.