New around here? Register your SA Forums Account here!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $10! We charge money because it costs us money per month for bills alone, and since we don't believe in shady internet advertising, we try to make the money back through forum registrations.
 
  • Post
  • Reply
DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

leftist heap posted:

there are multiple layers of badness to it.

git does not handle submodules well at all. from top to bottom it is way more of a pita than it should be. SVN linked repos were easier to work with ffs.

people also largely use them for lazy, ad-hoc dependency management in a way that's awful, fragile and stupid.


yes, this is effectively ad hoc dependency management and you're basically 100% always better off doing it whatever the "right way" is for your lang/environment

facts

Adbot
ADBOT LOVES YOU

redleader
Aug 18, 2005

Engage according to operational parameters

Arcsech posted:

git submodules are where one git repo includes a pointer to specific commit in another git repo, that gets checked out inside the main one as a directory

Fiedler posted:

what if your git repo could incorporate by reference other git repos?

tyvm :tipshat:

Plorkyeran
Mar 21, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
the really amazing thing about git submodules is that the tools actually have gotten quite a bit better over the years

it's just that the starting point was that you had to hand-edit the files in the .git directory for a bunch of operations and even completly trivial and routine things would leave your local state totally hosed

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

my computer is a pos and cant run the docker daemon

i read somewhere that heroku lets you run docker images on the free tier, c/d?

tried to do heroku container:push but it complains that the daemon isnt running. is that a hard requirement to use the client/build images or can i bypass that somehow?

eschaton
Mar 7, 2007

the knowledge knower. a wisdom imparter. irritatingly self-assertive. odorous.

florida lan posted:

OP definitely needs SOAP. SOAP makes everything better.

remember how one of the promises of SOAP was that enterprise middleware would be created to work with services in a completely content agnostic manner

eschaton
Mar 7, 2007

the knowledge knower. a wisdom imparter. irritatingly self-assertive. odorous.

Progressive JPEG posted:

I wonder if there's a way to have preprocessor macros that change behavior depending on the time of day or calendar day the build is occurring

builds that only work m-f 9-5 with a 30 minute break for lunch

builds that produce different output on April 1 and/or April 20

it’s really too bad that __DATE__ is a string

fortunately in most build systems you can just call out to date (with whatever arguments and environment you want, of course, like setting TZ to some half- or quarter-hour offset timezone) and then use its output to do things like populate header files or be used in macros

distortion park
Apr 25, 2011


eschaton posted:

remember how one of the promises of SOAP was that enterprise middleware would be created to work with services in a completely content agnostic manner

lol

Soricidus
Oct 20, 2010
freedom-hating statist shill
my favorite thing in git submodules is when they point to an old commit in some dev’s private branch that’s not in github because I guess it got rebased out of existence and then gc’d or something, so you just can’t build that code any more unless you do a bunch of archaeology to identify an extant commit that’s close enough

animist
Aug 28, 2018
git subtree's decent in that it's mostly transparent to whoever's pulling your repo

gonadic io
Feb 16, 2011

>>=

Krankenstyle posted:

my computer is a pos and cant run the docker daemon

i read somewhere that heroku lets you run docker images on the free tier, c/d?

tried to do heroku container:push but it complains that the daemon isnt running. is that a hard requirement to use the client/build images or can i bypass that somehow?

Do you mean the heroku CLI tool?
https://devcenter.heroku.com/articles/container-registry-and-runtime#building-and-pushing-image-s
Yes it requires docker running.

Heroku is for running apps, not your build process. To run docker in your build process on the cloud for free, you want something like circleci, Travis, azure pipelines, github build or whatever.

Then as one of the steps in your build you can push to wherever you are running the app eg have circleci run heroku push. I'm on gcp free tier myself and reasonably happy with it. So I have circle push to the google container registry, then I SSH only my compute instance and docker pull/docker run.

Note that this is going to be a little painful, and probably take 10 mins or so to do a cycle (unless you do some fancy caching) so you don't _really_ want it to be your only way to compile for example.

E: you could also get a free tier compute or aws instance, and just SSH in and run docker on there manually but I wouldn't recommend this compared to using a proper build pipeline

