Skip to content

Commit

Permalink
Updated README to reflect changes required for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
kjallen committed May 17, 2024
1 parent f9e6014 commit ea97741
Showing 1 changed file with 28 additions and 51 deletions.
79 changes: 28 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,95 +5,72 @@
3. Install Dory: https://github.com/FreedomBen/dory
4. Configure dory: https://github.com/FreedomBen/dory#config-file
Add the following to the config-file

```bash
- domain: test
address: 127.0.0.1
```

5. Run dory:

```bash
dory up
```

6. Build project and start up
``` bash

```bash
docker compose build
docker compose up
```

7. Visit http://oralhistory.test in your browser.
8. Load database and import data

```
docker compose exec web bundle exec rake db:migrate
docker compose exec web bundle exec rake db:seed
docker compose exec web bundle exec rake import[100]
```

9. Sign into the Admin Dashboard
Navigate to https://oralhistory.test/users/sign_in
Login with default the seeded user and password at db/seeds.rb
Note you can add those ENV variable to your .env file to update
the values in one place. But deafults are set so make sure you
update for produciton environment.
Navigate to https://oralhistory.test/users/sign_in
Login with default the seeded user and password at db/seeds.rb
Note you can add those ENV variable to your .env file to update
the values in one place. But deafults are set so make sure you
update for produciton environment.

10. Common Developer Recipes:
Drop into a bash console inside docker container: `docker compose exec container-name bash`. Example: `docker compose exec web bash`
Drop into a sh console inside docker container: `docker compose exec container-name sh`. Example: `docker compose exec web sh`
Drop into a rails console: `docker compose exec bundle exec rails c`
Drop into a bash console inside docker container: `docker compose exec container-name bash`. Example: `docker compose exec web bash`
Drop into a sh console inside docker container: `docker compose exec container-name sh`. Example: `docker compose exec web sh`
Drop into a rails console: `docker compose exec bundle exec rails c`

**Note:** The `100` in `import[100]` limits the number of assets initially loaded. You may adjust this as desired.

## Development Notes

When performing an import the system will attempt to download and process the audio files to create the peak files. This is very CPU & time intense.
**To avoid this** change `MAKE_WAVES` in your `.env` to false (or delete it).

---

# Automated Build and Deploy
# Build and Deploy Process

## Testing/Staging
Optional: Contact DevSupport for Argo account for log access

Any push to GitHub of a branch with "test" will build, tag with :test, publish to Docker Hub and push to testing.
### Application Only Changes

Any push to GitHub of a branch other than master, main, or test will build, tag with :staging, publish to Docker Hub and push to staging.
- Create a branch and create the changes to the application code

## Production
- The `version` field must be incremented in `charts/Chart.yaml`

Any push to GitHub of the master or main branch will build, tag with :lastest, and publish to Docker Hub. It is up to Apps team or DevSupport to push to production.
- Submit a pull request. On _submission_ or merge of a pull request, a container image is built and pushed to Docker Hub.

# Manually Deploy a new release

## Docker tags

There are three common tags in use for Oral History:
- `latest`: Tag Jenkins deploys to production
- `staging`: Tag Jenkins deploys to test
- `date`: (in ISO 8601 format) Allows forcible rollback to a previous version

## Building

To build and apply the Docker tags:

``` bash
docker build \
-t uclalibrary/oral-history:staging \
-t uclalibrary/oral-history:latest \
-t uclalibrary/oral-history:"$(date +%Y.%m.%d)" \
.
```

## Pushing to Dockerhub

Docker can only push one tag at a time. It is recommended to push all three
tags.

``` bash
for tag in staging latest "$(date +%Y.%m.%d)"; do
docker push uclalibrary/oral-history:"$tag";
done
```
- Navigate to Docker Hub and note the image tag, which is the first 8 characters of the hash.

Deployment is handled by Jenkins.
- In the appropriate `charts/[envrionment]-oralhistory-values.yaml` file, update the `image: tag` value to the tag copied from above.

## Manual deployment to test
- Commit and update the pull request to reflect the new build. Because a pull request is submitted another container image build will be triggered -- using this process, the deployed image is always at least one "behind" the most recently submitted pull request.

In Jenkins, select `docker_swarm_deploy` job. Use `Build with Parameters`. Select `oralhistory_test` from the `TERRA_ENV` dropdown. Start the build.
With the `image: tag` value updated a build will automatically be deployed when updating `[stage,test]-oralhistory-values.yaml`. For production, the file should be updated and DevSupport notified.

## Production Notes:

Expand Down

0 comments on commit ea97741

Please sign in to comment.