Skip to content

Commit

Permalink
Merge branch 'release/2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
marteinn committed Feb 25, 2024
2 parents 1add742 + b684d35 commit 23239de
Show file tree
Hide file tree
Showing 20 changed files with 156 additions and 173 deletions.
54 changes: 31 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,43 @@ references:
keys:
- v2-repo-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}

jobs:
checkout_code:
<<: *defaults
executors:
base:
docker:
- image: frojd/elixir-ubuntu-20-04:1.13
- image: postgis/postgis:12-2.5-alpine
- image: circleci/python:3.8
steps:
- checkout
- save_cache:
key: v2-repo-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- .
phoenix:
<<: *defaults
- image: cimg/base:stable-22.04
elixir_with_postgres:
docker:
- image: frojd/elixir-ubuntu-20-04:1.13
- image: ghcr.io/frojd/dockerimages/elixir-ubuntu-22-04:1.16
environment:
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_NAME: postgres
DATABASE_TEST_NAME: postgres_test
DATABASE_TEST_NAME: circle_test
DATABASE_HOST: localhost
REDIS_HOST: localhost
- image: postgis/postgis:12-2.5-alpine
DATABASE_PORT: 5432
- image: postgis/postgis:10-2.5-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_HOST_AUTH_METHOD: trust
python:
docker:
- image: cimg/python:3.8.13

jobs:
checkout_code:
<<: *defaults
executor: base
steps:
- checkout
- save_cache:
key: v2-repo-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- .
phoenix:
<<: *defaults
executor: elixir_with_postgres
steps:
- *attach_workspace
- *restore_repo
Expand Down Expand Up @@ -107,20 +114,21 @@ jobs:

deploy:
<<: *defaults
docker:
- image: circleci/python:3.8
executor: python
steps:
- *attach_workspace
- *restore_repo
- restore_cache:
keys:
- v2-phoenix-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- v2-deploy-{{ checksum "deploy/requirements.txt" }}
- run:
command: |
sudo apt-get update && sudo apt-get install -y rsync
- run:
command: |
cd deploy
python3 -m venv venv
sudo apt-get -y -qq install rsync
. venv/bin/activate
pip install -r requirements.txt
ansible-galaxy install -r requirements.yml
Expand All @@ -135,11 +143,11 @@ jobs:
. venv/bin/activate
if [ "${CIRCLE_BRANCH}" == "develop" ]; then
ansible-playbook deploy.yml -i stages/stage
ansible-playbook deploy.yml -i stages/stage.yml
fi
if [ "${CIRCLE_TAG}" ]; then
ansible-playbook deploy.yml -i stages/prod
ansible-playbook deploy.yml -i stages/prod.yml
fi
workflows:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-boilerplate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Copy env
run: cp docker/config/elixir.example.env docker/config/elixir.env
Expand Down
67 changes: 50 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,59 @@
# Changelog

## 2.1.0 (2022.01.06)
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
### Changed
### Fixed
### Removed

## [2.2.0] - 2024-02-25

### Changed
- Rename .tool-versions to local.tool-versions to indicate it is only used locally
- Replace distillery with mix release

### Fixed
- Upgrade Elixir to 1.16
- Upgrade Ubuntu to 22.04
- Add Circle CI executors
- Bump actions/checkout to v4
- Upgrade Phoenix to 1.7
- Use YAML formatted ansible host config

## [2.1.0] - 2022-01-06

### Fixed
- Upgrade Phoenix to 1.6.6
- Upgrade Elixir to 1.13
- Use official elixir docker image for development
- Use IP 0.0.0.0 for local phoenix server


- Fix: Upgrade Phoenix to 1.6.6
- Fix: Upgrade Elixir to 1.13
- Fix: Use official elixir docker image for development
- Fix: Use IP 0.0.0.0 for local phoenix server
## [2.0.1] - 2021-05-26

### Added
- Add CI for testing boilerplate (Martin Sandström)

## 2.0.1 (2021.05.26)
### Fixed
- Move SSL handling to Nginx (Martin Sandström)

- New: Add CI for testing boilerplate (Martin Sandström)
- Fix: Move SSL handling to Nginx (Martin Sandström)

## [2.0.0] - 2021-05-11

## 2.0.0 (2021.05.11)
### Added
- Use Nginx as a server proxy (Martin Sandström)
- Add way of runnign dock containeraized and local version of Elixir (Martin Sandström)
- Add command for cleaning up scaffolded files (Martin Sandström)
- Add MIT license

- New: Use Nginx as a server proxy (Martin Sandström)
- New: Add way of runnign dock containeraized and local version of Elixir (Martin Sandström)
- New: Add command for cleaning up scaffolded files (Martin Sandström)
- New: Add MIT license
- Fix: Add security
- Fix: Upgrade Elixir to 1.11 (Martin Sandström)
- Fix: Upgrade Phoenix to 1.5 (Martin Sandström)
- Fix: Use PostgreSQL 12 (Martin Sandström)
### Fixxed
- Add security
- Upgrade Elixir to 1.11 (Martin Sandström)
- Upgrade Phoenix to 1.5 (Martin Sandström)
- Use PostgreSQL 12 (Martin Sandström)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
XThe MIT License (MIT)