gonadic io fucked around with this message at 08:25 on May 23, 2019

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

awesome, gonna try those out :)

its just for testing stuff when working from home so i dont care about the platform, just getting it up & running

we self-host at work & the network is locked down hard because we deal with a ton of personal data. im just a new grunt so no vpn for me yet

gonadic io
Feb 16, 2011

>>=

Krankenstyle posted:

awesome, gonna try those out :)

its just for testing stuff when working from home so i dont care about the platform, just getting it up & running

we self-host at work & the network is locked down hard because we deal with a ton of personal data. im just a new grunt so no vpn for me yet

here's a circleci file that i use in one of my projects:

it's basically a little above the absolute mvp, it has two steps: one runs docker build, and then if you're happy with it you can approve a docker push to a goog container registry. that way you can check that it compiles on every git push to any branch, and only push releases from master. there's way better things you can do but this is a really simple version. note that EU_GCR_API_KEY_JSON is an env var you've got to tell circle about in the settings

note that doing this in a pipeline requires that circle (or whatever alternative) has access to your github org, so you gotta get an admin to give it permission unless it's public. you'll need to do the ssh into a rented box method if you can't get that, I strongly advise against sneaking work code into e.g. your own personal github repo just to compile it

code:
version: 2
jobs:
  build:
    docker:
      - image: google/cloud-sdk
    steps:
      - checkout
      - setup_remote_docker
      - run: echo $EU_GCR_API_KEY_JSON | docker login -u _json_key --password-stdin [url]https://eu.gcr.io[/url]
      - run: docker build -t eu.gcr.io/butt-org/butt-project .
      - run: mkdir -p workspace
      - run: docker save -o workspace/butt-docker-image.tar eu.gcr.io/butt-org/butt-project
      - persist_to_workspace:
          root: ./workspace
          paths: butt-docker-image.tar

  deploy:
    docker:
      - image: google/cloud-sdk
    steps:
      - checkout
      - setup_remote_docker
      - run: echo $EU_GCR_API_KEY_JSON | docker login -u _json_key --password-stdin [url]https://eu.gcr.io[/url]

      - attach_workspace:
          at: ./workspace

      - run: docker load -i workspace/butt-docker-image.tar
      - run: docker push eu.gcr.io/butt-org/butt-project

workflows:
  version: 2
  build_and_deploy:
    jobs:
      - build
      - deploy_approval:
          type: approval
          requires:
           - build
          filters:
            branches:
              only: master
      - deploy:
          requires:
            - build
            - deploy_approval
          filters:
            branches:
              only: master

e: loving url tags even in a code block, gently caress off

gonadic io fucked around with this message at 10:28 on May 23, 2019

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

nice! thanks!

the code itself is under CC-BY so shouldnt be an issue, but im just gonna do it from the work repo

necrotic
Aug 1, 2005
I owe my brother big time for this!
we are abusing postgres for storage of some large data and for one customer we might actually hit the transaction wraparound point, which is when postgres shuts down for safety. the vacuum tasks to prevent this have been running for a cool 20 days.

if my math is right they have ~3 days before it hits this point.

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

got it working on a 100% gcloud solution:

code:
# install reqs:
brew cask install google-cloud-sdk
brew install docker

# setup gcloud:
gcloud auth login
gcloud config set project [YOSPOS]

# build image in the butt:
gcloud builds submit --config cloudbuild.yaml .

# config firewall:
gcloud compute firewall-rules create allow-http --allow tcp:80 --target-tags [YOSPOS]
gcloud compute firewall-rules update allow-http --allow tcp:8000 --target-tags [YOSPOS]

# create/run free tier instance:
gcloud beta compute instances create-with-container [YOSPOS]-vm --container-image gcr.io/[YOSPOS]/[YOSPOS]-image --tags [YOSPOS]-server --machine-type=f1-micro

# ===== example cloudbuild.yaml ($PROJECT_ID is autoreplaced by gcloud) ==== #

steps:
- name: 'gcr.io/cloud-builders/docker'
  args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/[YOSPOS]-image', '.' ]
