Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add local refresh script #198

Merged
merged 16 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ services:
volumes:
- ./app/api:/var/www/html
environment:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID-}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY-}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN-}
PHP_IDE_CONFIG: "serverName=vol.local.api"
VIRTUAL_HOST: api.local.olcs.dev-dvsacloud.uk
VIRTUAL_PORT: 8080
Expand All @@ -38,9 +38,9 @@ services:
volumes:
- ./app/api:/var/www/html
environment:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID-}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY-}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN-}
PHP_IDE_CONFIG: "serverName=vol.local.api"

selfserve:
Expand All @@ -52,9 +52,9 @@ services:
volumes:
- ./app/selfserve:/var/www/html
environment:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID-}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY-}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN-}
PHP_IDE_CONFIG: "serverName=vol.local.selfserve"
VIRTUAL_HOST: ssweb.local.olcs.dev-dvsacloud.uk
VIRTUAL_PORT: 8080
Expand All @@ -68,9 +68,9 @@ services:
volumes:
- ./app/internal:/var/www/html
environment:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID-}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY-}
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN-}
PHP_IDE_CONFIG: "serverName=vol.local.internal"
VIRTUAL_HOST: iuweb.local.olcs.dev-dvsacloud.uk
VIRTUAL_PORT: 8080
Expand Down Expand Up @@ -105,5 +105,18 @@ services:
MYSQL_USER: mysql
MYSQL_PASSWORD: olcs

openldap:
image: bitnami/openldap:2.6
ports:
- "1389:1389"
environment:
- LDAP_ADMIN_USERNAME=admin
- LDAP_ADMIN_PASSWORD=admin
- LDAP_ROOT=dc=vol,dc=dvsa
- LDAP_ADMIN_DN=cn=admin,dc=vol,dc=dvsa
volumes:
- "openldap-data:/bitnami/openldap"

volumes:
db-data:
openldap-data:
94 changes: 94 additions & 0 deletions docs/app/local-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
sidebar_position: 20
---

# Local Setup

## Before you start

:::tip

You can use the pre-configured devcontainers in the `.devcontainer` directory to get started quickly.

:::

You will need:

- [Git](https://git-scm.com/) `git --version`
- [Docker with Compose](https://docs.docker.com/manuals/) `docker -v`
- [Node.js 20](https://nodejs.org/en/) `node -v`
- [PHP 8.2](https://www.php.net/) `php -v`
- [Composer](https://getcomposer.org/) `composer -V`
- [AWS CLI](https://aws.amazon.com/cli/) `aws --version`

## Getting started

1. Clone the repository

```bash
git clone [email protected]:dvsa/vol-app.git
```

1. Change into the project directory

```bash
cd vol-app
```

:::warning

If you are resetting the database you will need to be be authenticated with the AWS VOL `nonprod` account.

If you have the ZSH AWS plugin installed & configured, you can run the following command to get temporary credentials:

```bash
acp [profile]
```

:::

## Running the app

1. Install the NPM dependencies in the root directory

```bash
npm install
```

1. Add DNS entries to your `/etc/hosts` file

:::warning

You only need to do this once.

:::

```bash
sudo echo "127.0.0.1 iuweb.local.olcs.dev-dvsacloud.uk ssweb.local.olcs.dev-dvsacloud.uk api.local.olcs.dev-dvsacloud.uk cdn.local.olcs.dev-dvsacloud.uk" >> /etc/hosts
```

1. Start the application

```bash
docker-compose up -d
```

1. Run the local setup script - this script will also as a local reset and is safe to run multiple times.

:::info

If this is the first time you are running the application, you will need to run all the steps.

:::

```bash
npm run refresh
```

:::success

All done!

Visit the application in your browser: - [Internal Application](http://iuweb.local.olcs.dev-dvsacloud.uk) - [Self Service Application](http://ssweb.local.olcs.dev-dvsacloud.uk)

:::
5 changes: 5 additions & 0 deletions infra/docker/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ RUN apk add --no-cache linux-headers $PHPIZE_DEPS \
&& docker-php-ext-enable xdebug \
&& apk del linux-headers $PHPIZE_DEPS

RUN apk update && \
apk add --no-cache openldap-dev \
&& docker-php-ext-install ldap \
&& docker-php-ext-enable ldap

RUN \
# Disable OPCache in development.
echo "opcache.enable=0" >> ${PHP_INI_DIR}/conf.d/1000-php.ini \
Expand Down
Loading