Copyright (c) 2019-2021 Fröjd Interactive
Copyright (c) 2019-2024 Fröjd Interactive

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ This is a Phoenix/Elixir boilerplate that includes a auto-setup, docker support

## Features

- Built in compile target support for Ubuntu 20.04
- Elixir 1.13
- Phoenix 1.6
- Built in compile target support for Ubuntu 22.04
- Elixir 1.16
- Phoenix 1.7
- OTP 25
- Auto scaffolding (with `phx.new`)
- Dependencies and db migrations are automatically run when starting/restarting docker

Expand Down Expand Up @@ -111,6 +112,7 @@ This is a Phoenix/Elixir boilerplate that includes a auto-setup, docker support
8. Start phoenix
```
cd src
mv local.tool-versions .tool-versions
asdf install
source env.local.sh
mix deps.get
Expand Down Expand Up @@ -139,8 +141,8 @@ This is a Phoenix/Elixir boilerplate that includes a auto-setup, docker support
#### Deploy application
- Stage: `ansible-playbook deploy.yml -i stages/stage`
- Prod: `ansible-playbook deploy.yml -i stages/prod`
- Stage: `ansible-playbook deploy.yml -i stages/stage.yml`
- Prod: `ansible-playbook deploy.yml -i stages/prod.yml`
## Style Guide
Expand Down
1 change: 1 addition & 0 deletions deploy/group_vars/webservers
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ ansistrano_deploy_to: /mnt/persist/www/example_app
database_name: example_app_db
database_user: example_app
project_slug: example_app
phoenix_app_name: ExampleApp
3 changes: 0 additions & 3 deletions deploy/stages/prod

This file was deleted.

7 changes: 7 additions & 0 deletions deploy/stages/prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
webservers:
hosts:
prod1:
ansible_user: deploy
ansible_port: 22
ansible_host: example.com
stage_name: prod
2 changes: 0 additions & 2 deletions deploy/stages/stage

This file was deleted.

7 changes: 7 additions & 0 deletions deploy/stages/stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
webservers:
hosts:
stage1:
ansible_user: deploy
ansible_port: 22
ansible_host: stage.example.com
stage_name: stage
6 changes: 3 additions & 3 deletions deploy/tasks/after-update-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@

- name: Copy current release
unarchive:
src: "{{ ansistrano_release_path.stdout }}/src/_build/{{ mix_env }}/rel/{{ app_name }}/releases/{{ rel_vsn.stdout }}/{{ app_name }}.tar.gz"
src: "{{ ansistrano_release_path.stdout }}/src/_build/{{ mix_env }}/{{ app_name }}-{{ rel_vsn.stdout }}.tar.gz"
dest: "{{ ansistrano_release_path.stdout }}/compiled_app/"
remote_src: yes

- name: Symlink phoenix app config
file:
src: "{{ ansistrano_shared_path }}/config.toml"
dest: "{{ ansistrano_release_path.stdout }}/compiled_app/config.toml"
dest: "{{ ansistrano_release_path.stdout }}/compiled_app/bin/config.toml"
state: link
force: yes

- name: Run migrations
command: "./{{ app_name }} migrate"
command: "./{{ app_name }} eval '{{ phoenix_app_name }}.Release.migrate'"
args:
chdir: "{{ ansistrano_release_path.stdout }}/compiled_app/bin"
2 changes: 0 additions & 2 deletions src/.tool-versions

This file was deleted.

4 changes: 2 additions & 2 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM elixir:1.13
FROM ghcr.io/frojd/dockerimages/elixir-ubuntu-22-04:1.16

ENV SCAFFOLD_APP_NAME=phoenix_app \
DATABASE_USER=postgres \
Expand All @@ -15,7 +15,7 @@ RUN apt-get update \
&& apt-get install -y inotify-tools vim netcat \
&& rm -rf /var/lib/apt/lists/*

RUN mix archive.install --force hex phx_new 1.6.6
RUN mix archive.install --force hex phx_new 1.7.11

WORKDIR /app
ADD . /app
Expand Down
10 changes: 9 additions & 1 deletion src/_templates/config/prod.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
use Mix.Config
use Config

config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: ExampleApp.Finch

# Disable Swoosh Local Memory Storage
config :swoosh, local: false

# Do not print debug messages in production
config :logger, level: :info

# For production, don't forget to configure the url host
# to something meaningful, Phoenix uses this information
Expand Down
85 changes: 0 additions & 85 deletions src/_templates/lib/example_app/release_tasks.exs

This file was deleted.

Loading

0 comments on commit 23239de

Please sign in to comment.