images:
- 'gcr.io/$PROJECT_ID/[YOSPOS]-image'
somewhat different from yours i guess gonads, but i couldnt have done it without u :kiss:

gonadic io
Feb 16, 2011

>>=

Krankenstyle posted:

got it working on a 100% gcloud solution:

code:
# install reqs:
brew cask install google-cloud-sdk
brew install docker

# setup gcloud:
gcloud auth login
gcloud config set project [YOSPOS]

# build image in the butt:
gcloud builds submit --config cloudbuild.yaml .

# config firewall:
gcloud compute firewall-rules create allow-http --allow tcp:80 --target-tags [YOSPOS]
gcloud compute firewall-rules update allow-http --allow tcp:8000 --target-tags [YOSPOS]

# create/run free tier instance:
gcloud beta compute instances create-with-container [YOSPOS]-vm --container-image gcr.io/[YOSPOS]/[YOSPOS]-image --tags [YOSPOS]-server --machine-type=f1-micro

# ===== example cloudbuild.yaml ($PROJECT_ID is autoreplaced by gcloud) ==== #

steps:
- name: 'gcr.io/cloud-builders/docker'
  args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/[YOSPOS]-image', '.' ]
images:
- 'gcr.io/$PROJECT_ID/[YOSPOS]-image'
somewhat different from yours i guess gonads, but i couldnt have done it without u :kiss:

oh you're also just running the server itself? fair enough, I would be a bit careful if those ports are open to the internet. also remember that only 1 free tier instance is free at a time, if you get 2 of them you pay for the second (it's not much though)

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

thx for the heads up

theres nothing dangerous on the server, it just does some open data processing

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

theres no way i can get it to error out or require extra auth if im about to do something that will cost money is there?

lol

necrotic
Aug 1, 2005
I owe my brother big time for this!
set a budget alert to $0 and you'll get an email at least

might need to do a whole buck or cent or something though i dunno.

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

necrotic posted:

set a budget alert to $0 and you'll get an email at least

might need to do a whole buck or cent or something though i dunno.

ah cool, that works. thx

gonadic io
Feb 16, 2011

>>=

Krankenstyle posted:

ah cool, that works. thx

i spent a while looking at automatically turning stuff off. basically the budget alert would trigger a cloud function which would turn off instances. it ended up being real fiddly and i had no confidence in it because it was difficult to test

necrotic
Aug 1, 2005
I owe my brother big time for this!

gonadic io posted:

i spent a while looking at automatically turning stuff off. basically the budget alert would trigger a cloud function which would turn off instances. it ended up being real fiddly and i had no confidence in it because it was difficult to test

yeah its kind of a nightmare to properly do. just setting an alert is your best bet.

if you really wanna go nuts turn on the billing export feature into bigquery and predict things. you get hourly level data for most services with that.

but just setting a budget alert you also get emails at 25, 50 and 90% towards the budget cap.

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
w.r.t git submodule, I'd rather put my terrible libraries into nuget packages than use submodule. That's how lovely it is.

elite_garbage_man
Apr 3, 2010
I THINK THAT "PRIMA DONNA" IS "PRE-MADONNA". I MAY BE ILLITERATE.
writing setup scripts in bash like its 2019

gonadic io
Feb 16, 2011

>>=
ctps: utc doesn't have time zones right? I'm trying to work out if
code:
let then = Utc::now();

// some time later
if Utc::now() - Duration(2, HOURS) < then { ... }
will gently caress me or if it's actually always going to be 2 hours of time.

Progressive JPEG
Feb 19, 2003

utc itself should remain flat over time, but exceptions might include:
- leap seconds but going by your 2h math they're probably not a factor
- computer with out of sync clock that gets resynced in the middle of your code running

Bloody
Mar 3, 2013

gonadic io posted:

ctps: utc doesn't have time zones right? I'm trying to work out if
code:
let then = Utc::now();

// some time later
if Utc::now() - Duration(2, HOURS) < then { ... }
will gently caress me or if it's actually always going to be 2 hours of time.

it will gently caress you

Progressive JPEG
Feb 19, 2003

FWIW in other time zones the math would indeed get broken when entering or exiting dst. the time and direction of dst varies by what time zone and country/hemisphere you're in according to laws that change fairly regularly. avoid any logic in local time zones, instead convert any local time into utc beforehand and then back from utc afterwards, and hope that your conversion tables are semi regularly updated

Chopstick Dystopia
Jun 16, 2010


lowest high and highest low loser of: WEED WEE
k

gonadic io posted:

time
will gently caress me

Bloody posted:

it will gently caress you

animist
Aug 28, 2018

wednesday already???

necrotic
Aug 1, 2005
I owe my brother big time for this!

gonadic io posted:

ctps: utc doesn't have time zones right? I'm trying to work out if
code:
let then = Utc::now();

// some time later
if Utc::now() - Duration(2, HOURS) < then { ... }
will gently caress me or if it's actually always going to be 2 hours of time.

utc is just gmt without daylight savings, op.

really you should use swatch time. 1000 ticks is easier math for everyone

Progressive JPEG
Feb 19, 2003

necrotic posted:

utc is just gmt without daylight savings, op.

really you should use swatch time. 1000 ticks is easier math for everyone

the punishment for you're posting shall be: 1000 ticks

Soricidus
Oct 20, 2010
freedom-hating statist shill
stardate or bust

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.



there is definitely a comment somewhere in a method from me saying "we take the users offset from utc from their browser and store it to work out the offset from the target time in the database when sending, if clocks have changed between setting and sending tough luck"

nobody is gonna miss an hour right?

4lokos basilisk
Jul 17, 2008


Powerful Two-Hander posted:

there is definitely a comment somewhere in a method from me saying "we take the users offset from utc from their browser and store it to work out the offset from the target time in the database when sending, if clocks have changed between setting and sending tough luck"

nobody is gonna miss an hour right?

this sounds like a bad life decision OP

edit: if i get your thing correctly, you should be able to mitigate it by storing the full ISO8601 with timestamp and then using your language's datetime library to calculate the offset so that it also takes into account what the time may be if there is DST involved

4lokos basilisk fucked around with this message at 22:05 on May 23, 2019

Soricidus
Oct 20, 2010
freedom-hating statist shill
time ruins everything. abolish time imho

Schadenboner
Aug 15, 2011

by Shine

Soricidus posted:

timb ruins everything. abolish timb imho

Aramoro
Jun 1, 2012




Penisface posted:

this sounds like a bad life decision OP

edit: if i get your thing correctly, you should be able to mitigate it by storing the full ISO8601 with timestamp and then using your language's datetime library to calculate the offset so that it also takes into account what the time may be if there is DST involved

Yeah I always push the locale stuff as close to the user as possible. Store everything in a single format and then localise it when rendering it on the screen.

One of the most complex parts of our system is date calculations based on working hours of people in potentially different timezones, it's a nightmare.

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.



Penisface posted:

this sounds like a bad life decision OP

edit: if i get your thing correctly, you should be able to mitigate it by storing the full ISO8601 with timestamp and then using your language's datetime library to calculate the offset so that it also takes into account what the time may be if there is DST involved

oh yeah definitely but this thing genuinely didn't have sensitivity on hours. Like it was "send an email on this day" type thing so you'd get it at 11pm or 1am rather than midnight.

tbh the whole idea was basically a lazy solution to a problem of "we forget to do poo poo" so now people can forget to set the reminder to remind them to do poo poo instead

edit: iirc I stored the offset from utc at the time of setting the date but I think the query for "stuff to send" used getdate() so would be server local time so could be 1hr out from utc

basically gently caress time zones

Powerful Two-Hander fucked around with this message at 23:07 on May 23, 2019

Adbot
ADBOT LOVES YOU

Sagebrush
Feb 26, 2012

professor flatulence pants, they call me
Two babies could be born at the exact same moment in New York and California but if the CA baby was born at 10pm the NY one would be born at 1am the next day and would be a day older despite being the same age

So yeah, gently caress time zones

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply